Class AwkParser

java.lang.Object
org.sentrysoftware.jawk.frontend.AwkParser

public class AwkParser extends Object
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
  • Constructor Details

    • AwkParser

      public AwkParser(boolean additional_functions, boolean additional_type_functions, Map<String,JawkExtension> extensions)

      Constructor for AwkParser.

      Parameters:
      additional_functions - a boolean
      additional_type_functions - a boolean
      extensions - a Map object
  • Method Details

    • parse

      public AwkSyntaxTree parse(List<ScriptSource> scriptSources) throws IOException
      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

      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.