Record Class Earley.Result

java.lang.Object
java.lang.Record
org.libxmq.imp.ixml.earley.Earley.Result
Record Components:
doc - the document, null on an error
error - the error message, null on success
position - the input position (in code points) of a syntax error
grammar - the grammar
chart - the Earley sets, null if the input is not valid UTF-8
tree - the chosen tree, null if the input was rejected
steps - the nodes in the order they were added to the tree, see TreeBuilder.steps
expected - on a syntax error, what the parser could read at the position
Enclosing class:
Earley

public static record Earley.Result(XmlDocument doc, String error, int position, Grammar grammar, Chart chart, Tree tree, List<TreeBuilder.Step> steps, List<EarleyParser.Expected> expected) extends Record
The result of a parse: a document, or an error at a position. The grammar, the chart and the tree are kept for EarleyTrace.
  • Constructor Details

    • Result

      public Result(XmlDocument doc, String error, int position, Grammar grammar, Chart chart, Tree tree, List<TreeBuilder.Step> steps, List<EarleyParser.Expected> expected)
      Creates an instance of a Result record class.
      Parameters:
      doc - the value for the doc record component
      error - the value for the error record component
      position - the value for the position record component
      grammar - the value for the grammar record component
      chart - the value for the chart record component
      tree - the value for the tree record component
      steps - the value for the steps record component
      expected - the value for the expected record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • doc

      public XmlDocument doc()
      Returns the value of the doc record component.
      Returns:
      the value of the doc record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • position

      public int position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • grammar

      public Grammar grammar()
      Returns the value of the grammar record component.
      Returns:
      the value of the grammar record component
    • chart

      public Chart chart()
      Returns the value of the chart record component.
      Returns:
      the value of the chart record component
    • tree

      public Tree tree()
      Returns the value of the tree record component.
      Returns:
      the value of the tree record component
    • steps

      public List<TreeBuilder.Step> steps()
      Returns the value of the steps record component.
      Returns:
      the value of the steps record component
    • expected

      public List<EarleyParser.Expected> expected()
      Returns the value of the expected record component.
      Returns:
      the value of the expected record component