Class Symbol

java.lang.Object
org.apache.avro.io.parsing.Symbol
Direct Known Subclasses:
Symbol.Alternative, Symbol.ImplicitAction, Symbol.IntCheckAction, Symbol.Repeater, Symbol.Root, Symbol.Sequence

public abstract class Symbol extends Object
Symbol is the base of all symbols (terminals and non-terminals) of the grammar.
  • Field Details

    • kind

      public final Symbol.Kind kind
    • production

      public final Symbol[] production
      The production for this symbol. If this symbol is a terminal this is null. Otherwise this holds the the sequence of the symbols that forms the production for this symbol. The sequence is in the reverse order of production. This is useful for easy copying onto parsing stack. Please note that this is a final. So the production for a symbol should be known before that symbol is constructed. This requirement cannot be met for those symbols which are recursive (e.g. a record that holds union a branch of which is the record itself). To resolve this problem, we initialize the symbol with an array of nulls. Later we fill the symbols. Not clean, but works. The other option is to not have this field a final. But keeping it final and thus keeping symbol immutable gives some comfort. See various generators how we generate records.
    • NULL

      public static final Symbol NULL
      The terminal symbols for the grammar.
    • BOOLEAN

      public static final Symbol BOOLEAN
    • INT

      public static final Symbol INT
    • LONG

      public static final Symbol LONG
    • FLOAT

      public static final Symbol FLOAT
    • DOUBLE

      public static final Symbol DOUBLE
    • STRING

      public static final Symbol STRING
    • BYTES

      public static final Symbol BYTES
    • FIXED

      public static final Symbol FIXED
    • ENUM

      public static final Symbol ENUM
    • UNION

      public static final Symbol UNION
    • ARRAY_START

      public static final Symbol ARRAY_START
    • ARRAY_END

      public static final Symbol ARRAY_END
    • MAP_START

      public static final Symbol MAP_START
    • MAP_END

      public static final Symbol MAP_END
    • ITEM_END

      public static final Symbol ITEM_END
    • WRITER_UNION_ACTION

      public static final Symbol WRITER_UNION_ACTION
    • FIELD_ACTION

      public static final Symbol FIELD_ACTION
    • RECORD_START

      public static final Symbol RECORD_START
    • RECORD_END

      public static final Symbol RECORD_END
    • UNION_END

      public static final Symbol UNION_END
    • FIELD_END

      public static final Symbol FIELD_END
    • DEFAULT_END_ACTION

      public static final Symbol DEFAULT_END_ACTION
    • MAP_KEY_MARKER

      public static final Symbol MAP_KEY_MARKER
  • Constructor Details

    • Symbol

      protected Symbol(Symbol.Kind kind)
      Constructs a new symbol of the given kind kind.
    • Symbol

      protected Symbol(Symbol.Kind kind, Symbol[] production)
  • Method Details