Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Protected Member Functions | List of all members
Loyc.Syntax.BaseParser< Token > Class Template Reference

An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator). Note: this is the old (harder to use) base class. You should use BaseParserForList{Token, LaType} instead. This class is now an alias for BaseParser{Token,int}. More...


Source file:
Inheritance diagram for Loyc.Syntax.BaseParser< Token >:
Loyc.Syntax.BaseParser< Token, MatchType > Loyc.Ecs.Parser.EcsParser Loyc.Syntax.BaseParserNoBacktracking< Token, Enumerator > Loyc.Syntax.BaseParserNoBacktracking< Token >

Remarks

An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator). Note: this is the old (harder to use) base class. You should use BaseParserForList{Token, LaType} instead. This class is now an alias for BaseParser{Token,int}.

Protected Member Functions

 BaseParser (ISourceFile?file=null, int startIndex=0)
 
- Protected Member Functions inherited from Loyc.Syntax.BaseParser< Token, MatchType >
 BaseParser (ISourceFile?file=null, int startIndex=0)
 Initializes the base class. More...
 
abstract MatchType EofInt ()
 Returns the value used for EOF (normally 0) More...
 
abstract Token LT (int i)
 Returns the token at lookahead i (e.g. Source[InputPosition + i] if the tokens come from a list called Source) More...
 
abstract string ToString (MatchType tokenType)
 Returns a string representation of the specified token type. These strings are used in error messages. More...
 
virtual int LaIndexToCharIndex (int lookaheadIndex)
 Converts a lookahead token index to a character index (used for error reporting). More...
 
virtual object LaIndexToMsgContext (int lookaheadIndex)
 Converts a lookahead token index to a SourceRange (or to a string if SourceFile was initialized to null.) More...
 
virtual void Error (int lookaheadIndex, string message)
 Records an error or throws an exception. More...
 
virtual void Error (int lookaheadIndex, string format, params object?[] args)
 
void Skip ()
 
Token MatchAny ()
 
Token Match (HashSet< MatchType > set, bool inverted=false)
 
Token Match (MatchType a)
 
Token Match (MatchType a, MatchType b)
 
Token Match (MatchType a, MatchType b, MatchType c)
 
Token Match (MatchType a, MatchType b, MatchType c, MatchType d)
 
Token MatchExcept ()
 
Token MatchExcept (MatchType a)
 
Token MatchExcept (MatchType a, MatchType b)
 
Token MatchExcept (MatchType a, MatchType b, MatchType c)
 
Token MatchExcept (MatchType a, MatchType b, MatchType c, MatchType d)
 
Token MatchExcept (HashSet< MatchType > set)
 
bool TryMatch (HashSet< MatchType > set, bool inverted=false)
 
bool TryMatch (MatchType a)
 
bool TryMatch (MatchType a, MatchType b)
 
bool TryMatch (MatchType a, MatchType b, MatchType c)
 
bool TryMatch (MatchType a, MatchType b, MatchType c, MatchType d)
 
bool TryMatchExcept ()
 
bool TryMatchExcept (MatchType a)
 
bool TryMatchExcept (MatchType a, MatchType b)
 
bool TryMatchExcept (MatchType a, MatchType b, MatchType c)
 
bool TryMatchExcept (MatchType a, MatchType b, MatchType c, MatchType d)
 
bool TryMatchExcept (HashSet< MatchType > set)
 
void MatchError (bool inverted, params MatchType[] expected)
 
virtual void MatchError (bool inverted, IEnumerable< MatchType > expected)
 Handles an error that occurs during Match() or MatchExcept() More...
 
virtual string ToString (bool inverted, IEnumerable< MatchType > expected)
 
virtual void Check (bool expectation, string expectedDescr="")
 

Additional Inherited Members

- Public static fields inherited from Loyc.Syntax.BaseParser< Token, MatchType >
static readonly IMessageSink LogExceptionErrorSink
 Throws LogException when it receives an error. Non-errors are sent to MessageSink.Default. More...
 
static readonly IMessageSink FormatExceptionErrorSink
 
- Properties inherited from Loyc.Syntax.BaseParser< Token, MatchType >
IMessageSink ErrorSink [get, set]
 Gets or sets the object to which error messages are sent. The default object is LogExceptionErrorSink, which throws an exception if an error occurs. More...
 
ISourceFile SourceFile [get]
 The ISourceFile object that was provided to the constructor, if any. More...
 
Token LT0 [get]
 Next token to parse (cached; is set to LT(0) whenever InputPosition is changed). More...
 
int InputPosition [get, set]
 Current position of the next token to be parsed. More...
 
abstract MatchType LA0Int [get]
 Returns the token type of _lt0 (normally _lt0.TypeInt) More...
 
- Static Protected Member Functions inherited from Loyc.Syntax.BaseParser< Token, MatchType >
static HashSet< MatchType > NewSet (params MatchType[] items)
 
- Protected fields inherited from Loyc.Syntax.BaseParser< Token, MatchType >
ISourceFile _sourceFile
 
Token _lt0 = default!
 
int _inputPosition
 
MatchType EOF