Added pegjs

Which is going to replace uglify
This commit is contained in:
Jeremy Ruston
2011-12-28 18:03:07 +00:00
parent e27d5392a1
commit b27a99a7fb
13 changed files with 9459 additions and 0 deletions

22
node_modules/pegjs/examples/arithmetics.pegjs generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/*
* Classic example grammar, which recognizes simple arithmetic expressions like
* "2*(3+4)". The parser generated from this grammar then computes their value.
*/
start
= additive
additive
= left:multiplicative "+" right:additive { return left + right; }
/ multiplicative
multiplicative
= left:primary "*" right:multiplicative { return left * right; }
/ primary
primary
= integer
/ "(" additive:additive ")" { return additive; }
integer "integer"
= digits:[0-9]+ { return parseInt(digits.join(""), 10); }