Package org.sonar.sslr.internal.vm
Class Machine
- java.lang.Object
-
- org.sonar.sslr.internal.vm.Machine
-
- All Implemented Interfaces:
CharSequence
public class Machine extends Object implements CharSequence
Duplicates corresponding class from SSLR to improve:- Performance in case of parsing list of tokens multiple times, but with different starting positions. Hot spot for original class in such case - is a conversion from list to array.
- Error reporting (see COBOL-873, COBOL-435).
-
-
Constructor Summary
Constructors Constructor Description Machine(String input, Instruction[] instructions, MachineHandler handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advanceIndex(int offset)
void
backtrack()
char
charAt(int offset)
void
createLeafNode(Matcher matcher, int offset)
void
createNode()
int
getAddress()
int
getIndex()
void
jump(int offset)
int
length()
static ParsingResult
parse(char[] input, CompiledGrammar grammar)
static ParseNode
parse(List<Token> tokens, CompiledGrammar grammar)
MachineStack
peek()
void
pop()
void
popReturn()
void
pushBacktrack(int offset)
void
pushReturn(int returnOffset, Matcher matcher, int callOffset)
void
setAddress(int address)
void
setIgnoreErrors(boolean ignoreErrors)
void
setIndex(int index)
CharSequence
subSequence(int start, int end)
Not supported.Token
tokenAt(int offset)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints, toString
-
-
-
-
Constructor Detail
-
Machine
public Machine(String input, Instruction[] instructions, MachineHandler handler)
-
-
Method Detail
-
parse
public static ParseNode parse(List<Token> tokens, CompiledGrammar grammar)
-
parse
public static ParsingResult parse(char[] input, CompiledGrammar grammar)
-
getAddress
public int getAddress()
-
setAddress
public void setAddress(int address)
-
jump
public void jump(int offset)
-
popReturn
public void popReturn()
-
pushReturn
public void pushReturn(int returnOffset, Matcher matcher, int callOffset)
-
pushBacktrack
public void pushBacktrack(int offset)
-
pop
public void pop()
-
peek
public MachineStack peek()
-
setIgnoreErrors
public void setIgnoreErrors(boolean ignoreErrors)
-
backtrack
public void backtrack()
-
createNode
public void createNode()
-
createLeafNode
public void createLeafNode(Matcher matcher, int offset)
-
getIndex
public int getIndex()
-
setIndex
public void setIndex(int index)
-
advanceIndex
public void advanceIndex(int offset)
-
length
public int length()
- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int offset)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
Not supported.- Specified by:
subSequence
in interfaceCharSequence
- Throws:
UnsupportedOperationException
- always
-
tokenAt
public Token tokenAt(int offset)
-
-