Show / Hide Table of Contents

Class Lexer<TToken>

Performs lexical analysis of the source code in particular language Allows to enumerate over source as typed Token stream - depending on implementation enumeration may do lexical analysis token-by-token or in chunks with every enumerator advance

Inheritance
System.Object
CommonCodeProcessor
SourceRefCommonCodeProcessor
Lexer<TToken>
CSLexer
JSONLexer
LaconfigLexer
Implements
ILexer
ICodeProcessor
System.Collections.Generic.IEnumerable<TToken>
System.Collections.IEnumerable
Inherited Members
SourceRefCommonCodeProcessor.SourceCodeReference
SourceRefCommonCodeProcessor.EmitMessage(MessageType, Int32, SourcePosition, Token, String, Exception)
CommonCodeProcessor.Context
CommonCodeProcessor.Messages
CommonCodeProcessor.ThrowErrors
CommonCodeProcessor.Language
CommonCodeProcessor.MessageCodeToString(Int32)
CommonCodeProcessor.EmitMessage(MessageType, Int32, SourceCodeRef, Nullable<SourcePosition>, Token, String, Exception)
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 Lexer<TToken> : SourceRefCommonCodeProcessor, ILexer, ICodeProcessor, IEnumerable<TToken>, IEnumerable where TToken : Token
Type Parameters
Name Description
TToken

Constructors

Lexer(IAnalysisContext, SourceCodeRef, ISourceText, MessageList, Boolean)

Declaration
protected Lexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
Parameters
Type Name Description
IAnalysisContext context
SourceCodeRef srcRef
ISourceText source
MessageList messages
System.Boolean throwErrors

Lexer(ISourceText, MessageList, Boolean)

Declaration
protected Lexer(ISourceText source, MessageList messages = null, bool throwErrors = false)
Parameters
Type Name Description
ISourceText source
MessageList messages
System.Boolean throwErrors

Fields

m_AllAnalyzed

Declaration
protected bool m_AllAnalyzed
Field Value
Type Description
System.Boolean

m_Tokens

Declaration
protected TokenList<TToken> m_Tokens
Field Value
Type Description
TokenList<TToken>

Properties

AllAnalyzed

Returns true when the whole input source has been analyzed. This property is always true for lexers that do not support lazy analysis

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

Source

References source code text that was lexed

Declaration
public ISourceText Source { get; }
Property Value
Type Description
ISourceText

Tokens

Returns tokenized source as indexable list. Accessing this property causes lexical analysis to complete on the whole source if it has not been completed yet

Declaration
public Tokenized<TToken> Tokens { get; }
Property Value
Type Description
Tokenized<TToken>

TokenStream

Enumerates Token stream - depending on implementation enumeration may do lexical analysis token-by-token or in chunks with every enumerator advance

Declaration
public IEnumerable<Token> TokenStream { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Token>

Methods

AnalyzeAll()

If lexer supports lazy analysis, forces analysis of the whole source

Declaration
public void AnalyzeAll()

DoLexingChunk()

Lexes more source and returns true when EOF has been reached. Depending on particular implementation, a chunk may contain more than one token. Tokens are added into m_Tokens

Declaration
protected abstract bool DoLexingChunk()
Returns
Type Description
System.Boolean

GetEnumerator()

Declaration
public IEnumerator<TToken> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<TToken>

ToString()

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

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

ILexer
ICodeProcessor
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T>)
CollectionUtils.ForEach<T>(IEnumerable<T>, Action<T, Int32>)
CollectionUtils.SkipLast<T>(IEnumerable<T>)
CollectionUtils.SkipLast<T>(IEnumerable<T>, Int32)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMin<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>)
CollectionUtils.FirstMax<TResult, TComparand>(IEnumerable<TResult>, Func<TResult, TComparand>, out TComparand)
CollectionUtils.FirstOrAnyOrDefault<TResult>(IEnumerable<TResult>, Func<TResult, Boolean>)
CollectionUtils.Distinct<TResult, TKey>(IEnumerable<TResult>, Func<TResult, TKey>)
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.LazyFSM<TToken>(IEnumerable<TToken>, LazyFSMPredicate<TToken>[])
PatternSearch.LazyFSM<TToken>(IEnumerable<TToken>, Boolean, LazyFSMPredicate<TToken>[])
PatternSearch.LazyFSM<TToken>(IEnumerable<TToken>, Boolean, ref LazyFSMState<TToken>, LazyFSMPredicate<TToken>[])
LookAheadExtensions.AsLookAheadEnumerable<T>(IEnumerable<T>)
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