IParserState Interface
Provides the base requirements for an object that tracks the current state of a ILLParser.
public interface IParserState
Properties
AstNodeBuilder
Gets the IAstNodeBuilder to use for constructing AST node results.
IAstNodeBuilder AstNodeBuilder { get; }
Property Value
- IAstNodeBuilder:
The IAstNodeBuilder to use for constructing AST node results.
CustomData
Gets or sets custom data that can be altered during a parsing operation.
object CustomData { get; set; }
Property Value
- System.Object:
Custom data that can be altered during a parsing operation.
ParseErrors
Gets the collection of IParseError objects that will be returned in the IParseData parsing result.
IEnumerable<IParseError> ParseErrors { get; }
Property Value
- System.Collections.Generic.IEnumerable<IParseError>:
The collection of IParseError objects that will be returned in the IParseData parsing result.
Parser
Gets the ILLParser for which this state is tracking data.
ILLParser Parser { get; }
Property Value
Snapshot
Gets the ITextSnapshot used to initiate the parsing operation, if known.
ITextSnapshot Snapshot { get; }
Property Value
- ITextSnapshot:
The ITextSnapshot used to initiate the parsing operation, if known.
TokenReader
Gets the ITokenReader that is used to read tokens during the parsing operation.
ITokenReader TokenReader { get; }
Property Value
- ITokenReader:
The ITokenReader that is used to read tokens during the parsing operation.
UntargetableParseErrorTokenIds
Gets or sets the collection of token IDs that should be avoided when determining where untargeted parse errors will appear.
IEnumerable<int> UntargetableParseErrorTokenIds { get; set; }
Property Value
- System.Collections.Generic.IEnumerable<System.Int32>:
The collection of token IDs that should be avoided when determining where untargeted parse errors will appear.
Remarks
If a parse error is reported without a target token, the parser will normally place the parse error at the next token. If that token is one of the IDs found in this collection, the parse error will appear after the previous token instead. This property should be set to a collection of any IDs for visually-insignificant tokens that can be passed to the parser such as a line feed, line continuation, document end, etc.
Methods
ReportError(IParseError)
Reports an IParseError.
void ReportError(IParseError parseError)
Parameter | Type | Description |
---|---|---|
parseError | IParseError | The IParseError object that contains details about the error. |
ReportError(ParseErrorLevel, String)
Reports an IParseError, using the look-ahead token for its range.
IParseError ReportError(ParseErrorLevel level, string description)
Parameter | Type | Description |
---|---|---|
level | ParseErrorLevel | A ParseErrorLevel indicating the error level. |
description | System.String | The description of the error, which is displayed in the user interface. |
Returns
- IParseError:
The IParseError that was reported.
ReportError(ParseErrorLevel, String, IToken)
Reports an IParseError, using the specified token for its range.
IParseError ReportError(ParseErrorLevel level, string description, IToken token)
Parameter | Type | Description |
---|---|---|
level | ParseErrorLevel | A ParseErrorLevel indicating the error level. |
description | System.String | The description of the error, which is displayed in the user interface. |
token | IToken | The IToken to examine for the error range. If not passed, the look-ahead token is used. |
Returns
- IParseError:
The IParseError that was reported.
ReportNonTerminalExpectedError(NonTerminal)
Reports an IParseError indicating that a NonTerminal was expected, but not found.
IParseError ReportNonTerminalExpectedError(NonTerminal nonTerminal)
Parameter | Type | Description |
---|---|---|
nonTerminal | NonTerminal | The NonTerminal that was expected. |
Returns
- IParseError:
The IParseError that was reported.
ReportNonTerminalExpectedError(NonTerminal, IToken)
Reports an IParseError indicating that a NonTerminal was expected, but not found.
IParseError ReportNonTerminalExpectedError(NonTerminal nonTerminal, IToken token)
Parameter | Type | Description |
---|---|---|
nonTerminal | NonTerminal | The NonTerminal that was expected. |
token | IToken | The IToken at which the error should be reported. |
Returns
- IParseError:
The IParseError that was reported.
ReportNonTerminalExpectedError(NonTerminal, TextPositionRange)
Reports an IParseError indicating that a NonTerminal was expected, but not found.
IParseError ReportNonTerminalExpectedError(NonTerminal nonTerminal, TextPositionRange positionRange)
Parameter | Type | Description |
---|---|---|
nonTerminal | NonTerminal | The NonTerminal that was expected. |
positionRange | TextPositionRange | The TextPositionRange over which the error should be reported. |
Returns
- IParseError:
The IParseError that was reported.
ReportTerminalExpectedError(Terminal)
Reports an IParseError indicating that a Terminal was expected, but not found.
IParseError ReportTerminalExpectedError(Terminal terminal)
Parameter | Type | Description |
---|---|---|
terminal | Terminal | The Terminal that was expected. |
Returns
- IParseError:
The IParseError that was reported.
ReportTerminalExpectedError(Terminal, IToken)
Reports an IParseError indicating that a Terminal was expected, but not found.
IParseError ReportTerminalExpectedError(Terminal terminal, IToken token)
Parameter | Type | Description |
---|---|---|
terminal | Terminal | The Terminal that was expected. |
token | IToken | The IToken at which the error should be reported. |
Returns
- IParseError:
The IParseError that was reported.
ReportTerminalExpectedError(Terminal, TextPositionRange)
Reports an IParseError indicating that a Terminal was expected, but not found.
IParseError ReportTerminalExpectedError(Terminal terminal, TextPositionRange positionRange)
Parameter | Type | Description |
---|---|---|
terminal | Terminal | The Terminal that was expected. |
positionRange | TextPositionRange | The TextPositionRange over which the error should be reported. |
Returns
- IParseError:
The IParseError that was reported.