4261
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
3064
|
3 |
"
|
|
4 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
|
5 |
All Rights Reserved
|
|
6 |
|
|
7 |
This software is furnished under a license and may be used
|
|
8 |
only in accordance with the terms of that license and with the
|
|
9 |
inclusion of the above copyright notice. This software may not
|
|
10 |
be provided or otherwise made available to, or used by, any
|
|
11 |
other person. No title to or ownership of the software is
|
|
12 |
hereby transferred.
|
|
13 |
"
|
3062
|
14 |
"{ Package: 'stx:libcomp' }"
|
|
15 |
|
4035
|
16 |
"{ NameSpace: Smalltalk }"
|
|
17 |
|
3064
|
18 |
ProceedableError subclass:#ParseError
|
|
19 |
instanceVariableNames:'errorMessage startPosition endPosition lineNumber'
|
3062
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
|
22 |
category:'System-Compiler'
|
|
23 |
!
|
|
24 |
|
3064
|
25 |
!ParseError class methodsFor:'documentation'!
|
|
26 |
|
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
|
30 |
All Rights Reserved
|
|
31 |
|
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
!
|
|
40 |
|
|
41 |
documentation
|
|
42 |
"
|
|
43 |
raised for any compilation-related errors.
|
|
44 |
(originally, I wanted to subclass this from compilationError,
|
|
45 |
and raise different error for code generator issues (i.e. method too
|
|
46 |
big, etc.) But all users of the parser in the system (RB-stuff, Lint stuff,
|
4035
|
47 |
fileIn etc.) always handle the ParseError, and I don't want them to be forced to change.
|
3064
|
48 |
So we subclass the codeGenerator issues from this one.
|
|
49 |
"
|
|
50 |
! !
|
3062
|
51 |
|
|
52 |
!ParseError methodsFor:'accessing'!
|
|
53 |
|
|
54 |
description
|
4261
|
55 |
"construct the description from my default description (i.e. 'Parse Error:'),
|
|
56 |
followed by the actual parse-error-message, followed by the lineNumber (if known)"
|
|
57 |
|
3062
|
58 |
|s|
|
|
59 |
|
|
60 |
s := super description.
|
4261
|
61 |
|
3062
|
62 |
s last isSeparator ifFalse:[
|
|
63 |
errorMessage notEmptyOrNil ifTrue:[
|
|
64 |
s := s , ' '
|
|
65 |
]
|
|
66 |
].
|
|
67 |
s := s , (errorMessage ? '').
|
|
68 |
lineNumber notNil ifTrue:[
|
|
69 |
s := s , ' [Line ' , lineNumber asString , ']'
|
|
70 |
].
|
|
71 |
^ s
|
|
72 |
!
|
|
73 |
|
|
74 |
endPosition
|
4261
|
75 |
"the end-tokenposition, where the error is located"
|
|
76 |
|
3062
|
77 |
^ endPosition
|
|
78 |
!
|
|
79 |
|
4261
|
80 |
endPosition:anInteger
|
|
81 |
"the end-tokenposition, where the error is located"
|
|
82 |
|
|
83 |
endPosition := anInteger.
|
|
84 |
!
|
|
85 |
|
3064
|
86 |
errorMessage
|
|
87 |
^ errorMessage
|
|
88 |
!
|
|
89 |
|
4261
|
90 |
errorMessage:aString
|
|
91 |
errorMessage := aString.
|
3064
|
92 |
!
|
|
93 |
|
3062
|
94 |
errorMessage:errorMessageArg startPosition:startPositionArg
|
|
95 |
errorMessage := errorMessageArg.
|
|
96 |
startPosition := startPositionArg.
|
|
97 |
!
|
|
98 |
|
|
99 |
errorMessage:errorMessageArg startPosition:startPositionArg endPosition:endPositionArg
|
|
100 |
errorMessage := errorMessageArg.
|
|
101 |
startPosition := startPositionArg.
|
|
102 |
endPosition := endPositionArg.
|
|
103 |
!
|
|
104 |
|
|
105 |
lineNumber
|
4261
|
106 |
"the lineNumber, where the error was detected"
|
|
107 |
|
3062
|
108 |
^ lineNumber
|
|
109 |
!
|
|
110 |
|
4261
|
111 |
lineNumber:anInteger
|
|
112 |
"the lineNumber, where the error was detected"
|
|
113 |
|
|
114 |
lineNumber := anInteger.
|
3062
|
115 |
!
|
|
116 |
|
|
117 |
parser
|
|
118 |
^ originator
|
|
119 |
!
|
|
120 |
|
|
121 |
startPosition
|
4261
|
122 |
"the start-tokenposition, where the error is located"
|
|
123 |
|
3062
|
124 |
^ startPosition
|
4261
|
125 |
!
|
|
126 |
|
|
127 |
startPosition:anInteger
|
|
128 |
"the start-tokenposition, where the error is located"
|
|
129 |
|
|
130 |
startPosition := anInteger.
|
3062
|
131 |
! !
|
|
132 |
|
|
133 |
!ParseError class methodsFor:'documentation'!
|
|
134 |
|
|
135 |
version
|
4035
|
136 |
^ '$Header$'
|
3062
|
137 |
!
|
|
138 |
|
|
139 |
version_CVS
|
4035
|
140 |
^ '$Header$'
|
3062
|
141 |
! !
|
|
142 |
|