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 @ 44139
History | View | Annotate | Download (2.22 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 |
private String tip; |
13 |
|
14 |
public ExpressionSyntaxException() {
|
15 |
super("Syntax error in expression."); |
16 |
this.phrase = null; |
17 |
this.position = -1; |
18 |
this.description = I18N.Syntax_error_in_expression();
|
19 |
this.tip = null; |
20 |
} |
21 |
|
22 |
public ExpressionSyntaxException(LexicalAnalyzer lexer) {
|
23 |
super("Syntax error in '"+lexer.getSource()+"' near character "+ lexer.getPosition()+"."); |
24 |
this.phrase = lexer.getSource();
|
25 |
this.position = lexer.getPosition();
|
26 |
this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
27 |
} |
28 |
|
29 |
public ExpressionSyntaxException(String msg, LexicalAnalyzer lexer) { |
30 |
super("Syntax error in '"+lexer.getSource()+"' near character "+ lexer.getPosition()+". "+msg); |
31 |
this.phrase = lexer.getSource();
|
32 |
this.position = lexer.getPosition();
|
33 |
this.description = I18N.Syntax_error_near_character_XPositionX(position)+ " "+msg; |
34 |
} |
35 |
|
36 |
public ExpressionSyntaxException(String msg, LexicalAnalyzer lexer, String tip) { |
37 |
this(msg,lexer);
|
38 |
this.tip = tip;
|
39 |
} |
40 |
|
41 |
public ExpressionSyntaxException(String phrase, int position) { |
42 |
super("Syntax error in '"+phrase+"' near character "+ position+"."); |
43 |
this.phrase = phrase;
|
44 |
this.position = position;
|
45 |
this.description = I18N.Syntax_error_near_character_XPositionX(position);
|
46 |
} |
47 |
|
48 |
public ExpressionSyntaxException(String msg, String phrase, int position) { |
49 |
super("Syntax error in '"+phrase+"' near character "+ position+". "+msg); |
50 |
this.phrase = phrase;
|
51 |
this.position = position;
|
52 |
this.description = I18N.Syntax_error_near_character_XPositionX(position)+" "+msg; |
53 |
} |
54 |
|
55 |
public String getPhrase() { |
56 |
return this.phrase; |
57 |
} |
58 |
|
59 |
public int getPosition() { |
60 |
return this.position; |
61 |
} |
62 |
|
63 |
public String getDescription() { |
64 |
return this.description; |
65 |
} |
66 |
|
67 |
public String getTip() { |
68 |
return this.tip; |
69 |
} |
70 |
} |