C# Class Jurassic.Compiler.Lexer

Converts a JavaScript source file into a series of tokens.
Inheritance: IDisposable
Mostrar archivo Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Cleans up any resources used by the lexer.

Lexer ( ScriptEngine engine, ScriptSource source ) : System

Creates a Lexer instance with the given source of text.

NextToken ( ) : Jurassic.Compiler.Token

Reads the next token from the reader.

ReadStringLiteral ( int firstChar ) : Jurassic.Compiler.Token

Reads a string literal.

Private Methods

Method Description
IsHexDigit ( int c ) : bool

Determines if the given character is valid in a hexidecimal number.

IsIdentifierChar ( int c ) : bool

Determines if the given character is valid as a character of an identifier.

IsIdentifierStartChar ( int c ) : bool

Determines if the given character is valid as the first character of an identifier.

IsLineTerminator ( int c ) : bool

Determines if the given character is a line terminator.

IsNumericLiteralStartChar ( int c ) : bool

Determines if the given character is valid as the first character of a numeric literal.

IsPunctuatorStartChar ( int c ) : bool

Determines if the given character is valid as the first character of a punctuator.

IsStringLiteralStartChar ( int c ) : bool

Determines if the given character is valid as the first character of a string literal.

IsWhiteSpace ( int c ) : bool

Determines if the given character is whitespace.

ReadDivideCommentOrRegularExpression ( ) : Jurassic.Compiler.Token

Reads a divide operator ('/' or '/='), a comment ('//' or '/*'), or a regular expression literal.

ReadExtendedUnicodeSequence ( ) : string

Reads an extended unicode escape sequence in the form "\u{20BB7}".

ReadHexEscapeSequence ( int digitCount ) : char

Reads a hexidecimal number with the given number of digits and turns it into a character.

ReadIdentifier ( int firstChar ) : Jurassic.Compiler.Token

Reads an identifier token.

ReadInteger ( double initialValue, int &digitsRead ) : double

Reads an integer value.

ReadLineTerminator ( int firstChar ) : Jurassic.Compiler.Token

Reads a line terminator (a newline).

ReadMultiLineComment ( ) : Jurassic.Compiler.Token

Reads past a multi-line comment.

ReadNextChar ( ) : int

Reads the next character from the input stream.

ReadNumericLiteral ( int firstChar ) : Jurassic.Compiler.Token

Reads a numeric literal token.

ReadOctalEscapeSequence ( int stringDelimiter, int firstDigit ) : char

Reads an octal number turns it into a single-byte character.

ReadPunctuator ( int firstChar ) : Jurassic.Compiler.Token

Reads a punctuation token.

ReadRegularExpression ( ) : Jurassic.Compiler.Token

Reads a regular expression literal.

ReadSingleLineComment ( ) : Jurassic.Compiler.Token

Reads past a single line comment.

ReadWhiteSpace ( ) : Jurassic.Compiler.Token

Reads past whitespace.

Method Details

Dispose() public method

Cleans up any resources used by the lexer.
public Dispose ( ) : void
return void

Lexer() public method

Creates a Lexer instance with the given source of text.
public Lexer ( ScriptEngine engine, ScriptSource source ) : System
engine ScriptEngine The associated script engine.
source ScriptSource The source of javascript code.
return System

NextToken() public method

Reads the next token from the reader.
public NextToken ( ) : Jurassic.Compiler.Token
return Jurassic.Compiler.Token

ReadStringLiteral() public method

Reads a string literal.
public ReadStringLiteral ( int firstChar ) : Jurassic.Compiler.Token
firstChar int The first character of the string literal.
return Jurassic.Compiler.Token