An implementation of the LLLPG Parser API, used with the LLLPG options inputSource and inputClass.
This derived class simply makes public all of the LLLPG APIs which are marked protected in BaseParserForList{Token,MatchType,List}.
- Template Parameters
-
| Token | Data type of complete tokens in the token list. A token contains the type of a "word" in the program (string, identifier, plus sign, etc.), a value (e.g. the name of an identifier), and a range of characters in the source file. See ISimpleToken{MatchType}. Note: Token is usually a small struct; this class does not expect it to ever be null. |
| MatchType | A data type, usually int, that represents a token type (identifier, operator, etc.) and implements IEquatable{T} so it can be compared for equality with other token types; this is also the type of the ISimpleToken{Matchtype}.Type property. |
| List | Data type of the list that contains the tokens (one often uses IList{Token}, but one could use Loyc.Collections.Impl.InternalList{T} for potentially higher performance.) |
- Type Constraints
-
| Token | : | ISimpleToken<MatchType> | |
| MatchType | : | IEquatable<MatchType> | |
| List | : | IList<Token> | |
|
|
| ParserSource (List list, Token eofToken, ISourceFile file, int startIndex=0) |
| | <inheridoc>
|
| |
|
virtual new void | Reset (List source, Token eofToken, ISourceFile file, int startIndex=0) |
| | Reinitializes the object. This method is called by the constructor.See the constructor for documentation of the parameters.
|
| |
|
new void | Reset () |
| |
| new 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...
|
| |
|
new MatchType | LA (int i) |
| |
|
new void | Skip () |
| |
|
new Token | MatchAny () |
| |
|
new Token | Match (MatchType a) |
| |
|
new Token | Match (MatchType a, MatchType b) |
| |
|
new Token | Match (MatchType a, MatchType b, MatchType c) |
| |
|
new Token | Match (MatchType a, MatchType b, MatchType c, MatchType d) |
| |
|
Token | Match (HashSet< MatchType > set) |
| |
|
new Token | MatchExcept () |
| |
|
new Token | MatchExcept (MatchType a) |
| |
|
new Token | MatchExcept (MatchType a, MatchType b) |
| |
|
new Token | MatchExcept (MatchType a, MatchType b, MatchType c) |
| |
|
new Token | MatchExcept (MatchType a, MatchType b, MatchType c, MatchType d) |
| |
|
new Token | MatchExcept (HashSet< MatchType > set) |
| |
|
bool | TryMatch (HashSet< MatchType > set) |
| |
|
new bool | TryMatch (MatchType a) |
| |
|
new bool | TryMatch (MatchType a, MatchType b) |
| |
|
new bool | TryMatch (MatchType a, MatchType b, MatchType c) |
| |
|
new bool | TryMatch (MatchType a, MatchType b, MatchType c, MatchType d) |
| |
|
new bool | TryMatchExcept () |
| |
|
new bool | TryMatchExcept (HashSet< MatchType > set) |
| |
|
new bool | TryMatchExcept (MatchType a) |
| |
|
new bool | TryMatchExcept (MatchType a, MatchType b) |
| |
|
new bool | TryMatchExcept (MatchType a, MatchType b, MatchType c) |
| |
|
new bool | TryMatchExcept (MatchType a, MatchType b, MatchType c, MatchType d) |
| |
|
virtual new void | Check (bool expectation, string expectedDescr="") |
| |
|
virtual new void | Error (int lookaheadIndex, string format, params object[] args) |
| |
|
| override string | ToString (MatchType tokenType) |
| | Returns a string representation of the specified token type. These strings are used in error messages. More...
|
| |
| | BaseParserForList (List list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0) |
| | Initializes this object to begin parsing the specified tokens. More...
|
| |
|
| BaseParserForList (List list, Token getEofToken, ISourceFile file, int startIndex=0) |
| |
| virtual void | Reset (List list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0) |
| | Reinitializes the object. This method is called by the constructor. More...
|
| |
|
void | Reset () |
| |
| sealed override MatchType | EofInt () |
| | Returns the value used for EOF (normally 0) More...
|
| |
|
MatchType | LA (int i) |
| |
| bool | Down (List children) |
| | Switches to parsing the specified token list at position zero (typically the value of Loyc.Syntax.Lexing.Token.Children in a token tree produced by TokensToTree.) The original token list and the original InputPosition are placed on a stack, so you can restore the old list by calling Up(). More...
|
| |
| void | Up () |
| | Returns to the old token list saved by Down. More...
|
| |
| T | Up< T > (T value) |
| | Calls Up() and returns value. More...
|
| |
| | BaseParser (ISourceFile?file=null, int startIndex=0) |
| | Initializes the base class. 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 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) |
| |