Skip to content

Latest commit

 

History

History
145 lines (107 loc) · 3.91 KB

parser.js.md

File metadata and controls

145 lines (107 loc) · 3.91 KB

Constants

ignoreStack

outputs some debug information on current token

parser

Kind: global class
Properties

Name Type Description
lexer Lexer current lexer instance
ast AST the AST factory instance
token Integer | String current token
extractDoc Boolean should extract documentation as AST node
extractTokens Boolean should extract each token
suppressErrors Boolean should ignore parsing errors and continue
debug Boolean should output debug informations

parser.getTokenName()

helper : gets a token name

Kind: instance method of parser

parser.parse()

main entry point : converts a source code to AST

Kind: instance method of parser

parser.raiseError()

Raise an error

Kind: instance method of parser

parser.error()

handling errors

Kind: instance method of parser

parser.node()

Creates a new AST node

Kind: instance method of parser

parser.expectEndOfStatement() ⇒ boolean

expects an end of statement or end of file

Kind: instance method of parser

parser.expect(token) ⇒ boolean

Force the parser to check the current token.

If the current token does not match to expected token, the an error will be raised.

If the suppressError mode is activated, then the error will be added to the program error stack and this function will return false.

Kind: instance method of parser
Throws:

  • Error
Param Type
token String | Number

parser.text() ⇒ String

Returns the current token contents

Kind: instance method of parser

parser.next()

consume the next token

Kind: instance method of parser

parser.lex()

Eating a token

Kind: instance method of parser

parser.is()

Check if token is of specified type

Constants

stance method of parser

oreStack">
ignoreStack

outputs some debug information on current token

ck
debug information on current token
**Kind**: global constant

API