Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix up examples

  • Loading branch information...
commit 374b3f5d61109a6fb892433dad53b2bd23292704 1 parent 7991e1c
@zaach authored
Showing with 10 additions and 16 deletions.
  1. +1 −1  examples/README
  2. +5 −8 examples/json.js
  3. +4 −7 examples/json_ast.js
View
2  examples/README
@@ -1,2 +1,2 @@
Use Jison to generate parsers from an example, e.g.:
- $ ../bin/jison basic_lex.jison
+ $ node ../lib/cli.js basic_lex.jison
View
13 examples/json.js
@@ -1,4 +1,4 @@
-var Generator = require("jison").Generator;
+var Generator = require("../lib/jison").Generator;
exports.grammar = {
"comment": "ECMA-262 5th Edition, 15.12.1 The JSON Grammar.",
@@ -66,14 +66,11 @@ exports.grammar = {
var options = {type: "slr", moduleType: "commonjs", moduleName: "jsoncheck"};
-exports.main = function main (args) {
- var fs = require("file"),
- cwd = fs.path(fs.cwd()),
- code = new Generator(exports.grammar, options).generate(),
- stream = cwd.join(options.moduleName+".js").open("w");
- stream.print(code).close();
+exports.main = function main () {
+ var code = new Generator(exports.grammar, options).generate();
+ console.log(code);
};
if (require.main === module)
- exports.main(require("system").args);
+ exports.main();
View
11 examples/json_ast.js
@@ -1,4 +1,4 @@
-var Generator = require("jison").Generator;
+var Generator = require("../lib/jison").Generator;
exports.grammar = {
"comment": "ECMA-262 5th Edition, 15.12.1 The JSON Grammar. Parses JSON strings into objects.",
@@ -70,13 +70,10 @@ exports.grammar = {
var options = {type: "slr", moduleType: "commonjs", moduleName: "jsonparse"};
exports.main = function main (args) {
- var fs = require("file"),
- cwd = fs.path(fs.cwd()),
- code = new Generator(exports.grammar, options).generate(),
- stream = cwd.join(options.moduleName+".js").open("w");
- stream.print(code).close();
+ var code = new Generator(exports.grammar, options).generate();
+ console.log(code);
};
if (require.main === module)
- exports.main(require("system").args);
+ exports.main();
Please sign in to comment.
Something went wrong with that request. Please try again.