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