feat(Parser): implement Parser

Add a simple parser implementation that supports only field reads.
This commit is contained in:
vsavkin
2014-10-28 12:22:38 -04:00
parent acd7035347
commit 01e6c7b70c
11 changed files with 305 additions and 74 deletions

View File

@ -39,6 +39,9 @@ class ListWrapper {
static forEach(list, fn) {
list.forEach(fn);
}
static reduce(List list, Function fn, init) {
return list.fold(init, fn);
}
static first(List list) => list.first;
static last(List list) => list.last;
static List reversed(List list) => list.reversed.toList();

View File

@ -60,6 +60,9 @@ export class ListWrapper {
}
return null;
}
static reduce(list:List, fn:Function, init) {
return list.reduce(fn, init);
}
static filter(array, pred:Function) {
return array.filter(pred);
}