mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
waypoint -- jison has a reverse order of operations from yacc
This commit is contained in:
parent
7c01bba4f4
commit
13c49ad865
5 changed files with 9 additions and 9 deletions
|
@ -556,7 +556,7 @@
|
|||
parser = new Parser({
|
||||
tokens: tokens,
|
||||
bnf: bnf,
|
||||
operators: operators,
|
||||
operators: operators.reverse(),
|
||||
startSymbol: 'Root'
|
||||
}, {
|
||||
debug: false
|
||||
|
|
|
@ -188,15 +188,15 @@
|
|||
// toString representation of the node, for inspecting the parse tree.
|
||||
Node.prototype.toString = function toString(idt) {
|
||||
var __a, __b, __c, child;
|
||||
idt = idt || '';
|
||||
return (this.type || 'anon') + "\n" + ((function() {
|
||||
idt = (idt || '') + TAB;
|
||||
return this.type + "\n" + ((function() {
|
||||
__a = []; __b = this.children;
|
||||
for (__c = 0; __c < __b.length; __c++) {
|
||||
child = __b[__c];
|
||||
__a.push(idt + TAB + child.toString(idt + TAB));
|
||||
__a.push(idt + child.toString(idt));
|
||||
}
|
||||
return __a;
|
||||
}).call(this));
|
||||
}).call(this)).join('');
|
||||
};
|
||||
// Default implementations of the common node methods.
|
||||
Node.prototype.unwrap = function unwrap() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -458,7 +458,7 @@ for name, non_terminal of grammar
|
|||
option[1] = "return " + option[1]
|
||||
option
|
||||
tokens: tokens.join(" ")
|
||||
parser: new Parser({tokens: tokens, bnf: bnf, operators: operators, startSymbol: 'Root'}, {debug: false})
|
||||
parser: new Parser({tokens: tokens, bnf: bnf, operators: operators.reverse(), startSymbol: 'Root'}, {debug: false})
|
||||
|
||||
# Save the parser to a file.
|
||||
# puts parser.generate()
|
||||
|
|
|
@ -105,8 +105,8 @@ Node::contains: (block) ->
|
|||
|
||||
# toString representation of the node, for inspecting the parse tree.
|
||||
Node::toString: (idt) ->
|
||||
idt ||= ''
|
||||
(@type || 'anon') + "\n" + (idt + TAB + child.toString(idt + TAB) for child in @children)
|
||||
idt: (idt || '') + TAB
|
||||
@type + "\n" + (idt + child.toString(idt) for child in @children).join('')
|
||||
|
||||
# Default implementations of the common node methods.
|
||||
Node::unwrap: -> this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue