equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPParser subclass:#PPStartOfLogicalLineParser |
|
6 instanceVariableNames:'' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitParser-Parsers' |
|
10 ! |
|
11 |
|
12 !PPStartOfLogicalLineParser methodsFor:'as yet unclassified'! |
|
13 |
|
14 isBlank: character |
|
15 ^ (character == Character space or: [character == Character tab]) |
|
16 ! |
|
17 |
|
18 parseOn: aPPContext |
|
19 aPPContext peek isAlphaNumeric ifFalse: [ |
|
20 ^ PPFailure message: 'Start of logical line expected' context: aPPContext |
|
21 ]. |
|
22 |
|
23 aPPContext isStartOfLine ifTrue: [ ^ #startOfLogicalLine ]. |
|
24 |
|
25 |
|
26 [ aPPContext position ~= 0 ] whileTrue: [ |
|
27 aPPContext back. |
|
28 (self isBlank: aPPContext peek) ifFalse: [ |
|
29 ^ PPFailure message: 'Start of logical line expected' context: aPPContext |
|
30 ]. |
|
31 aPPContext isStartOfLine ifTrue: [ ^ #startOfLogicalLine ]. |
|
32 ] |
|
33 ! ! |
|
34 |