C# Class Antlr4.Runtime.CommonTokenFactory

This default implementation of ITokenFactory creates CommonToken objects.
Inheritance: ITokenFactory
Afficher le fichier Open project: antlr/antlr4

Méthodes publiques

Свойство Type Description
Default ITokenFactory

Protected Properties

Свойство Type Description
copyText bool

Méthodes publiques

Méthode Description
CommonTokenFactory ( ) : System

Constructs a CommonTokenFactory with copyText set to .

The Default instance should be used instead of calling this directly.

CommonTokenFactory ( bool copyText ) : System

Constructs a CommonTokenFactory with the specified value for copyText .

When copyText is , the Default instance should be used instead of constructing a new instance.

Create ( ICharStream>.Tuple source, int type, string text, int channel, int start, int stop, int line, int charPositionInLine ) : CommonToken
Create ( int type, string text ) : CommonToken

Private Methods

Méthode Description
ITokenFactory ( ICharStream>.Tuple source, int type, string text, int channel, int start, int stop, int line, int charPositionInLine ) : IToken
ITokenFactory ( int type, string text ) : IToken

Method Details

CommonTokenFactory() public méthode

Constructs a CommonTokenFactory with copyText set to .

The Default instance should be used instead of calling this directly.

public CommonTokenFactory ( ) : System
Résultat System

CommonTokenFactory() public méthode

Constructs a CommonTokenFactory with the specified value for copyText .

When copyText is , the Default instance should be used instead of constructing a new instance.

public CommonTokenFactory ( bool copyText ) : System
copyText bool /// The value for /// /// . ///
Résultat System

Create() public méthode

public Create ( ICharStream>.Tuple source, int type, string text, int channel, int start, int stop, int line, int charPositionInLine ) : CommonToken
source ICharStream>.Tuple
type int
text string
channel int
start int
stop int
line int
charPositionInLine int
Résultat CommonToken

Create() public méthode

public Create ( int type, string text ) : CommonToken
type int
text string
Résultat CommonToken

Property Details

Default public_oe static_oe property

The default CommonTokenFactory instance.

This token factory does not explicitly copy token text when constructing tokens.

public static ITokenFactory Default
Résultat ITokenFactory

copyText protected_oe property

Indicates whether CommonToken.Text should be called after constructing tokens to explicitly set the text. This is useful for cases where the input stream might not be able to provide arbitrary substrings of text from the input after the lexer creates a token (e.g. the implementation of ICharStream.GetText(Antlr4.Runtime.Misc.Interval) in UnbufferedCharStream throws an System.NotSupportedException ). Explicitly setting the token text allows IToken.Text() to be called at any time regardless of the input stream implementation.

The default value is to avoid the performance and memory overhead of copying text for every token unless explicitly requested.

protected bool copyText
Résultat bool