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 voidadvanceIndex(int offset)voidbacktrack()charcharAt(int offset)voidcreateLeafNode(Matcher matcher, int offset)voidcreateNode()intgetAddress()intgetIndex()voidjump(int offset)intlength()static ParsingResultparse(char[] input, CompiledGrammar grammar)static ParseNodeparse(List<Token> tokens, CompiledGrammar grammar)MachineStackpeek()voidpop()voidpopReturn()voidpushBacktrack(int offset)voidpushReturn(int returnOffset, Matcher matcher, int callOffset)voidsetAddress(int address)voidsetIgnoreErrors(boolean ignoreErrors)voidsetIndex(int index)CharSequencesubSequence(int start, int end)Not supported.TokentokenAt(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:
lengthin interfaceCharSequence
-
charAt
public char charAt(int offset)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
Not supported.- Specified by:
subSequencein interfaceCharSequence- Throws:
UnsupportedOperationException- always
-
tokenAt
public Token tokenAt(int offset)
-
-