Class LuaSyntaxNode
Represents a non-terminal node in the syntax tree.
Inheritance
Implements
Inherited Members
Namespace: Loretta.CodeAnalysis.Lua
Assembly: Loretta.CodeAnalysis.Lua.dll
Syntax
public abstract class LuaSyntaxNode : SyntaxNode
Properties
| Improve this Doc View SourceLanguage
The language name that this node is syntax of.
Declaration
public override string Language { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Methods
| Improve this Doc View SourceAccept(LuaSyntaxVisitor)
Accepts a visitor into this node.
Declaration
public abstract void Accept(LuaSyntaxVisitor visitor)
Parameters
Type | Name | Description |
---|---|---|
LuaSyntaxVisitor | visitor |
Accept<TResult>(LuaSyntaxVisitor<TResult>)
Accepts a visitor into this node.
Declaration
public abstract TResult Accept<TResult>(LuaSyntaxVisitor<TResult> visitor)
Parameters
Type | Name | Description |
---|---|---|
LuaSyntaxVisitor<TResult> | visitor |
Returns
Type | Description |
---|---|
TResult |
Type Parameters
Name | Description |
---|---|
TResult |
DeserializeFrom(Stream, CancellationToken)
Deserialize a syntax node from the byte stream.
Declaration
public static SyntaxNode DeserializeFrom(Stream stream, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
SyntaxNode |
FindToken(Int32, Boolean)
Finds a token according to the following rules:
If position matches the End of the node/s FullSpan and the node is CompilationUnit, then EoF is returned.
If node.FullSpan.Contains(position) then the token that contains given position is returned.
Otherwise an ArgumentOutOfRangeException is thrown
Declaration
public SyntaxToken FindToken(int position, bool findInsideTrivia = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | position | |
System.Boolean | findInsideTrivia |
Returns
Type | Description |
---|---|
SyntaxToken |
FindTrivia(Int32, Func<SyntaxTrivia, Boolean>)
Finds a descendant trivia of this node at the specified position, where the position is within the span of the node.
Declaration
public SyntaxTrivia FindTrivia(int position, Func<SyntaxTrivia, bool> stepInto)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | position | The character position of the trivia relative to the beginning of the file. |
Func<SyntaxTrivia, System.Boolean> | stepInto | Specifies a function that determines per trivia node, whether to descend into structured trivia of that node. |
Returns
Type | Description |
---|---|
SyntaxTrivia |
FindTrivia(Int32, Boolean)
Finds a descendant trivia of this node whose span includes the supplied position.
Declaration
public SyntaxTrivia FindTrivia(int position, bool findInsideTrivia = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | position | The character position of the trivia relative to the beginning of the file. |
System.Boolean | findInsideTrivia | Whether to search inside structured trivia. |
Returns
Type | Description |
---|---|
SyntaxTrivia |
GetDiagnostics()
Gets a list of all the diagnostics in the sub tree that has this node as its root. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc.
Declaration
public IEnumerable<Diagnostic> GetDiagnostics()
Returns
Type | Description |
---|---|
IEnumerable<Diagnostic> |
GetFirstToken(Boolean, Boolean, Boolean, Boolean)
Gets the first token of the tree rooted by this node.
Declaration
public SyntaxToken GetFirstToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | includeZeroWidth | True if zero width tokens should be included, false by default. |
System.Boolean | includeSkipped | True if skipped tokens should be included, false by default. |
System.Boolean | includeDirectives | True if directives should be included, false by default. |
System.Boolean | includeDocumentationComments | True if documentation comments should be included, false by default. |
Returns
Type | Description |
---|---|
SyntaxToken |
GetLastToken(Boolean, Boolean, Boolean, Boolean)
Gets the last non-zero-width token of the tree rooted by this node.
Declaration
public SyntaxToken GetLastToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | includeZeroWidth | True if zero width tokens should be included, false by default. |
System.Boolean | includeSkipped | True if skipped tokens should be included, false by default. |
System.Boolean | includeDirectives | True if directives should be included, false by default. |
System.Boolean | includeDocumentationComments | True if documentation comments should be included, false by default. |
Returns
Type | Description |
---|---|
SyntaxToken |
GetLeadingTrivia()
The list of trivia that appears before this node in the source code.
Declaration
public SyntaxTriviaList GetLeadingTrivia()
Returns
Type | Description |
---|---|
SyntaxTriviaList |
GetLocation()
Gets a Location for this node.
Declaration
public Location GetLocation()
Returns
Type | Description |
---|---|
Location |
GetTrailingTrivia()
The list of trivia that appears after this node in the source code.
Declaration
public SyntaxTriviaList GetTrailingTrivia()
Returns
Type | Description |
---|---|
SyntaxTriviaList |
Kind()
Returns the SyntaxKind of the node.
Declaration
public SyntaxKind Kind()
Returns
Type | Description |
---|---|
SyntaxKind |