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 |
package org.gvsig.expressionevaluator; |
---|---|
2 |
|
3 |
/**
|
4 |
*
|
5 |
* @author jjdelcerro
|
6 |
*/
|
7 |
public class ExpressionSyntaxException extends RuntimeException { |
8 |
|
9 |
private final int position; |
10 |
private final String phrase; |
11 |
private final String description; |
12 |
|
13 |
public ExpressionSyntaxException() {
|
14 |
super("Syntax error in expression."); |
15 |
this.phrase = null; |
16 |
this.position = -1; |
17 |
this.description = I18N.Syntax_error_in_expression();
|
18 |
} |
19 |
|
20 |
public ExpressionSyntaxException(LexicalAnalyzer lexer) {
|
21 |
super("Syntax error in '"+lexer.getSource()+"' near character "+ lexer.getPosition()+"."); |
22 |
this.phrase = lexer.getSource();
|
23 |
this.position = lexer.getPosition();
|
24 |
this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
25 |
} |
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 |
this.description = I18N.Syntax_error_near_character_XPositionX(position)+ " "+msg; |
32 |
} |
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 |
this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
39 |
} |
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 |
this.description = I18N.Syntax_error_near_character_XPositionX(position)+" "+msg; |
46 |
} |
47 |
|
48 |
public String getPhrase() { |
49 |
return this.phrase; |
50 |
} |
51 |
|
52 |
public int getPosition() { |
53 |
return this.position; |
54 |
} |
55 |
|
56 |
public String getDescription() { |
57 |
return this.description; |
58 |
} |
59 |
} |