Class Token
java.lang.Object
cruise.umple.parser.Token
Fundamental to all parsing, used in conjunction with rules and their definitions.
As parsing is taking place these will indicate what is currently being looked for
(such as a class definition or attribute) and helps to keep
track of the positions that the input parser parsed things at.
Copyright: All contributers to the Umple Project
This file is made available subject to the open source license found at:
https://umple.org/license
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddOrMoveSubTokenAt(Token aSubToken, int index) voidaddSubToken(int index, Token aSubToken) booleanaddSubToken(Token aSubToken) booleanaddSubTokenAt(Token aSubToken, int index) copy()voiddelete()Return a copy of the current token with all its SubTokens Removes all SubTokens from the current Token and sets new name and valuevoidflatten()Set name to flattened string of all child sub-tokens and remove themvoidflattenNameRecursive(String tokenName) Recursively flattens a particular token name from bottom upflattenValues(StringBuffer stringSoFar) Return string buffer with flattened value of tokensintintgetIntValue(String tokenName) intgetIntValue(String tokenName, int defaultIfInvalid) intgetName()The name of the token.getPosition(String tokenName) getSubToken(int index) getSubToken(String tokenName) getSubToken(String tokenName, int offset) getValue()The value of the token.Get the value of the named subtokenbooleanbooleanbooleanbooleanintindexOfSubToken(Token aSubToken) booleanbooleanisStatic()booleanstatic booleanisValidIdentifier(String identifier) static booleanisValidIdentifier(String identifier, String prefix) booleanstatic intintvoidremove(int index) booleanremoveSubToken(Token aSubToken) booleanremoveSubTokenNotSetParentToken(Token aSubToken) for issue#1521booleansetEndPosition(Position aNewEndPosition) booleanbooleansetParentToken(Token aParentToken) booleansetPosition(Position aNewPosition) booleantoString()toString(StringBuffer stringSoFar, Token parserRoot) Code refactored from Parser class to Token class
-
Constructor Details
-
Token
-
Token
-
-
Method Details
-
setName
-
setValue
-
getName
The name of the token. -
getValue
The value of the token. -
getSubToken
-
getSubTokens
-
numberOfSubTokens
public int numberOfSubTokens() -
hasSubTokens
public boolean hasSubTokens() -
indexOfSubToken
-
getPosition
-
hasPosition
public boolean hasPosition() -
getEndPosition
-
hasEndPosition
public boolean hasEndPosition() -
getParentToken
-
hasParentToken
public boolean hasParentToken() -
minimumNumberOfSubTokens
public static int minimumNumberOfSubTokens() -
addSubToken
-
removeSubToken
-
addSubTokenAt
-
addOrMoveSubTokenAt
-
setPosition
-
setEndPosition
-
setParentToken
-
delete
public void delete() -
isValidIdentifier
-
isValidIdentifier
-
addSubToken
-
getPosition
-
getInnerLength
public int getInnerLength() -
getLength
public int getLength() -
getIntValue
-
getIntValue
-
getSubToken
-
getSubToken
-
getValue
-
is
-
isStatic
-
isStatic
public boolean isStatic() -
isValue
-
remove
public void remove(int index) -
toString
-
toString
Code refactored from Parser class to Token class -
flatten
public void flatten()Set name to flattened string of all child sub-tokens and remove them -
flattenValues
Return string buffer with flattened value of tokens -
flattenNameRecursive
Recursively flattens a particular token name from bottom up -
detach
-
copy
-
removeSubTokenNotSetParentToken
for issue#1521
-