Class SymbolNode
- java.lang.Object
-
- org.pipservices3.expressions.tokenizers.generic.SymbolNode
-
- Direct Known Subclasses:
SymbolRootNode
public class SymbolNode extends Object
-
-
Constructor Summary
Constructors Constructor Description SymbolNode(SymbolNode parent, int character)Constructs a SymbolNode with the given parent, representing the given character.
-
Method Summary
Modifier and Type Method Description voidaddDescendantLine(String value, TokenType tokenType)Add a line of descendants that represent the characters in the given string.Stringancestry()Show the symbol this node represents.SymbolNodedeepestRead(IScanner scanner)Find the descendant that takes as many characters as possible from the input.SymbolNodeensureChildWithChar(int value)Find or create a child for the given character.SymbolNodefindChildWithChar(int value)Find a child with the given character.TokenTypegetTokenType()booleangetValid()voidsetTokenType(TokenType value)voidsetValid(boolean value)SymbolNodeunreadToValid(IScanner scanner)Unwind to a valid node; this node is "valid" if its ancestry represents a complete symbol.
-
-
-
Constructor Detail
-
SymbolNode
public SymbolNode(SymbolNode parent, int character)
Constructs a SymbolNode with the given parent, representing the given character.- Parameters:
parent- This node's parentcharacter- This node's associated character.
-
-
Method Detail
-
ensureChildWithChar
public SymbolNode ensureChildWithChar(int value) throws Exception
Find or create a child for the given character.- Parameters:
value-- Throws:
Exception
-
addDescendantLine
public void addDescendantLine(String value, TokenType tokenType) throws Exception
Add a line of descendants that represent the characters in the given string.- Parameters:
value-tokenType-- Throws:
Exception
-
deepestRead
public SymbolNode deepestRead(IScanner scanner)
Find the descendant that takes as many characters as possible from the input.- Parameters:
scanner-
-
findChildWithChar
public SymbolNode findChildWithChar(int value)
Find a child with the given character.- Parameters:
value-
-
unreadToValid
public SymbolNode unreadToValid(IScanner scanner)
Unwind to a valid node; this node is "valid" if its ancestry represents a complete symbol. If this node is not valid, put back the character and ask the parent to unwind.- Parameters:
scanner-
-
getValid
public boolean getValid()
-
setValid
public void setValid(boolean value)
-
getTokenType
public TokenType getTokenType()
-
setTokenType
public void setTokenType(TokenType value)
-
ancestry
public String ancestry()
Show the symbol this node represents.- Returns:
- The symbol this node represents.
-
-