Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed arithmetic sequense parser/ast

  • Loading branch information...
commit 866cbfb80a59415fec4026338630ff65e087e042 1 parent 84e27a5
@phyrex1an phyrex1an authored
Showing with 6 additions and 3 deletions.
  1. +1 −1  haskell.ast.js
  2. +5 −2 haskell.parser.js
View
2  haskell.ast.js
@@ -202,7 +202,7 @@
var funname = 'enumFrom';
if (this.e2) funname = funname + 'Then';
if (this.e3) funname = funname + 'To';
- var application = new ast.Application(ast.VariableLookup(funname), this.e1);
+ var application = new ast.Application(new ast.VariableLookup(funname), this.e1);
if (this.e2) application = new ast.Application(application, this.e2);
if (this.e3) application = new ast.Application(application, this.e3);
return application;
View
7 haskell.parser.js
@@ -406,7 +406,10 @@
}
var aexp_arithmetic_action = function(p) {
- return action(p, function(ast) {
+ return action(p, function(ast) {
+ if (ast[1]) {
+ ast[1] = ast[1][0];
+ }
return new haskell.ast.ArithmeticSequence(ast[0], ast[1], ast[2]);
});
}
@@ -431,7 +434,7 @@
aexp_tuple_action(sequence(expectws('('), ws(exp), repeat1(sequence(ws(','), ws(exp))) , expectws(')'))), // tuple
list_action(sequence(expect(ws('[')), optional(wlist(exp, ',')), expect(ws(']')))), // list constructor
left_section_action(sequence(expect(ws('(')), ws(infixexp), ws(qop), expect(ws(')')))), // left section
- right_section_action(sequence(expect(ws('(')), ws(qop), ws(infixexp), expect(ws(')')))), // right section, todo: look into resolution of infixexp in this case, see Haskell Report Chapter 3
+ right_section_action(sequence(expect(ws('(')), ws(qop), ws(infixexp), expect(ws(')')))), // right section, todo: look into resolution of infixexp in this case, see Haskell Report Chapter 3
aexp_arithmetic_action(sequence(expectws('['), ws(exp), optional(sequence(expectws(','), ws(exp))), expectws('..'), optional(ws(exp)), expectws(']'))), // arithmetic sequence
aexp_list_comp_action(sequence(expectws('['), ws(exp), expectws('|'), list(qual, ws(',')), expectws(']'))) // list comprehension
// Todo:
Please sign in to comment.
Something went wrong with that request. Please try again.