author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 07 Oct 2014 09:42:03 +0100 | |
changeset 385 | 44a36ed4e484 |
parent 377 | 6112a403a52d |
child 642 | 77d5fddb6462 |
permissions | -rw-r--r-- |
4 | 1 |
"{ Package: 'stx:goodies/petitparser' }" |
0 | 2 |
|
3 |
Object subclass:#PPFailure |
|
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
4 |
instanceVariableNames:'message context position' |
0 | 5 |
classVariableNames:'' |
6 |
poolDictionaries:'' |
|
7 |
category:'PetitParser-Core' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!PPFailure class methodsFor:'instance creation'! |
|
12 |
||
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
13 |
message: aString |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
14 |
^ self basicNew initializeMessage: aString |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
15 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
16 |
|
0 | 17 |
message: aString at: anInteger |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
18 |
"One should not use this method if the furthest failure is supposed to be reported correctly" |
0 | 19 |
^ self basicNew initializeMessage: aString at: anInteger |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
20 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
21 |
|
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
22 |
message: aString context: aPPContext |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
23 |
^ self basicNew initializeMessage: aString context: aPPContext |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
24 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
25 |
|
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
26 |
message: aString context: aPPContext at: position |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
27 |
^ self basicNew initializeMessage: aString context: aPPContext position: position |
0 | 28 |
! ! |
29 |
||
30 |
!PPFailure methodsFor:'accessing'! |
|
31 |
||
32 |
message |
|
33 |
"Answer a human readable error message of this parse failure." |
|
45 | 34 |
|
0 | 35 |
^ message |
36 |
! |
|
37 |
||
38 |
position |
|
39 |
"Answer the position in the source string that caused this parse failure." |
|
40 |
||
41 |
^ position |
|
42 |
! ! |
|
43 |
||
44 |
!PPFailure methodsFor:'initialization'! |
|
45 |
||
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
46 |
initializeMessage: aString |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
47 |
message := aString. |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
48 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
49 |
|
0 | 50 |
initializeMessage: aString at: anInteger |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
51 |
"One should not use this method if the furthest failure is supposed to be reported correctly" |
0 | 52 |
message := aString. |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
53 |
position := anInteger. |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
54 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
55 |
|
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
56 |
initializeMessage: aString context: aPPContext |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
57 |
self initializeMessage: aString context: aPPContext position: aPPContext position |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
58 |
! |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
59 |
|
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
60 |
initializeMessage: aString context: aPPContext position: anInteger |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
61 |
message := aString. |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
62 |
context := aPPContext. |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
63 |
position := anInteger. |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
64 |
|
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
65 |
"record the furthest failure encountered while parsing the input stream " |
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
66 |
aPPContext noteFailure: self. |
0 | 67 |
! ! |
68 |
||
69 |
!PPFailure methodsFor:'printing'! |
|
70 |
||
71 |
printOn: aStream |
|
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
72 |
aStream nextPutAll: self message; nextPutAll: ' at '; print: self position |
0 | 73 |
! ! |
74 |
||
75 |
!PPFailure methodsFor:'testing'! |
|
76 |
||
77 |
isPetitFailure |
|
78 |
"I am the only class that should implement this method to return true." |
|
79 |
||
80 |
^ true |
|
81 |
! ! |
|
82 |
||
83 |
!PPFailure class methodsFor:'documentation'! |
|
84 |
||
45 | 85 |
version |
86 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailure.st,v 1.3 2012-05-04 22:08:15 vrany Exp $' |
|
87 |
! |
|
88 |
||
89 |
version_CVS |
|
90 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPFailure.st,v 1.3 2012-05-04 22:08:15 vrany Exp $' |
|
91 |
! |
|
92 |
||
0 | 93 |
version_SVN |
45 | 94 |
^ '§Id: PPFailure.st 2 2010-12-17 18:44:23Z vranyj1 §' |
0 | 95 |
! ! |
377
6112a403a52d
Updated to latest version from Moose repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
45
diff
changeset
|
96 |