Package org.sentrysoftware.jawk.frontend
Class AwkParser
java.lang.Object
org.sentrysoftware.jawk.frontend.AwkParser
Converts the AWK script into a syntax tree,
which is useful the backend that either compiles or interprets the script.
It contains the internal state of the parser and the lexer.
- Author:
- Danny Daglas
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Exception indicating a syntax problem in the AWK scriptclass
-
Constructor Summary
ConstructorDescriptionAwkParser
(boolean additional_functions, boolean additional_type_functions, Map<String, JawkExtension> extensions) Constructor for AwkParser. -
Method Summary
Modifier and TypeMethodDescriptionparse
(List<ScriptSource> scriptSources) Parse the script streamed by script_reader.void
Adds {var_name -> offset} mappings to the tuples so that global variables can be set by the interpreter while processing filename and name=value entries from the command-line.
-
Constructor Details
-
AwkParser
public AwkParser(boolean additional_functions, boolean additional_type_functions, Map<String, JawkExtension> extensions) Constructor for AwkParser.
- Parameters:
additional_functions
- a booleanadditional_type_functions
- a booleanextensions
- aMap
object
-
-
Method Details
-
parse
Parse the script streamed by script_reader. Build and return the root of the abstract syntax tree which represents the Jawk script.- Parameters:
scriptSources
- List of script sources- Returns:
- The abstract syntax tree of this script.
- Throws:
IOException
- upon an IO error.
-
populateGlobalVariableNameToOffsetMappings
Adds {var_name -> offset} mappings to the tuples so that global variables can be set by the interpreter while processing filename and name=value entries from the command-line. Also sends function names to the tuples, to provide the back end with names to invalidate if name=value assignments are passed in via the -v or ARGV arguments.- Parameters:
tuples
- The tuples to add the mapping to.
-