-
Notifications
You must be signed in to change notification settings - Fork 0
/
LexicalAnalyzer.java
45 lines (41 loc) · 931 Bytes
/
LexicalAnalyzer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.LinkedList;
/**
* @author martin (cernama9@fit.cvut.cz)
* @since 6.3.15.
*/
abstract class LexicalAnalyzer
{
/**
* Generates tokens from input specified
*
* @param input The input to be lexically analyzed
* @return The list of tokens generated
* @throws SyntaxIncorrect
* @throws InputNotAccepted
*/
abstract public LinkedList<String> parseTokens(String input) throws SyntaxIncorrect, InputNotAccepted;
/**
* The states of the lexical analyzer finite state machine
*/
protected enum AnalyzerStates {}
}
/**
* Signifies that the syntax of a command being lexically analysed incorrect
*/
final class SyntaxIncorrect extends Exception
{
public SyntaxIncorrect(String message)
{
super(message);
}
}
/**
* The input has not been accepted by the lexical analyzer
*/
final class InputNotAccepted extends Exception
{
public InputNotAccepted(String message)
{
super(message);
}
}