Package com.scriptbasic.syntax.commands
Class AbstractCommandAnalyzer
java.lang.Object
com.scriptbasic.syntax.AbstractAnalyzer<Command>
com.scriptbasic.syntax.commands.AbstractCommandAnalyzer
- All Implemented Interfaces:
Analyzer<Command>,CommandAnalyzer
- Direct Known Subclasses:
AbstractCommandAnalyzerGlobalLocal,AbstractCommandAnalyzerIfElseKind,CommandAnalyzerCall,CommandAnalyzerCase,CommandAnalyzerDSL,CommandAnalyzerEnd,CommandAnalyzerEndSub,CommandAnalyzerFor,CommandAnalyzerLet,CommandAnalyzerMethod,CommandAnalyzerNext,CommandAnalyzerPrint,CommandAnalyzerReturn,CommandAnalyzerSelect,CommandAnalyzerSub,CommandAnalyzerUse,CommandAnalyzerWend,CommandAnalyzerWhile
public abstract class AbstractCommandAnalyzer
extends AbstractAnalyzer<Command>
implements CommandAnalyzer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Expressionprotected ExpressionListprotected LeftValueprotected LeftValueListprotected voidassertKeyWord(String keyword) Ensures that the appropriate keyword is on the line.protected voidChecks that there are no extra characters when the line analyzer expects it has finished analyzing the statement.protected static booleanCheck that the left values are simple (no modifiers, a.k.a.protected StringgetName()protected booleanprotected voidpushNode(NestedStructure node)
-
Field Details
-
ctx
-
-
Constructor Details
-
AbstractCommandAnalyzer
-
-
Method Details
-
equal
Check that the left values are simple (no modifiers, a.k.a. simply variables) and are the same variables (have the same name).- Parameters:
a- variable oneb- variable two- Returns:
trueif the variables have the same name and none of them has modifiers (array access or field access)
-
getName
-
analyzeSimpleLeftValueList
- Throws:
AnalysisException
-
analyzeSimpleLeftValue
- Throws:
AnalysisException
-
analyzeExpression
- Throws:
AnalysisException
-
analyzeExpressionList
- Throws:
AnalysisException
-
pushNode
-
assertKeyWord
Ensures that the appropriate keyword is on the line. Also it eats up that keyword.- Parameters:
keyword- the keyword that has to be present on the line- Throws:
AnalysisException- when the next lexeme is NOT the expected keyword.
-
isKeyWord
- Throws:
AnalysisException
-
consumeEndOfStatement
Checks that there are no extra characters when the line analyzer expects it has finished analyzing the statement. If there are some extra characters on the line then throws syntax error exception. Otherwise it simply steps the lexical analyzer iterator over the symbol.- Throws:
AnalysisException- when there are extra character on the actual line
-