svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.api / src / main / java / org / gvsig / expressionevaluator / ExpressionSyntaxException.java @ 44098
History | View | Annotate | Download (1.97 KB)
1 | 43983 | jjdelcerro | package org.gvsig.expressionevaluator; |
---|---|---|---|
2 | |||
3 | /**
|
||
4 | *
|
||
5 | * @author jjdelcerro
|
||
6 | */
|
||
7 | public class ExpressionSyntaxException extends RuntimeException { |
||
8 | |||
9 | 44098 | jjdelcerro | private final int position; |
10 | private final String phrase; |
||
11 | private final String description; |
||
12 | 43983 | jjdelcerro | |
13 | public ExpressionSyntaxException() {
|
||
14 | super("Syntax error in expression."); |
||
15 | 44098 | jjdelcerro | this.phrase = null; |
16 | this.position = -1; |
||
17 | this.description = I18N.Syntax_error_in_expression();
|
||
18 | 43983 | jjdelcerro | } |
19 | |||
20 | public ExpressionSyntaxException(LexicalAnalyzer lexer) {
|
||
21 | super("Syntax error in '"+lexer.getSource()+"' near character "+ lexer.getPosition()+"."); |
||
22 | 44098 | jjdelcerro | this.phrase = lexer.getSource();
|
23 | this.position = lexer.getPosition();
|
||
24 | this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
||
25 | 43983 | jjdelcerro | } |
26 | |||
27 | public ExpressionSyntaxException(String msg, LexicalAnalyzer lexer) { |
||
28 | super("Syntax error in '"+lexer.getSource()+"' near character "+ lexer.getPosition()+". "+msg); |
||
29 | this.phrase = lexer.getSource();
|
||
30 | this.position = lexer.getPosition();
|
||
31 | 44098 | jjdelcerro | this.description = I18N.Syntax_error_near_character_XPositionX(position)+ " "+msg; |
32 | 43983 | jjdelcerro | } |
33 | |||
34 | public ExpressionSyntaxException(String phrase, int position) { |
||
35 | super("Syntax error in '"+phrase+"' near character "+ position+"."); |
||
36 | this.phrase = phrase;
|
||
37 | this.position = position;
|
||
38 | 44098 | jjdelcerro | this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
39 | 43983 | jjdelcerro | } |
40 | |||
41 | public ExpressionSyntaxException(String msg, String phrase, int position) { |
||
42 | super("Syntax error in '"+phrase+"' near character "+ position+". "+msg); |
||
43 | this.phrase = phrase;
|
||
44 | this.position = position;
|
||
45 | 44098 | jjdelcerro | this.description = I18N.Syntax_error_near_character_XPositionX(position)+" "+msg; |
46 | 43983 | jjdelcerro | } |
47 | |||
48 | public String getPhrase() { |
||
49 | return this.phrase; |
||
50 | } |
||
51 | |||
52 | public int getPosition() { |
||
53 | return this.position; |
||
54 | } |
||
55 | 44098 | jjdelcerro | |
56 | public String getDescription() { |
||
57 | return this.description; |
||
58 | } |
||
59 | 43983 | jjdelcerro | } |