Package one.empty3.library1.tree
Class StringAnalyzer3.Token
java.lang.Object
one.empty3.library1.tree.StringAnalyzer3.Token
- Direct Known Subclasses:
StringAnalyzer3.MultiToken
,StringAnalyzer3.SingleToken
,StringAnalyzer3.TokenAttribute
,StringAnalyzer3.TokenLogicalExpression
,StringAnalyzer3.TokenLogicalExpression1
,StringAnalyzerJava1.MultiTokenSequence
,StringAnalyzerJava1.TokenArrayAccessor
,StringAnalyzerJava1.TokenConstructor
,StringAnalyzerJava1.TokenConstructorArray
,StringAnalyzerJava1.TokenConstructorCall
,StringAnalyzerJava1.TokenExpression2
,StringAnalyzerJava1.TokenMethodCall
,StringAnalyzerJava1.TokenNameDeclaration2
,StringAnalyzerJava1.TokenTypeArrayOrNot
,StringAnalyzerJava2.MultiTokenSequence
,StringAnalyzerJava2.TokenArrayAccessor
,StringAnalyzerJava2.TokenConstructor
,StringAnalyzerJava2.TokenConstructorArray
,StringAnalyzerJava2.TokenConstructorCall
,StringAnalyzerJava2.TokenExpression2
,StringAnalyzerJava2.TokenMethodCall
,StringAnalyzerJava2.TokenNameDeclaration2
,StringAnalyzerJava2.TokenTypeArrayOrNot
- Enclosing class:
StringAnalyzer3
Represents a token in a parsing process.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
action()
Executes the action associated with the token, if it is not null.addToken
(StringAnalyzer3.Token token) copy
(StringAnalyzer3.Token token0) Creates a copy of the current Token object.void
fireOnTrue
(boolean fire) Retrieves the action associated with the token.protected boolean
protected boolean
Determines whether the current operation was successful or not.int
Parses the input string starting from the given position and skips over any blank spaces.protected int
processNext
(String input, int position) Processes the next token in the input string starting from the given position.void
void
setSuccessful
(boolean successful) Sets the success state of the current operation.int
skipBlanks
(String input, int position) Skips over any blank spaces in the input string starting from the given position.toString()
-
Field Details
-
fire
protected boolean fire -
action
-
aClass
-
method
-
variable
-
-
Constructor Details
-
Token
public Token()
-
-
Method Details
-
addToken
-
setAction
-
fireOnTrue
public void fireOnTrue(boolean fire) -
skipBlanks
Skips over any blank spaces in the input string starting from the given position.- Parameters:
input
- the input stringposition
- the starting position- Returns:
- the new position after skipping the blank spaces
-
parse
Parses the input string starting from the given position and skips over any blank spaces.- Parameters:
input
- the input stringposition
- the starting position- Returns:
- the new position after skipping the blank spaces
-
isSuccessful
protected boolean isSuccessful()Determines whether the current operation was successful or not.- Returns:
- true if the operation was successful, false otherwise
-
setSuccessful
public void setSuccessful(boolean successful) Sets the success state of the current operation.- Parameters:
successful
- the flag indicating whether the operation was successful
-
getAction3
Retrieves the action associated with the token.- Returns:
- the action associated with the token
-
action
public void action()Executes the action associated with the token, if it is not null. -
processNext
Processes the next token in the input string starting from the given position.- Parameters:
input
- the input stringposition
- the starting position- Returns:
- the new position after processing the next token
-
toString
-
getNextToken
-
hasNextToken
protected boolean hasNextToken() -
copy
Creates a copy of the current Token object.- Returns:
- a new Token object that is a copy of the current Token (further step: make a deep copy with nextTokens and Token type fields.
-
getConstruct
-
setConstruct
-
getFirstConstructVersion
-