4
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
0
|
2 |
|
|
3 |
PPParser subclass:#PPFailingParser
|
|
4 |
instanceVariableNames:'message'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Parsers'
|
|
8 |
!
|
|
9 |
|
|
10 |
PPFailingParser comment:'A parser that consumes nothing and always fails.
|
|
11 |
Instance Variables:
|
4
|
12 |
message <String> The failure message.'
|
0
|
13 |
!
|
|
14 |
|
|
15 |
|
|
16 |
!PPFailingParser class methodsFor:'instance creation'!
|
|
17 |
|
|
18 |
message: aString
|
|
19 |
^ self new setMessage: aString
|
|
20 |
! !
|
|
21 |
|
|
22 |
!PPFailingParser methodsFor:'accessing'!
|
|
23 |
|
|
24 |
message
|
|
25 |
"Answer the error message of the receiving parser."
|
|
26 |
|
|
27 |
^ message
|
|
28 |
! !
|
|
29 |
|
|
30 |
!PPFailingParser methodsFor:'initialization'!
|
|
31 |
|
|
32 |
setMessage: aString
|
|
33 |
message := aString
|
|
34 |
! !
|
|
35 |
|
|
36 |
!PPFailingParser methodsFor:'parsing'!
|
|
37 |
|
|
38 |
parseOn: aStream
|
|
39 |
^ PPFailure message: message at: aStream position
|
|
40 |
! !
|
|
41 |
|
|
42 |
!PPFailingParser methodsFor:'printing'!
|
|
43 |
|
|
44 |
printNameOn: aStream
|
|
45 |
super printNameOn: aStream.
|
|
46 |
aStream nextPutAll: ', '; print: message
|
|
47 |
! !
|
|
48 |
|
|
49 |
!PPFailingParser class methodsFor:'documentation'!
|
|
50 |
|
|
51 |
version_SVN
|
4
|
52 |
^ '$Id: PPFailingParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
|
0
|
53 |
! !
|