1
2
3
4
5
6
7
8
9
10
11 package org.csveed.token;
12
13
14
15
16 public class ParseException extends Exception {
17
18
19 private static final long serialVersionUID = 1L;
20
21
22 private final ParseState state;
23
24
25 private final EncounteredSymbol symbol;
26
27
28 private final int symbolCharacter;
29
30
31
32
33
34
35
36
37
38
39
40 public ParseException(ParseState state, int symbolCharacter, EncounteredSymbol symbol) {
41 this.state = state;
42 this.symbolCharacter = symbolCharacter;
43 this.symbol = symbol;
44 }
45
46
47
48
49
50
51 public ParseState getState() {
52 return state;
53 }
54
55
56
57
58
59
60 public EncounteredSymbol getSymbol() {
61 return symbol;
62 }
63
64
65
66
67
68
69 public int getSymbolCharacter() {
70 return symbolCharacter;
71 }
72
73 @Override
74 public String getMessage() {
75 return "Illegal state transition: Parsing symbol " + getSymbol() + " [" + getSymbolCharacter() + "] in state "
76 + getState();
77 }
78
79 }