Record Class Grammar.Chars

java.lang.Object
java.lang.Record
org.libxmq.imp.ixml.earley.Grammar.Chars
Record Components:
set - the code points matched
hidden - true if the terminal is hidden
text - how the terminal is written in the grammar, eg 'a' or ['a'-'z'; #a]
tokens - the tokens matched (see Tokens), one bit per token: the token of a literal, or for a charset the tokens of the code points in set that have been seen in the inputs so far. Shared by the terminals with the same set.
All Implemented Interfaces:
Grammar.Symbol
Enclosing class:
Grammar

public static record Grammar.Chars(BitSet set, boolean hidden, String text, BitSet tokens) extends Record implements Grammar.Symbol
A terminal: one code point from a set. A hidden terminal, -'x', is not output.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Chars(BitSet set, boolean hidden, String text, BitSet tokens)
    Creates an instance of a Chars record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the hidden record component.
    boolean
    matches(int codepoint)
    Returns true if the code point is in the set.
    boolean
    matchesToken(int token)
    Returns true if the token is matched.
    set()
    Returns the value of the set record component.
    Returns the value of the text record component.
    Returns the value of the tokens record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Grammar.Symbol

    isZeroWidth
    Modifier and Type
    Method
    Description
    default boolean
    Returns true if the symbol matches nothing: the parser steps over it.
  • Constructor Details

    • Chars

      public Chars(BitSet set, boolean hidden, String text, BitSet tokens)
      Creates an instance of a Chars record class.
      Parameters:
      set - the value for the set record component
      hidden - the value for the hidden record component
      text - the value for the text record component
      tokens - the value for the tokens record component
  • Method Details

    • matches

      public boolean matches(int codepoint)
      Returns true if the code point is in the set.
      Parameters:
      codepoint - the code point
      Returns:
      true on a match
    • matchesToken

      public boolean matchesToken(int token)
      Returns true if the token is matched.
      Parameters:
      token - the token
      Returns:
      true on a match
    • 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.
    • set

      public BitSet set()
      Returns the value of the set record component.
      Returns:
      the value of the set record component
    • hidden

      public boolean hidden()
      Returns the value of the hidden record component.
      Returns:
      the value of the hidden record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • tokens

      public BitSet tokens()
      Returns the value of the tokens record component.
      Returns:
      the value of the tokens record component