10 ! |
10 ! |
11 |
11 |
12 !PPCStarMessagePredicateNode methodsFor:'accessing'! |
12 !PPCStarMessagePredicateNode methodsFor:'accessing'! |
13 |
13 |
14 children |
14 children |
15 ^ #() |
15 ^ #() |
16 ! |
16 ! |
17 |
17 |
18 firstCharSet |
18 firstCharSet |
19 ^ PPCharSetPredicate on: [:char | char perform: message ] |
19 ^ PPCharSetPredicate on: [:char | char perform: message ] |
20 ! |
20 ! |
21 |
21 |
22 message |
22 message |
23 |
23 |
24 ^ message |
24 ^ message |
25 ! |
25 ! |
26 |
26 |
27 message: anObject |
27 message: anObject |
28 |
28 |
29 message := anObject |
29 message := anObject |
30 ! |
30 ! |
31 |
31 |
32 prefix |
32 prefix |
33 ^ #starPredicate |
33 ^ #starPredicate |
|
34 ! ! |
|
35 |
|
36 !PPCStarMessagePredicateNode methodsFor:'analysis'! |
|
37 |
|
38 firstSets: aFirstDictionary into: aSet suchThat: aBlock |
|
39 " |
|
40 First and follow should be performed on the non-specialized tree, i.e. on a tree |
|
41 with star -> messageNode. Not on myself. |
|
42 |
|
43 The reason for that is, that: |
|
44 - I am terminal |
|
45 - I am nullable |
|
46 |
|
47 This means, I look like epsilon node for the first follow analysis. And epsilons |
|
48 are ignored in sequences, thus sequence of StarMessagePredicate, Literal |
|
49 leads to { Literal } as firstSet and not expected { MessagePredicate, Literal } |
|
50 " |
|
51 ^ self error: 'Cannot perform first/follow analysis on myself, sorry for that :(' |
34 ! ! |
52 ! ! |
35 |
53 |
36 !PPCStarMessagePredicateNode methodsFor:'comparing'! |
54 !PPCStarMessagePredicateNode methodsFor:'comparing'! |
37 |
55 |
38 = anotherNode |
56 = anotherNode |
39 super = anotherNode ifFalse: [ ^ false ]. |
57 super = anotherNode ifFalse: [ ^ false ]. |
40 ^ message = anotherNode message. |
58 ^ message = anotherNode message. |
41 ! |
59 ! |
42 |
60 |
43 hash |
61 hash |
44 ^ super hash bitXor: message hash |
62 ^ super hash bitXor: message hash |
45 ! ! |
63 ! ! |
46 |
64 |
47 !PPCStarMessagePredicateNode methodsFor:'visiting'! |
65 !PPCStarMessagePredicateNode methodsFor:'visiting'! |
48 |
66 |
49 accept: visitor |
67 accept: visitor |
50 ^ visitor visitStarMessagePredicateNode: self |
68 ^ visitor visitStarMessagePredicateNode: self |
51 ! ! |
69 ! ! |
52 |
70 |