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