public final class InstructionSequenceBuilder extends Parser.AbstractSyntaxHandler
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
INTEGER_PATTERN |
private InstructionSequence |
mainSequence |
private static java.util.regex.Pattern |
REAL_PATTERN |
private java.util.Stack<InstructionSequence> |
seqStack |
Modifier | Constructor and Description |
---|---|
private |
InstructionSequenceBuilder() |
Modifier and Type | Method and Description |
---|---|
private InstructionSequence |
getCurrentSequence() |
InstructionSequence |
getInstructionSequence()
Returns the instruction sequence that has been build from the syntactic elements.
|
static InstructionSequence |
parse(java.lang.CharSequence text)
Parses the given text into an instruction sequence representing a Type 4 function
that can be executed.
|
static int |
parseInt(java.lang.String token)
Parses a value of type "int".
|
static float |
parseReal(java.lang.String token)
Parses a value of type "real".
|
void |
token(java.lang.CharSequence text)
Called when a token is encountered.
|
private void |
token(java.lang.String token) |
comment, newLine, whitespace
private static final java.util.regex.Pattern INTEGER_PATTERN
private static final java.util.regex.Pattern REAL_PATTERN
private final InstructionSequence mainSequence
private final java.util.Stack<InstructionSequence> seqStack
public InstructionSequence getInstructionSequence()
public static InstructionSequence parse(java.lang.CharSequence text)
text
- the Type 4 function textprivate InstructionSequence getCurrentSequence()
public void token(java.lang.CharSequence text)
text
- the token textprivate void token(java.lang.String token)
public static int parseInt(java.lang.String token)
token
- the token to be parsedpublic static float parseReal(java.lang.String token)
token
- the token to be parsed