Class Chart

java.lang.Object
org.libxmq.imp.ixml.earley.Chart

public final class Chart extends Object
The result of the Earley recognizer: one Earley set for each input position, from 0 (before the first code point) to n (after the last). The input is read from its UTF-8 bytes, it is never turned into a String or an array of code points. The chart is built by a single scan of the bytes, like scan_content_fixup_charsets in the C version (see doc/parse_ixml_fast.md): every code point is decoded, gets its token (Tokens) and the set of its position remembers the token. The code points that the grammar has not seen in an input before are then added to the token sets of the charsets that contain them (Grammar.addUsed).
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    The input is not valid UTF-8.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The sets, sets.get(k) is the set at position k.
    final Tokens
    The tokens of the grammar, to find the code point of a token.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    codepoint(int k)
    The code point at position k.
    int
    The number of code points in the input.
    set(int k)
    The set at position k.
    int
    token(int k)
    The token at position k.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • tokens

      public final Tokens tokens
      The tokens of the grammar, to find the code point of a token.
    • sets

      public final List<EarleySet> sets
      The sets, sets.get(k) is the set at position k.
  • Method Details

    • set

      public EarleySet set(int k)
      The set at position k.
      Parameters:
      k - the input position, 0 to length()
      Returns:
      the set
    • token

      public int token(int k)
      The token at position k.
      Parameters:
      k - the input position, 0 to length()-1
      Returns:
      the token
    • codepoint

      public int codepoint(int k)
      The code point at position k.
      Parameters:
      k - the input position, 0 to length()-1
      Returns:
      the code point
    • length

      public int length()
      The number of code points in the input.
      Returns:
      the input length