Class SyntaxFactory
Provides a base class for classes that create new instances of SyntaxNode
Inherited Members
Namespace: CilTools.Syntax
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public abstract class SyntaxFactory
Constructors
SyntaxFactory()
Declaration
protected SyntaxFactory()
Methods
CreateFromToken(String, String, String)
Creates a syntax node using the specified token string (for example, keyword or identifier)
Declaration
public static SyntaxNode CreateFromToken(string tokenString, string leadingWhitespace, string trailingWhitespace)
Parameters
Type | Name | Description |
---|---|---|
System.String | tokenString | String containing a single CIL assembler token |
System.String | leadingWhitespace | String containing whitespace characters that precede the specified token in the source document |
System.String | trailingWhitespace | String containing whitespace characters that follow the specified token in the source document |
Returns
Type | Description |
---|---|
SyntaxNode |
Remarks
tokenString
should be a valid token according to CIL assembler grammar. Leading and
trailing whitespace should be strings consisting of only whitespace characters (including CR and LF), empty
strings or null values. Otherwise, the behaviour is undefined.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Token string is null |
System.ArgumentException | Token string is empty |
CreateNode(String, String, String)
Creates a new syntax node
Declaration
public abstract SyntaxNode CreateNode(string content, string leadingWhitespace, string trailingWhitespace)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | The source code of the node |
System.String | leadingWhitespace | String containing whitespace characters that precede the node in the source document |
System.String | trailingWhitespace | String containing whitespace characters that follow the node in the source document |
Returns
Type | Description |
---|---|
SyntaxNode |