equal
deleted
inserted
replaced
|
1 "{ Package: 'squeak:petitparser' }" |
|
2 |
|
3 PPDelegateParser subclass:#PPEndOfInputParser |
|
4 instanceVariableNames:'' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitParser-Parsers' |
|
8 ! |
|
9 |
|
10 PPEndOfInputParser comment:'A parser that succeeds only at the end of the input stream.' |
|
11 ! |
|
12 |
|
13 |
|
14 !PPEndOfInputParser methodsFor:'operations'! |
|
15 |
|
16 end |
|
17 ^ self |
|
18 ! ! |
|
19 |
|
20 !PPEndOfInputParser methodsFor:'parsing'! |
|
21 |
|
22 parseOn: aStream |
|
23 | position result | |
|
24 position := aStream position. |
|
25 result := parser parseOn: aStream. |
|
26 (result isPetitFailure or: [ aStream atEnd ]) |
|
27 ifTrue: [ ^ result ]. |
|
28 result := PPFailure |
|
29 message: 'end of input expected' |
|
30 at: aStream position. |
|
31 aStream position: position. |
|
32 ^ result |
|
33 ! ! |
|
34 |
|
35 !PPEndOfInputParser class methodsFor:'documentation'! |
|
36 |
|
37 version_SVN |
|
38 ^ '$Id: PPEndOfInputParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $' |
|
39 ! ! |