Avro C#
Classes | Public Member Functions | Protected Attributes | List of all members
Avro.IO.Parsing.Parser Class Reference

Parser is the class that maintains the stack for parsing. This class is used by encoders, which are not required to skip. More...

Inheritance diagram for Avro.IO.Parsing.Parser:
Avro.IO.Parsing.SkipParser

Classes

interface  IActionHandler
 The parser knows how to handle the terminal and non-terminal symbols. But it needs help from outside to handle implicit and explicit actions. The clients implement this interface to provide this help. More...
 

Public Member Functions

 Parser (Symbol root, IActionHandler symbolHandler)
 Initializes a new instance of the Parser class. More...
 
Symbol Advance (Symbol input)
 Recursively replaces the symbol at the top of the stack with its production, until the top is a terminal. Then checks if the top symbol matches the terminal symbol supplied input. More...
 
void ProcessImplicitActions ()
 Performs any implicit actions at the top the stack, expanding any production (other than the root) that may be encountered. This method will fail if there are any repeaters on the stack. More...
 
void ProcessTrailingImplicitActions ()
 Performs any "trailing" implicit actions at the top the stack. More...
 
void PushProduction (Symbol sym)
 Pushes the production for the given symbol sym. If sym is a repeater and input is either Symbol.ArrayEnd or Symbol.MapEnd pushes nothing. More...
 
virtual Symbol PopSymbol ()
 Pops and returns the top symbol from the stack. More...
 
virtual Symbol TopSymbol ()
 Returns the top symbol from the stack. More...
 
virtual void PushSymbol (Symbol sym)
 Pushes sym on to the stack. More...
 
virtual int Depth ()
 Returns the depth of the stack. More...
 
virtual void Reset ()
 Resets the stack. More...
 

Protected Attributes

Symbol[] Stack
 Stack of symbols. More...
 
int Pos
 Position of the stack. More...
 

Detailed Description

Parser is the class that maintains the stack for parsing. This class is used by encoders, which are not required to skip.

Constructor & Destructor Documentation

◆ Parser()

Avro.IO.Parsing.Parser.Parser ( Symbol  root,
IActionHandler  symbolHandler 
)
inline

Initializes a new instance of the Parser class.

Member Function Documentation

◆ Advance()

Symbol Avro.IO.Parsing.Parser.Advance ( Symbol  input)
inline

Recursively replaces the symbol at the top of the stack with its production, until the top is a terminal. Then checks if the top symbol matches the terminal symbol supplied input.

Parameters
inputThe symbol to match against the terminal at the top of the stack.
Returns
The terminal symbol at the top of the stack unless an implicit action resulted in another symbol, in which case that symbol is returned.

◆ Depth()

virtual int Avro.IO.Parsing.Parser.Depth ( )
inlinevirtual

Returns the depth of the stack.

◆ PopSymbol()

virtual Symbol Avro.IO.Parsing.Parser.PopSymbol ( )
inlinevirtual

Pops and returns the top symbol from the stack.

◆ ProcessImplicitActions()

void Avro.IO.Parsing.Parser.ProcessImplicitActions ( )
inline

Performs any implicit actions at the top the stack, expanding any production (other than the root) that may be encountered. This method will fail if there are any repeaters on the stack.

◆ ProcessTrailingImplicitActions()

void Avro.IO.Parsing.Parser.ProcessTrailingImplicitActions ( )
inline

Performs any "trailing" implicit actions at the top the stack.

◆ PushProduction()

void Avro.IO.Parsing.Parser.PushProduction ( Symbol  sym)
inline

Pushes the production for the given symbol sym. If sym is a repeater and input is either Symbol.ArrayEnd or Symbol.MapEnd pushes nothing.

Parameters
sym

◆ PushSymbol()

virtual void Avro.IO.Parsing.Parser.PushSymbol ( Symbol  sym)
inlinevirtual

Pushes sym on to the stack.

◆ Reset()

virtual void Avro.IO.Parsing.Parser.Reset ( )
inlinevirtual

Resets the stack.

◆ TopSymbol()

virtual Symbol Avro.IO.Parsing.Parser.TopSymbol ( )
inlinevirtual

Returns the top symbol from the stack.

Member Data Documentation

◆ Pos

int Avro.IO.Parsing.Parser.Pos
protected

Position of the stack.

◆ Stack

Symbol [] Avro.IO.Parsing.Parser.Stack
protected

Stack of symbols.


The documentation for this class was generated from the following file: