equal
deleted
inserted
replaced
14 ^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: 'no ' , aString |
14 ^ self on: aBlock message: aString negated: [ :each | (aBlock value: each) not ] message: 'no ' , aString |
15 ! |
15 ! |
16 |
16 |
17 on: aBlock message: aString negated: aNegatedBlock message: aNegatedString |
17 on: aBlock message: aString negated: aNegatedBlock message: aNegatedString |
18 ^ self new initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString |
18 ^ self new initializeOn: aBlock message: aString negated: aNegatedBlock message: aNegatedString |
|
19 ! |
|
20 |
|
21 startOfLine |
|
22 |
|
23 ^ PPStartOfLine new. |
19 ! ! |
24 ! ! |
20 |
25 |
21 !PPPredicateObjectParser class methodsFor:'factory-chars'! |
26 !PPPredicateObjectParser class methodsFor:'factory-chars'! |
22 |
27 |
23 blank |
28 blank |
35 chars: aCollection message: aString |
40 chars: aCollection message: aString |
36 ^ self on: (PPCharSetPredicate on: [ :char | aCollection includes: char ]) message: aString |
41 ^ self on: (PPCharSetPredicate on: [ :char | aCollection includes: char ]) message: aString |
37 ! |
42 ! |
38 |
43 |
39 cr |
44 cr |
40 |cr| |
45 ^ self char: Character cr message: 'carriage return expected' |
41 |
|
42 cr := Smalltalk isSmalltalkX |
|
43 ifTrue:[Character return] |
|
44 ifFalse:[Character cr]. |
|
45 ^ self char: cr message: 'carriage return expected' |
|
46 ! |
46 ! |
47 |
47 |
48 digit |
48 digit |
49 ^ self on: (PPCharSetPredicate on: [ :char | char isDigit ]) message: 'digit expected' |
49 ^ self on: (PPCharSetPredicate on: [ :char | char isDigit ]) message: 'digit expected' |
50 ! |
50 ! |
69 lowercase |
69 lowercase |
70 ^ self on: (PPCharSetPredicate on: [ :char | char isLowercase ]) message: 'lowercase letter expected' |
70 ^ self on: (PPCharSetPredicate on: [ :char | char isLowercase ]) message: 'lowercase letter expected' |
71 ! |
71 ! |
72 |
72 |
73 newline |
73 newline |
74 |cr| |
74 ^ self chars: (String with: Character cr with: Character lf) message: 'newline expected' |
75 |
|
76 cr := Smalltalk isSmalltalkX |
|
77 ifTrue:[Character return] |
|
78 ifFalse:[Character cr]. |
|
79 ^ self chars: (String with: cr with: Character lf) message: 'newline expected' |
|
80 ! |
75 ! |
81 |
76 |
82 punctuation |
77 punctuation |
83 ^ self chars: '.,"''?!!;:#$%&()*+-/<>=@[]\^_{}|~' message: 'punctuation expected' |
78 ^ self chars: '.,"''?!!;:#$%&()*+-/<>=@[]\^_{}|~' message: 'punctuation expected' |
84 ! |
79 ! |
154 negated: predicate message: predicateMessage |
149 negated: predicate message: predicateMessage |
155 ! ! |
150 ! ! |
156 |
151 |
157 !PPPredicateObjectParser methodsFor:'parsing'! |
152 !PPPredicateObjectParser methodsFor:'parsing'! |
158 |
153 |
159 parseOn: aStream |
154 parseOn: aPPContext |
160 ^ (aStream atEnd not and: [ predicate value: aStream uncheckedPeek ]) |
155 ^ (aPPContext atEnd not and: [ predicate value: aPPContext uncheckedPeek ]) |
161 ifFalse: [ PPFailure message: predicateMessage at: aStream position ] |
156 ifFalse: [ PPFailure message: predicateMessage context: aPPContext ] |
162 ifTrue: [ aStream next ] |
157 ifTrue: [ aPPContext next ] |
163 ! ! |
158 ! ! |
164 |
159 |
165 !PPPredicateObjectParser class methodsFor:'documentation'! |
160 !PPPredicateObjectParser class methodsFor:'documentation'! |
166 |
161 |
167 version |
162 version |