GithubHelp home page GithubHelp logo

js-parse's People

Contributors

kkoch986 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

platinumazure

js-parse's Issues

Exclude from production

Currently, excludeFromProduction is only true or false, would be cool to allow specification of the circumstances under which it should be excluded.

For example, in regex,

 { 
    head: "REW.REX.RANGE",
    body: 
    [ 
        { head: "REW.REX.CHAR",
          body: [ { type: 'REW.REX.NONMETACHAR', value: '0' }, [length]: 1 ] },
        { type: 'REW.REX.-', value: '-' },
        { head: 'REW.REX.CHAR',
          body: [ { type: 'REW.REX.NONMETACHAR', value: '9' }, [length]: 1 ] },
        [length]: 3 
    ] 
}

Would like to exclude the "-" here but potentially not in other places.

This would also necessitate an includeInProductions which carries out the inverse effect, excluding from all but the specified productions.

Fix tests

some rapid updating has caused the tests to fall into disrepair. would like to fix them asap.

Fix tests

A bunch of tests were broken when conflict detection was added since some of the test cases used grammars which contained conflicts.

better error messages for bad parser descriptions

has set a production as

"X":[ "Y" ]

instead of

"X":[ ["Y"] ]

And the error was very unclear:

TypeError: Cannot read property '*e*' of undefined
      at Object.computeFirstSetForGrammar (/home/ken/Documents/projects/js-parse/lib/parser/utils/first_set.js:82:31)
      at CreateLRParser (/home/ken/Documents/projects/js-parse/lib/parser/lr_parser.js:146:42)
      at Object.CreateLRParserWithLexer [as CreateWithLexer] (/home/ken/Documents/projects/js-parse/lib/parser/lr_parser.js:62:15)
      at Context.<anonymous> (/home/ken/Documents/projects/js-parse/examples/php/spec/tokens_spec.js:10:25)
      at callFn (/usr/local/lib/node_modules/mocha/lib/runnable.js:249:21)
      at Test.Runnable.run (/usr/local/lib/node_modules/mocha/lib/runnable.js:242:7)
      at Runner.runTest (/usr/local/lib/node_modules/mocha/lib/runner.js:373:10)
      at /usr/local/lib/node_modules/mocha/lib/runner.js:451:12
      at next (/usr/local/lib/node_modules/mocha/lib/runner.js:298:14)
      at /usr/local/lib/node_modules/mocha/lib/runner.js:308:7
      at next (/usr/local/lib/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:275:5)
      at processImmediate [as _immediateCallback] (timers.js:336:15)

Merge into parent

in reference to the comments on #4, would like to build a mergeIntoParent option for terminals which causes all of their children to be given as arguments to the parent and the symbol to be excluded from the production.

run jslint

im sure there will be a litany of things to fix....

selective merge into parent

related to #4, would be good to be able to define a time to apply merge into parent.

Ideally this would be defined in the parent rather than the child.

solve issue of overlapping terminals

big problem in the lexer currently, consider a digit which would match [0-9] and a non-zero-digit which would match [1-9].

Solution i initially went with was to create terminals which created unique ranges i.e. zero and one_through_nine and wrote digit and non-zero-digit as productions like

digit -> zero | one_through_nine
non-zero-digit -> one_through_nine

This is a working solution, but far from ideal in my opinion. What im currently considering is modifying the production definition to allow constraints, but this is leading to reduce-reduce conflicts because the name of the token still matches as digit (in a slightly more complex case).

Going to keep working on the second solution, but also looking for a third.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.