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 multiline sequences math peg.ebnf ;
6 IN: peg.javascript.parser.tests
8 \ javascript must-infer
16 T{ ast-string f "hello" }
21 V{ T{ ast-get f "x" } }
26 "123; 'hello'; foo(x);" javascript
33 "> main \ javascript rule (parse) remaining>> length zero?
39 function foldl(f, initial, seq) {
40 for(var i=0; i< seq.length; ++i)
41 initial = f(initial, seq[i]);
43 }"> main \ javascript rule (parse) remaining>> length zero?
48 ParseState.prototype.from = function(index) {
49 var r = new ParseState(this.input, this.index + index);
51 r.length = this.length - index;
53 }"> main \ javascript rule (parse) remaining>> length zero?