Comments (3)
When trying to import either a generated parser or jison itself in an Angular 7 project I get errors about the lack of node modules fs and path:
Module not found: Error: Can't resolve 'fs'
Module not found: Error: Can't resolve 'path'
I can get the generated parser to work by removing the two lines referencing fs and path, but there must be a better way, especially so that one could use the jison npm package.
from jison.
You can use the option moduleType
as follows:
parser.generate({ moduleName: 'moduleName', moduleType: 'js' })
It will generate the parser without those lines. Be careful with the lexer βif you are using a custom oneβ and custom functionality that you pass through the 'yy' object.
- If the lexer is a custom one, it should contain the method
generateModule
so it can generate the rules on the output parser. If it doesn't, it won't work. - Whatever you pass to the 'yy' is overwritten on the generation with
yy: {}
, so you'll need to add it manually.
from jison.
@mluis jison currently only supports commonjs/amd module or global variable. listed here https://github.com/zaach/jison#usage-from-the-command-line.
Unfortunately it doesn't support es6 module and if you want it the es6 way, you can write a small script to append one line
export default <parserName>;
at the bottom of file.
so that you can do import Parser from 'path-to-generated-parser-file'
in your angular code.
from jison.
Related Issues (20)
- jison: command not found HOT 1
- %empty directive doesn't execute semantic actions, /* empty */ does HOT 2
- Using "constructor" as a literal causes a parse error
- Try online version should be updated to the latest current version
- It generates incorrect FOLLOWs and parsing table when using LL(1) algorithm.
- Security issue HOT 8
- Security Notice & Bug Bounty - Command Injection - huntr.dev HOT 1
- Create jison grammar
- Jison not assuming correct grammar HOT 1
- Generating code from parser result and grammar
- Missing tag
- Insufficient input validation in npm package jison <= 0.4.18 may lead to OS command injection attacks.
- A pathological example that blows up
- Tests generate SyntaxError: Function statements require a function name HOT 2
- Docs are offline HOT 7
- LALR(1) implementation is not LALR(1)
- Yacc/Lex compatible online editor/tester
- EOF token is returned only once in recursive grammar
- Enhance `showPosition()` to Accurately Display Error Position by Line Number
- Bug in docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jison.