org.jawk.frontend
Class AwkParser
java.lang.Object
org.jawk.frontend.AwkParser
public class AwkParser
- extends java.lang.Object
AwkParser - converts the AWK script into a syntax tree
useful to either backend that compiles the script or interprets
the script.
It contains the internal state of the parser and the lexer.
Constructor Summary |
AwkParser(boolean additional_functions,
boolean additional_type_functions,
boolean no_input,
java.util.Map<java.lang.String,JawkExtension> extensions)
|
Method Summary |
AwkSyntaxTree |
parse(java.io.Reader script_reader)
Parse the script streamed by script_reader. |
void |
populateGlobalVariableNameToOffsetMappings(AwkTuples tuples)
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AwkParser
public AwkParser(boolean additional_functions,
boolean additional_type_functions,
boolean no_input,
java.util.Map<java.lang.String,JawkExtension> extensions)
parse
public AwkSyntaxTree parse(java.io.Reader script_reader)
throws java.io.IOException
- Parse the script streamed by script_reader. Build and return the
root of the abstract syntax tree which represents the Jawk script.
- Parameters:
script_reader
- The Reader streaming the script to parse.
- Returns:
- The abstract syntax tree of this script.
- Throws:
java.io.IOException
- upon an IO error.
populateGlobalVariableNameToOffsetMappings
public void populateGlobalVariableNameToOffsetMappings(AwkTuples tuples)
- 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.