Show / Hide Table of Contents

Class Token

Represents a lexical token of the language. This is an abstract class that particular language implementations must extend to define language-specific token types

Inheritance
System.Object
Token
CSToken
JSONToken
LaconfigToken
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: NFX.CodeAnalysis
Assembly: NFX.dll
Syntax
public abstract class Token

Constructors

Token(ILexer, SourcePosition, SourcePosition, String)

Declaration
public Token(ILexer lexer, SourcePosition startPos, SourcePosition endPos, string text)
Parameters
Type Name Description
ILexer lexer
SourcePosition startPos
SourcePosition endPos
System.String text

Token(ILexer, SourcePosition, SourcePosition, String, Object)

Declaration
public Token(ILexer lexer, SourcePosition startPos, SourcePosition endPos, string text, object value)
Parameters
Type Name Description
ILexer lexer
SourcePosition startPos
SourcePosition endPos
System.String text
System.Object value

Fields

EndPosition

Declaration
public readonly SourcePosition EndPosition
Field Value
Type Description
SourcePosition

Lexer

Declaration
public readonly ILexer Lexer
Field Value
Type Description
ILexer

StartPosition

Declaration
public readonly SourcePosition StartPosition
Field Value
Type Description
SourcePosition

Text

Declaration
public readonly string Text
Field Value
Type Description
System.String

Value

Declaration
public readonly object Value
Field Value
Type Description
System.Object

Properties

IsBOF

Indicates whether this token indicates an BEGINNING-OF-FILE condition

Declaration
public bool IsBOF { get; }
Property Value
Type Description
System.Boolean

IsComment

Indicates whether this token represents a comment

Declaration
public bool IsComment { get; }
Property Value
Type Description
System.Boolean

IsDirective

Indicates whether this token represents a directive

Declaration
public bool IsDirective { get; }
Property Value
Type Description
System.Boolean

IsEOF

Indicates whether this token indicates an END-OF-FILE condition

Declaration
public bool IsEOF { get; }
Property Value
Type Description
System.Boolean

IsIdentifier

Indicates whether this token represents an identifier

Declaration
public bool IsIdentifier { get; }
Property Value
Type Description
System.Boolean

IsKeyword

Indicates whether this token represents a language keyword

Declaration
public bool IsKeyword { get; }
Property Value
Type Description
System.Boolean

IsLiteral

Indicates whether this token represents a literal

Declaration
public bool IsLiteral { get; }
Property Value
Type Description
System.Boolean

IsNonLanguage

This property is needed due to the fact that language lexers may be used to analyze special supersets of regular language grammars i.e. for pattern matches, template parser etc. Code compilers may elect to throw errors when this property is true. Returns true for tokens that are not part of the valid language grammar, however they exist for other reasons, for example - for pattern capture match analysis, or for template processing

Declaration
public abstract bool IsNonLanguage { get; }
Property Value
Type Description
System.Boolean

IsNumericLiteral

Indicates whether this token represents a literal, which is a numeric literal (i.e. int, double) This flag is useful for pattern searches that look for particular constant values in numbers (i.e. year = 2000)

Declaration
public abstract bool IsNumericLiteral { get; }
Property Value
Type Description
System.Boolean

IsOperator

Indicates whether this token represents an operator

Declaration
public bool IsOperator { get; }
Property Value
Type Description
System.Boolean

IsPrimary

Returns true for tokens that are primary part of the language, not control, metadata, directive, comment etc... For example BOF,EOF markers are not primary part of the language, compiler directives, comments are not either. This property is useful for pattern searches, when comments and other non-primary tokens need to be quickly skipped

Declaration
public abstract bool IsPrimary { get; }
Property Value
Type Description
System.Boolean

IsSymbol

Indicates whether this token represents a symbol

Declaration
public bool IsSymbol { get; }
Property Value
Type Description
System.Boolean

IsTextualLiteral

Indicates whether this token represents a literal, which is a string or a character sequence. This flag is useful for pattern searches that examine comments and strings for sub-patterns

Declaration
public abstract bool IsTextualLiteral { get; }
Property Value
Type Description
System.Boolean

Kind

Provides language-agnostic classification for token type

Declaration
public abstract TokenKind Kind { get; }
Property Value
Type Description
TokenKind

Language

Returns language that this token is a part of

Declaration
public abstract Language Language { get; }
Property Value
Type Description
Language

OrdinalType

Returns token type as a grammar-agnostic ordinal

Declaration
public abstract int OrdinalType { get; }
Property Value
Type Description
System.Int32

Methods

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
PatternSearch.TypeIsAnyOf<TToken>(TToken, Int32[])
PatternSearch.TypeIsAnyOf<TToken, TTokenType>(TToken, TTokenType[])
PatternSearch.TextIsAnyOf<TToken>(TToken, String[])
PatternSearch.TextIsAnyOf<TToken>(TToken, StringComparison, String[])
PatternSearch.IsAnyOrAbort<TToken>(TToken, Int32[])
PatternSearch.IsAnyOrAbort<TToken, TTokenType>(TToken, TTokenType[])
PatternSearch.IsAnyOrAbort<TToken>(TToken, String[])
PatternSearch.IsAnyOrAbort<TToken>(TToken, StringComparison, String[])
PatternSearch.LoopUntilAny<TToken>(TToken, Int32[])
PatternSearch.LoopUntilAny<TToken, TTokenType>(TToken, TTokenType[])
PatternSearch.LoopUntilAny<TToken>(TToken, String[])
PatternSearch.LoopUntilAny<TToken>(TToken, StringComparison, String[])
PatternSearch.DoUntilAny<TToken>(TToken, FSMI, Int32[])
PatternSearch.DoUntilAny<TToken, TTokenType>(TToken, FSMI, TTokenType[])
PatternSearch.DoUntilAny<TToken>(TToken, FSMI, String[])
PatternSearch.DoUntilAny<TToken>(TToken, FSMI, StringComparison, String[])
PatternSearch.LoopWhileAnyOrAbort<TToken>(TToken, Int32[])
PatternSearch.LoopWhileAnyOrAbort<TToken, TTokenType>(TToken, TTokenType[])
PatternSearch.LoopWhileAnyOrAbort<TToken>(TToken, String[])
PatternSearch.LoopWhileAnyOrAbort<TToken>(TToken, StringComparison, String[])
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX