Package org.apache.avro.io.parsing
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
Symbol is the base of all symbols (terminals and non-terminals) of the
grammar.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static final class
static class
static class
static enum
static class
static class
protected static class
protected static class
static class
static class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
final Symbol.Kind
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
The terminal symbols for the grammar.final Symbol[]
The production for this symbol.static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
static final Symbol
-
Constructor Summary
ModifierConstructorDescriptionprotected
Symbol
(Symbol.Kind kind) Constructs a new symbol of the given kind kind.protected
Symbol
(Symbol.Kind kind, Symbol[] production) -
Method Summary
Modifier and TypeMethodDescriptionstatic Symbol.DefaultStartAction
defaultStartAction
(byte[] contents) static Symbol.EnumAdjustAction
enumAdjustAction
(int rsymCount, Object[] adj) static Symbol.EnumLabelsAction
enumLabelsAction
(List<String> symbols) For JSON.static Symbol.FieldAdjustAction
fieldAdjustAction
(int rindex, String fname, Set<String> aliases) static Symbol.FieldOrderAction
fieldOrderAction
(Schema.Field[] fields) flatten
(Map<Symbol.Sequence, Symbol.Sequence> map, Map<Symbol.Sequence, List<org.apache.avro.io.parsing.Symbol.Fixup>> map2) int
protected static int
flattenedSize
(Symbol[] symbols, int start) Returns the amount of space required to flatten the given sub-array of symbols.static boolean
Returns true if the Parser contains any Error symbol, indicating that it may fail for some inputs.static Symbol.IntCheckAction
intCheckAction
(int size) static Symbol.SkipAction
skipAction
(Symbol symToSkip) static Symbol.UnionAdjustAction
unionAdjustAction
(int rindex, Symbol sym) static Symbol.WriterUnionAction
-
Field Details
-
kind
-
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
The terminal symbols for the grammar. -
BOOLEAN
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
STRING
-
BYTES
-
FIXED
-
ENUM
-
UNION
-
ARRAY_START
-
ARRAY_END
-
MAP_START
-
MAP_END
-
ITEM_END
-
WRITER_UNION_ACTION
-
FIELD_ACTION
-
RECORD_START
-
RECORD_END
-
UNION_END
-
FIELD_END
-
DEFAULT_END_ACTION
-
MAP_KEY_MARKER
-
-
Constructor Details
-
Symbol
Constructs a new symbol of the given kind kind. -
Symbol
-
-
Method Details
-
flatten
public Symbol flatten(Map<Symbol.Sequence, Symbol.Sequence> map, Map<Symbol.Sequence, List<org.apache.avro.io.parsing.Symbol.Fixup>> map2) -
flattenedSize
public int flattenedSize() -
flattenedSize
Returns the amount of space required to flatten the given sub-array of symbols.- Parameters:
symbols
- The array of input symbols.start
- The index where the subarray starts.- Returns:
- The number of symbols that will be produced if one expands the given input.
-
hasErrors
Returns true if the Parser contains any Error symbol, indicating that it may fail for some inputs. -
intCheckAction
-
enumAdjustAction
-
writerUnionAction
-
skipAction
-
fieldAdjustAction
public static Symbol.FieldAdjustAction fieldAdjustAction(int rindex, String fname, Set<String> aliases) -
fieldOrderAction
-
defaultStartAction
-
unionAdjustAction
-
enumLabelsAction
For JSON.
-