Class TREXGrammar

All Implemented Interfaces:
Grammar, Serializable
Direct Known Subclasses:
RELAXNGGrammar

public class TREXGrammar extends ReferenceExp implements Grammar
TREX grammar, which is expressed as <grammar> element.

The exp field keeps the start pattern.

Author:
Kohsuke KAWAGUCHI
See Also:
  • Field Details

    • namedPatterns

      public final TREXGrammar.RefContainer namedPatterns
      named patterns which are defined by using <define> element. this is a map from pattern name to RefPattern object
    • pool

      public final ExpressionPool pool
      ExpressionPool that is associated with this grammar
    • parentGrammar

      protected final TREXGrammar parentGrammar
      in case of nested grammar, this variable points to the parent grammar. Otherwise null.
    • dataTypes

      public final DataTypeVocabularyMap dataTypes
      data type vocabularies used and defined by this grammar.
  • Constructor Details

    • TREXGrammar

      public TREXGrammar(ExpressionPool pool, TREXGrammar parentGrammar)
      Parameters:
      parentGrammar - this object is used to resolve <ref> element with parent attribute.
    • TREXGrammar

      public TREXGrammar(ExpressionPool pool)
    • TREXGrammar

      public TREXGrammar()
  • Method Details

    • getTopLevel

      public Expression getTopLevel()
      gets the start pattern. The pattern defined under <start> element. This pattern will be used to verify document element.
      Specified by:
      getTopLevel in interface Grammar
    • getPool

      public ExpressionPool getPool()
      Description copied from interface: Grammar
      gets ExpressionPool object which was used to construct this grammar. Never return null.
      Specified by:
      getPool in interface Grammar
    • getParentGrammar

      public final TREXGrammar getParentGrammar()
      gets a parent TREXGrammar. In case of nested grammar, the parent grammar will be returned. Otherwise, it returns null.