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 |
|
|
11 |
!PPFailingParser class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
message: aString
|
|
14 |
^ self new setMessage: aString
|
|
15 |
! !
|
|
16 |
|
164
|
17 |
!PPFailingParser methodsFor:'*petitanalyzer-matching'!
|
|
18 |
|
|
19 |
match: aParser inContext: aDictionary seen: anIdentitySet
|
|
20 |
^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self message = aParser message ]
|
|
21 |
! !
|
|
22 |
|
0
|
23 |
!PPFailingParser methodsFor:'accessing'!
|
|
24 |
|
|
25 |
message
|
|
26 |
"Answer the error message of the receiving parser."
|
|
27 |
|
|
28 |
^ message
|
|
29 |
! !
|
|
30 |
|
|
31 |
!PPFailingParser methodsFor:'initialization'!
|
|
32 |
|
|
33 |
setMessage: aString
|
|
34 |
message := aString
|
|
35 |
! !
|
|
36 |
|
|
37 |
!PPFailingParser methodsFor:'parsing'!
|
|
38 |
|
|
39 |
parseOn: aStream
|
|
40 |
^ PPFailure message: message at: aStream position
|
|
41 |
! !
|
|
42 |
|
|
43 |
!PPFailingParser methodsFor:'printing'!
|
|
44 |
|
|
45 |
printNameOn: aStream
|
|
46 |
super printNameOn: aStream.
|
|
47 |
aStream nextPutAll: ', '; print: message
|
|
48 |
! !
|
|
49 |
|
|
50 |
!PPFailingParser class methodsFor:'documentation'!
|
|
51 |
|
41
|
52 |
version
|
164
|
53 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
|
41
|
54 |
!
|
|
55 |
|
|
56 |
version_CVS
|
164
|
57 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
|
41
|
58 |
!
|
|
59 |
|
0
|
60 |
version_SVN
|
164
|
61 |
^ '$Id: PPFailingParser.st,v 1.4 2014-03-04 14:32:28 cg Exp $'
|
0
|
62 |
! !
|
164
|
63 |
|