C# Class kompiler.Lexer

Lexer returns tokens (lexemes). This is implemented as a singleton pattern (Design Patterns in C sharp)
Mostrar archivo Open project: jakl/hacks Class Usage Examples

Public Methods

Method Description
GetLexer ( ) : Lexer
Lex ( string source ) : bool

Tokenizes the string arg into a linked list of tokens, available through the Token attribute of this class, after the function has returned.

addModuleWhenNonExistant ( ) : void

Check the first token to see if it is MODULE. If it isn't, add the proper begin and end statements. This is a convenience function to save time when writing short modula 2 programs

Private Methods

Method Description
Lex1Char ( ) : bool
Lex2Chars ( ) : bool
LexKeyWords ( ) : bool
LexRegexes ( ) : bool
Lexer ( ) : System
LoadKeywords ( ) : void

Load M2 keywords. PRE: An array of keywords is available in Token. POST: The hashtable is loaded and the correct token type is associated with each entry.

Method Details

GetLexer() public static method

public static GetLexer ( ) : Lexer
return Lexer

Lex() public method

Tokenizes the string arg into a linked list of tokens, available through the Token attribute of this class, after the function has returned.
public Lex ( string source ) : bool
source string string to lex/tokenize
return bool

addModuleWhenNonExistant() public method

Check the first token to see if it is MODULE. If it isn't, add the proper begin and end statements. This is a convenience function to save time when writing short modula 2 programs
public addModuleWhenNonExistant ( ) : void
return void