Search Results for

    Show / Hide Table of Contents

    Class ShiftReduceParser<TValue, TSpan>

    Abstract class for GPPG shift-reduce parsers. Parsers generated by GPPG derive from this base class, overriding the abstract Initialize() and DoAction() methods.

    Inheritance
    System.Object
    ShiftReduceParser<TValue, TSpan>
    P21Parser
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: QUT.Gppg
    Assembly: Xbim.Common.dll
    Syntax
    public abstract class ShiftReduceParser<TValue, TSpan>
        where TSpan : IMerge<TSpan>, new()
    Type Parameters
    Name Description
    TValue

    Semantic value type

    TSpan

    Location type

    Constructors

    | Improve this Doc View Source

    ShiftReduceParser(AbstractScanner<TValue, TSpan>)

    Constructor for base class

    Declaration
    protected ShiftReduceParser(AbstractScanner<TValue, TSpan> scanner)
    Parameters
    Type Name Description
    AbstractScanner<TValue, TSpan> scanner

    Scanner instance for this parser

    Fields

    | Improve this Doc View Source

    CurrentLocationSpan

    The current value of the "@$" symbolic variable in the parser

    Declaration
    protected TSpan CurrentLocationSpan
    Field Value
    Type Description
    TSpan
    | Improve this Doc View Source

    CurrentSemanticValue

    The current value of the "$$" symbolic variable in the parser

    Declaration
    protected TValue CurrentSemanticValue
    Field Value
    Type Description
    TValue
    | Improve this Doc View Source

    NextToken

    Declaration
    protected int NextToken
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    LocationStack

    The stack of location value (YYLTYPE) values.

    Declaration
    protected PushdownPrefixState<TSpan> LocationStack { get; }
    Property Value
    Type Description
    PushdownPrefixState<TSpan>
    | Improve this Doc View Source

    Scanner

    The abstract scanner for this parser.

    Declaration
    protected AbstractScanner<TValue, TSpan> Scanner { get; set; }
    Property Value
    Type Description
    AbstractScanner<TValue, TSpan>
    | Improve this Doc View Source

    ValueStack

    The stack of semantic value (YYSTYPE) values.

    Declaration
    protected PushdownPrefixState<TValue> ValueStack { get; }
    Property Value
    Type Description
    PushdownPrefixState<TValue>
    | Improve this Doc View Source

    YYRecovering

    Check if parser in error recovery state.

    Declaration
    protected bool YYRecovering { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    AddState(Int32, State)

    OBSOLETE FOR VERSION 1.4.0 Method used by derived types to insert new state instances in the "states" array.

    Declaration
    protected void AddState(int stateNumber, State state)
    Parameters
    Type Name Description
    System.Int32 stateNumber

    index of the state

    State state

    data for the state

    | Improve this Doc View Source

    CharToString(Char)

    Return text representation of argument character

    Declaration
    protected static string CharToString(char input)
    Parameters
    Type Name Description
    System.Char input

    The character to convert

    Returns
    Type Description
    System.String

    String representation of the character

    | Improve this Doc View Source

    DoAction(Int32)

    Execute the selected action from array. Must be overriden in derived classes.

    Declaration
    protected abstract void DoAction(int actionNumber)
    Parameters
    Type Name Description
    System.Int32 actionNumber

    Index of the action to perform

    | Improve this Doc View Source

    Initialize()

    Abstract base method. ShiftReduceParser calls this to initialize the base class data structures. Concrete parser classes must override this method.

    Declaration
    protected abstract void Initialize()
    | Improve this Doc View Source

    InitNonTerminals(String[])

    Initialization method to allow derived classes to insert the non-terminal symbol names into this base class.

    Declaration
    protected void InitNonTerminals(string[] names)
    Parameters
    Type Name Description
    System.String[] names

    Non-terminal symbol names

    | Improve this Doc View Source

    InitRules(Rule[])

    Initialization method to allow derived classes to insert the rule list into this base class.

    Declaration
    protected void InitRules(Rule[] rules)
    Parameters
    Type Name Description
    Rule[] rules

    The array of Rule objects

    | Improve this Doc View Source

    InitSpecialTokens(Int32, Int32)

    Initialization method to allow derived classes to insert the special value for the error and EOF tokens.

    Declaration
    protected void InitSpecialTokens(int err, int end)
    Parameters
    Type Name Description
    System.Int32 err

    The error state ordinal

    System.Int32 end

    The EOF stat ordinal

    | Improve this Doc View Source

    InitStates(State[])

    Initialization method to allow derived classes to insert the states table into this base class.

    Declaration
    protected void InitStates(State[] states)
    Parameters
    Type Name Description
    State[] states

    The pre-initialized states table

    | Improve this Doc View Source

    InitStateTable(Int32)

    OBSOLETE FOR VERSION 1.4.0

    Declaration
    protected void InitStateTable(int size)
    Parameters
    Type Name Description
    System.Int32 size
    | Improve this Doc View Source

    Parse()

    Main entry point of the Shift-Reduce Parser.

    Declaration
    public bool Parse()
    Returns
    Type Description
    System.Boolean

    True if parse succeeds, else false for unrecoverable errors

    | Improve this Doc View Source

    TerminalToString(Int32)

    Abstract state class naming terminal symbols. This is overridden by derived classes with the name (or alias) to be used in error messages.

    Declaration
    protected abstract string TerminalToString(int terminal)
    Parameters
    Type Name Description
    System.Int32 terminal

    The terminal ordinal

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    YYAbort()

    Force parser to terminate, returning "false"

    Declaration
    protected static void YYAbort()
    | Improve this Doc View Source

    YYAccept()

    Force parser to terminate, returning "true"

    Declaration
    protected static void YYAccept()
    | Improve this Doc View Source

    yyclearin()

    Traditional YACC method. Discards the next input token.

    Declaration
    protected void yyclearin()
    | Improve this Doc View Source

    yyerrok()

    Tradional YACC method. Clear the "recovering" flag.

    Declaration
    protected void yyerrok()
    | Improve this Doc View Source

    YYError()

    Force parser to terminate, returning "false" if error recovery fails.

    Declaration
    protected static void YYError()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2022 xbim