mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
waypoint ... somethings still a little off with the parser
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
(function(){
|
||||
var Parser, __a, __b, __c, __d, __e, __f, bnf, grammar, name, non_terminal, o, operators, option, parser, part, posix, tokens, unwrap;
|
||||
var Parser, __a, __b, __c, __d, __e, __f, bnf, grammar, js, name, non_terminal, o, operators, option, parser, part, posix, tokens, unwrap;
|
||||
var __hasProp = Object.prototype.hasOwnProperty;
|
||||
Parser = require('jison').Parser;
|
||||
// DSL ===================================================================
|
||||
@@ -24,14 +24,20 @@
|
||||
return new Expressions();
|
||||
}), o("TERMINATOR", function() {
|
||||
return new Expressions();
|
||||
}), o("Expressions"), o("Block TERMINATOR")
|
||||
}), o("Expressions", function() {
|
||||
return $1;
|
||||
}), o("Block TERMINATOR", function() {
|
||||
return $1;
|
||||
})
|
||||
],
|
||||
// Any list of expressions or method body, seperated by line breaks or semis.
|
||||
Expressions: [o("Expression", function() {
|
||||
return Expressions.wrap([$1]);
|
||||
}), o("Expressions TERMINATOR Expression", function() {
|
||||
return $1.push($3);
|
||||
}), o("Expressions TERMINATOR")
|
||||
}), o("Expressions TERMINATOR", function() {
|
||||
return $1;
|
||||
})
|
||||
],
|
||||
// All types of expressions in our language. The basic unit of CoffeeScript
|
||||
// is the expression.
|
||||
@@ -558,10 +564,11 @@
|
||||
}, {
|
||||
debug: false
|
||||
});
|
||||
js = parser.generate();
|
||||
// Save the parser to a file.
|
||||
// puts parser.generate()
|
||||
posix = require('posix');
|
||||
posix.open('lib/coffee_script/parser.js', process.O_CREAT | process.O_WRONLY, 0755).addCallback(function(fd) {
|
||||
return posix.write(fd, parser.generate());
|
||||
return posix.write(fd, js);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user