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