Revision 44098 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java
DefaultCompiler.java | ||
---|---|---|
87 | 87 |
lexer.next(); |
88 | 88 |
op2 = parse_not(); |
89 | 89 |
if( op2==null ) { |
90 |
throw new ExpressionSyntaxException(lexer); |
|
90 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_OR_operator(),lexer);
|
|
91 | 91 |
} |
92 | 92 |
op1 = codeBuilder.or(op1, op2); |
93 | 93 |
break; |
... | ... | |
95 | 95 |
lexer.next(); |
96 | 96 |
op2 = parse_not(); |
97 | 97 |
if( op2==null ) { |
98 |
throw new ExpressionSyntaxException(lexer); |
|
98 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_AND_operator(),lexer);
|
|
99 | 99 |
} |
100 | 100 |
op1 = codeBuilder.and(op1, op2); |
101 | 101 |
break; |
... | ... | |
128 | 128 |
lexer.next(); |
129 | 129 |
op2 = parse_sum(); |
130 | 130 |
if( op2==null ) { |
131 |
throw new ExpressionSyntaxException(lexer); |
|
131 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_LT_operator(),lexer);
|
|
132 | 132 |
} |
133 | 133 |
op1 = codeBuilder.lt(op1, op2); |
134 | 134 |
break; |
... | ... | |
136 | 136 |
lexer.next(); |
137 | 137 |
op2 = parse_sum(); |
138 | 138 |
if( op2==null ) { |
139 |
throw new ExpressionSyntaxException(lexer); |
|
139 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_GT_operator(),lexer);
|
|
140 | 140 |
} |
141 | 141 |
op1 = codeBuilder.gt(op1, op2); |
142 | 142 |
break; |
... | ... | |
144 | 144 |
lexer.next(); |
145 | 145 |
op2 = parse_sum(); |
146 | 146 |
if( op2==null ) { |
147 |
throw new ExpressionSyntaxException(lexer); |
|
147 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_LE_operator(),lexer);
|
|
148 | 148 |
} |
149 | 149 |
op1 = codeBuilder.le(op1, op2); |
150 | 150 |
break; |
... | ... | |
152 | 152 |
lexer.next(); |
153 | 153 |
op2 = parse_sum(); |
154 | 154 |
if( op2==null ) { |
155 |
throw new ExpressionSyntaxException(lexer); |
|
155 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_GE_operator(),lexer);
|
|
156 | 156 |
} |
157 | 157 |
op1 = codeBuilder.ge(op1, op2); |
158 | 158 |
break; |
... | ... | |
160 | 160 |
lexer.next(); |
161 | 161 |
op2 = parse_sum(); |
162 | 162 |
if( op2==null ) { |
163 |
throw new ExpressionSyntaxException(lexer); |
|
163 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_EQ_operator(),lexer);
|
|
164 | 164 |
} |
165 | 165 |
op1 = codeBuilder.eq(op1, op2); |
166 | 166 |
break; |
... | ... | |
168 | 168 |
lexer.next(); |
169 | 169 |
op2 = parse_sum(); |
170 | 170 |
if( op2==null ) { |
171 |
throw new ExpressionSyntaxException(lexer); |
|
171 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_NEQ_operator(),lexer);
|
|
172 | 172 |
} |
173 | 173 |
op1 = codeBuilder.ne(op1, op2); |
174 | 174 |
break; |
... | ... | |
181 | 181 |
} else { |
182 | 182 |
op2 = parse_sum(); |
183 | 183 |
if( op2==null ) { |
184 |
throw new ExpressionSyntaxException(lexer); |
|
184 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_IS_operator(),lexer);
|
|
185 | 185 |
} |
186 | 186 |
op1 = codeBuilder.is(op1, op2); |
187 | 187 |
} |
... | ... | |
195 | 195 |
lexer.next(); |
196 | 196 |
op2 = parse_sum(); |
197 | 197 |
if( op2==null ) { |
198 |
throw new ExpressionSyntaxException(lexer); |
|
198 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_REGEXP_operator(),lexer);
|
|
199 | 199 |
} |
200 | 200 |
op1 = codeBuilder.regexp(op1, op2); |
201 | 201 |
break; |
... | ... | |
203 | 203 |
lexer.next(); |
204 | 204 |
op2 = parse_sum(); |
205 | 205 |
if( op2==null ) { |
206 |
throw new ExpressionSyntaxException(lexer); |
|
206 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_LIKE_operator(),lexer);
|
|
207 | 207 |
} |
208 | 208 |
op1 = codeBuilder.like(op1, op2); |
209 | 209 |
break; |
... | ... | |
211 | 211 |
lexer.next(); |
212 | 212 |
op2 = parse_sum(); |
213 | 213 |
if( op2==null ) { |
214 |
throw new ExpressionSyntaxException(lexer); |
|
214 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_ILIKE_operator(),lexer);
|
|
215 | 215 |
} |
216 | 216 |
op1 = codeBuilder.ilike(op1, op2); |
217 | 217 |
break; |
... | ... | |
253 | 253 |
lexer.next(); |
254 | 254 |
op2 = parse_getattr(); |
255 | 255 |
if( op2==null ) { |
256 |
throw new ExpressionSyntaxException(lexer); |
|
256 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_MULT_operator(),lexer);
|
|
257 | 257 |
} |
258 | 258 |
op1 = codeBuilder.mult(op1, op2); |
259 | 259 |
break; |
... | ... | |
261 | 261 |
lexer.next(); |
262 | 262 |
op2 = parse_getattr(); |
263 | 263 |
if( op2==null ) { |
264 |
throw new ExpressionSyntaxException(lexer); |
|
264 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_DIV_operator(),lexer);
|
|
265 | 265 |
} |
266 | 266 |
op1 = codeBuilder.div(op1, op2); |
267 | 267 |
break; |
... | ... | |
269 | 269 |
lexer.next(); |
270 | 270 |
op2 = parse_getattr(); |
271 | 271 |
if( op2==null ) { |
272 |
throw new ExpressionSyntaxException(lexer); |
|
272 |
throw new ExpressionSyntaxException(I18N.Cant_recognize_the_second_operand_of_MOD_operator(),lexer);
|
|
273 | 273 |
} |
274 | 274 |
op1 = codeBuilder.mod(op1, op2); |
275 | 275 |
break; |
... | ... | |
292 | 292 |
next = lexer.look(); |
293 | 293 |
if( next.getType()!=Token.IDENTIFIER ) { |
294 | 294 |
throw new ExpressionSyntaxException( |
295 |
"An attribute identifier was expected and '"+next.getLiteral()+"' was found", |
|
296 |
lexer.getSource(), |
|
297 |
lexer.getPosition() |
|
295 |
I18N.An_attribute_identifier_was_expected_and_XliteralX_was_found(next.getLiteral()), |
|
296 |
lexer |
|
298 | 297 |
); |
299 | 298 |
} |
300 | 299 |
String id = (String) next.getLiteral(); |
... | ... | |
306 | 305 |
next = lexer.next(); |
307 | 306 |
if( next.getType() != Token.PARENTHESIS_CLOSE ) { |
308 | 307 |
throw new ExpressionSyntaxException( |
309 |
"Closing parenthesis was expected and '"+next.getLiteral()+"' was found", |
|
310 |
lexer.getSource(), |
|
311 |
lexer.getPosition() |
|
308 |
I18N.Closing_parenthesis_was_expected_and_XliteralX_was_found(next.getLiteral()), |
|
309 |
lexer |
|
312 | 310 |
); |
313 | 311 |
} |
314 | 312 |
return codeBuilder.method(op1, id, args); |
... | ... | |
329 | 327 |
lexer.next(); |
330 | 328 |
Code value = parseExpression(); |
331 | 329 |
Token next = lexer.next(); |
332 |
if( next.getType() != Token.PARENTHESIS_CLOSE ) { |
|
333 |
throw new ExpressionSyntaxException( |
|
334 |
"Closing parenthesis was expected and '"+next.getLiteral()+"' was found", |
|
335 |
lexer.getSource(), |
|
336 |
lexer.getPosition() |
|
337 |
); |
|
330 |
switch(next.getType()) { |
|
331 |
case Token.PARENTHESIS_CLOSE: |
|
332 |
break; |
|
333 |
case Token.EOF: |
|
334 |
throw new ExpressionSyntaxException( |
|
335 |
I18N.Closing_parenthesis_was_expected_and_end_of_source_was_found(), |
|
336 |
lexer |
|
337 |
); |
|
338 |
default: |
|
339 |
throw new ExpressionSyntaxException( |
|
340 |
I18N.Closing_parenthesis_was_expected_and_XliteralX_was_found(next.getLiteral()), |
|
341 |
lexer |
|
342 |
); |
|
338 | 343 |
} |
339 | 344 |
return value; |
340 | 345 |
} |
... | ... | |
346 | 351 |
lexer.next(); |
347 | 352 |
Arguments args = parseArgs(); |
348 | 353 |
next = lexer.next(); |
349 |
if( next.getType() != Token.PARENTHESIS_CLOSE ) { |
|
350 |
throw new ExpressionSyntaxException( |
|
351 |
"Closing parenthesis was expected and '"+next.getLiteral()+"' was found", |
|
352 |
lexer.getSource(), |
|
353 |
lexer.getPosition() |
|
354 |
); |
|
354 |
switch(next.getType()) { |
|
355 |
case Token.PARENTHESIS_CLOSE: |
|
356 |
break; |
|
357 |
case Token.EOF: |
|
358 |
throw new ExpressionSyntaxException( |
|
359 |
I18N.Closing_parenthesis_was_expected_and_end_of_source_was_found(), |
|
360 |
lexer |
|
361 |
); |
|
362 |
default: |
|
363 |
throw new ExpressionSyntaxException( |
|
364 |
I18N.Closing_parenthesis_was_expected_and_XliteralX_was_found(next.getLiteral()), |
|
365 |
lexer |
|
366 |
); |
|
355 | 367 |
} |
356 | 368 |
return codeBuilder.function(id, args); |
357 | 369 |
} else { |
... | ... | |
376 | 388 |
case Token.FALSE: |
377 | 389 |
lexer.next(); |
378 | 390 |
return codeBuilder.constant(false); |
391 |
case Token.OP_SUBST: |
|
392 |
lexer.next(); |
|
393 |
Code code = parse_termino(); |
|
394 |
return codeBuilder.negate(code); |
|
395 |
case Token.EOF: |
|
396 |
throw new ExpressionSyntaxException(I18N.unexpected_end_of_source(),lexer); |
|
379 | 397 |
} |
380 | 398 |
return null; |
381 | 399 |
} |
Also available in: Unified diff