435
|
1 |
"{ Package: 'stx:goodies/petitparser/parsers/java' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
|
5 |
PPParser subclass:#PPJavaWhitespaceParser
|
|
6 |
instanceVariableNames:'separator'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'PetitJava-Core'
|
|
10 |
!
|
|
11 |
|
|
12 |
!PPJavaWhitespaceParser methodsFor:'as yet unclassified'!
|
|
13 |
|
|
14 |
acceptsEpsilon
|
|
15 |
^ true
|
|
16 |
!
|
|
17 |
|
|
18 |
acceptsEpsilonOpenSet: set
|
|
19 |
^ true
|
|
20 |
!
|
|
21 |
|
|
22 |
firstCharParser
|
|
23 |
^ PPFailingParser new
|
|
24 |
!
|
|
25 |
|
|
26 |
firstCharSet
|
|
27 |
^ PPCharSetPredicate on: [:e | false ]
|
|
28 |
!
|
|
29 |
|
|
30 |
isNullable
|
|
31 |
^ true
|
|
32 |
!
|
|
33 |
|
|
34 |
name
|
|
35 |
^ 'java_ws'
|
|
36 |
!
|
|
37 |
|
|
38 |
parseOn: context
|
|
39 |
|
|
40 |
| start |
|
|
41 |
|
|
42 |
[
|
|
43 |
| peekTwice |
|
|
44 |
[ context atEnd not and: [ context peek isSeparator ] ]
|
|
45 |
whileTrue: [ context next ].
|
|
46 |
peekTwice := context peekTwice.
|
|
47 |
((peekTwice first = $/) and:
|
|
48 |
[ (peekTwice second = $*) or: [peekTwice second = $/]])
|
|
49 |
] whileTrue: [
|
|
50 |
context next.
|
|
51 |
start := context position.
|
|
52 |
(context next = $*)
|
|
53 |
ifTrue: [ context upToAll: '*/' ]
|
|
54 |
ifFalse: [
|
|
55 |
| position |
|
|
56 |
position := context position.
|
|
57 |
context upToAnyOf: CharacterSet crlf].
|
|
58 |
].
|
|
59 |
! !
|
|
60 |
|