Class ExtractConstantValues
- java.lang.Object
-
- io.github.applecommander.bastools.api.optimizations.BaseVisitor
-
- io.github.applecommander.bastools.api.optimizations.ExtractConstantValues
-
- All Implemented Interfaces:
Visitor
public class ExtractConstantValues extends BaseVisitor
Find constants and extract to variables in order to have the number parsed only once.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<ApplesoftKeyword>TARGET_ENDSThese trigger the end of a replacement range.static java.util.List<ApplesoftKeyword>TARGET_STARTSThese trigger the start of a replacement range.-
Fields inherited from class io.github.applecommander.bastools.api.optimizations.BaseVisitor
newProgram, reassignments
-
-
Constructor Summary
Constructors Constructor Description ExtractConstantValues(Configuration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokennullTransformation(Token token)TokennumberToIdentTransformation(Token token)Collect a map of constant values and the new variable name to be used.Programvisit(Program program)Statementvisit(Statement statement)Tokenvisit(Token token)-
Methods inherited from class io.github.applecommander.bastools.api.optimizations.BaseVisitor
visit
-
-
-
-
Field Detail
-
TARGET_STARTS
public static java.util.List<ApplesoftKeyword> TARGET_STARTS
These trigger the start of a replacement range. Note the special logic for assignments.
-
TARGET_ENDS
public static java.util.List<ApplesoftKeyword> TARGET_ENDS
These trigger the end of a replacement range. End of statement is always an end.
-
-
Constructor Detail
-
ExtractConstantValues
public ExtractConstantValues(Configuration config)
-
-
Method Detail
-
numberToIdentTransformation
public Token numberToIdentTransformation(Token token)
Collect a map of constant values and the new variable name to be used.
-
visit
public Program visit(Program program)
- Specified by:
visitin interfaceVisitor- Overrides:
visitin classBaseVisitor
-
visit
public Statement visit(Statement statement)
- Specified by:
visitin interfaceVisitor- Overrides:
visitin classBaseVisitor
-
-