1 ! Copyright (C) 2008 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: kernel tools.test peg peg.javascript.ast peg.javascript.parser
5 accessors sequences math peg.ebnf peg.ebnf.private ;
6 IN: peg.javascript.parser.tests
14 T{ ast-string f "hello" }
19 V{ T{ ast-get f "x" } }
24 "123; 'hello'; foo(x);" javascript
31 """ main \ javascript rule (parse) remaining>> length zero?
37 function foldl(f, initial, seq) {
38 for(var i=0; i< seq.length; ++i)
39 initial = f(initial, seq[i]);
41 }""" main \ javascript rule (parse) remaining>> length zero?
46 ParseState.prototype.from = function(index) {
47 var r = new ParseState(this.input, this.index + index);
49 r.length = this.length - index;
51 }""" main \ javascript rule (parse) remaining>> length zero?