Class IXMLGrammar

java.lang.Object
org.libxmq.imp.ixml.IXMLGrammar

public final class IXMLGrammar extends Object
Grammar reader ported from ixml.c; independent of the YAEP backend. The rules and terms are public for the Earley parser in the earley package.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A rule, name = alternatives.
    static final class 
    A term: a call of a rule (ref), a character set (chars), an insertion or a not.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The code point after the last unicode code point, used for end of input.
    The rules, in grammar order, followed by the generated rules /1, /2, ...
    The name of the start rule, the first rule of the grammar.
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String source)
    Read a grammar using the parse_ixml_* productions from the C reader.
    static String
    quote(int cp)
    A code point as written in an ixml grammar: 'a', "'" for the single quote, or #a for a control character or space, like the C version.
    The grammar source.

    Methods inherited from class Object

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

    • EOF

      public static final int EOF
      The code point after the last unicode code point, used for end of input.
      See Also:
    • rules

      public final Map<String, IXMLGrammar.Rule> rules
      The rules, in grammar order, followed by the generated rules /1, /2, ...
    • start

      public String start
      The name of the start rule, the first rule of the grammar.
  • Method Details

    • source

      public String source()
      The grammar source.
      Returns:
      the ixml source the grammar was read from
    • quote

      public static String quote(int cp)
      A code point as written in an ixml grammar: 'a', "'" for the single quote, or #a for a control character or space, like the C version.
      Parameters:
      cp - the code point
      Returns:
      the text
    • parse

      public static IXMLGrammar parse(String source)
      Read a grammar using the parse_ixml_* productions from the C reader.
      Parameters:
      source - iXML source
      Returns:
      normalized grammar