CS Parser

Class: Parser

Parser(Rl)

Context sensitive parser

Constructor

new Parser(Rl)

Parameters:
Name Type Default Description
Rl object | Rule null

The root rule

Source:
Parser.js, line 9

Methods

addRule(Rl) → Rule

Adds a new rule

Parameters:
Name Type Description
Rl object | Rule

The rule to add

Source:
Parser.js, line 25
Returns:

The Rule object which has peen added

Type:
Rule

addRules(Rls) → Array.<Rule>

Adds multiple new rules

Parameters:
Name Type Description
Rls Array.<object> | Array.<Rule>

An array of the rules to add

Source:
Parser.js, line 36
Returns:

An array of Rule objects which have been added

Type:
Array.<Rule>

protectedonComplete(Cx)

Parameters:
Name Type Description
Cx Context

The finished context

Source:
Parser.js, line 114

protectedonStart(Cx)

Parameters:
Name Type Description
Cx Context

The root context

Source:
Parser.js, line 104

parse(Data) → Context

Parses the data specified as a string or Buffer. After the parsing completed, returns the root context which contains all the generated sub-contexts through the entire parsing

Parameters:
Name Type Description
Data string | Buffer

The data to be parsed

Source:
Parser.js, line 49
Returns:

The root context

Type:
Context

parseFile(Url, Opt) → Promise

Parses a file asynchronously

Parameters:
Name Type Default Description
Url string

The file URL

Opt object null

Streaming options

Source:
Parser.js, line 67
See:
https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options
Returns:

A Promise that will resolve when the parsing completes. You can get the root context as the 1st parameter of a callback which you can pass to .then()

Type:
Promise

© 2018 Satoshi Soma

Licensed under the Apache License 2.0

Documentation generated by JSDoc 3.6.11 using Docolatte theme on Tue, 05 Sep 2023 18:54:56 GMT

    Hint: You don't need to click on the search box to input.

    Just start typing your words at any time to search for it.

    Classes

    • Composite
      • addChild
      • addChildren
      • traverse
      • verifyChild
    • Context
      • addChild
      • addChildren
      • cleanupChildren
      • clearBuffer
      • end
      • outline
      • parseChunk
      • populate
      • start
      • step
      • traverse
      • updateState
      • verifyChild
    • ContextManager
      • feed
    • Main
      • create
      • newRule
    • Parser
      • addRule
      • addRules
      • onComplete
      • onStart
      • parse
      • parseFile
    • ResultSet
      • add
      • traverse
    • Rule
      • addChild
      • addChildren
      • endsWith
      • express
      • fin
      • init
      • on
      • parse
      • startsWith
      • traverse
      • verifyChild