Permalink
Browse files

modified ometa and js compilers to use <...> where appropriate

  • Loading branch information...
1 parent 1737db9 commit 2e4dae4e923aa191ab1a07656c864721e3b2dff5 @alexwarth alexwarth committed Jun 28, 2011
Showing with 15 additions and 20 deletions.
  1. +5 −6 bs-js-compiler.js
  2. +3 −5 bs-js-compiler.txt
  3. +4 −5 bs-ometa-compiler.js
  4. +3 −4 bs-ometa-compiler.txt
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,18 +1,16 @@
-ometa BSJSParser <: Parser {
- fromTo :x :y = seq(x) (~seq(y) char)* seq(y),
+ometa BSJSParser {
space = ^space | fromTo('//', '\n') | fromTo('/*', '*/'),
nameFirst = letter | '$' | '_',
nameRest = nameFirst | digit,
- iName = firstAndRest(#nameFirst, #nameRest):r -> r.join(''),
+ iName = <nameFirst nameRest*>,
isKeyword :x = ?BSJSParser._isKeyword(x),
name = iName:n ~isKeyword(n) -> [#name, n=='self' ? '$elf' : n],
keyword = iName:k isKeyword(k) -> [k, k],
hexDigit = char:x {this.hexDigits.indexOf(x.toLowerCase())}:v ?(v >= 0) -> v,
hexLit = hexLit:n hexDigit:d -> (n * 16 + d)
| hexDigit,
number = ``0x'' hexLit:n -> [#number, n]
- | digit+:ws ('.' digit+ | empty -> []):fs -> [#number, parseFloat(ws.join('') + '.' +
- fs.join(''))],
+ | <digit+ ('.' digit+)?>:f -> [#number, parseFloat(f)],
escapeChar = '\\' char:c -> unescape('\\' + c),
str = seq('"""') (escapeChar | ~seq('"""') char)*:cs seq('"""') -> [#string, cs.join('')]
| '\'' (escapeChar | ~'\'' char)*:cs '\'' -> [#string, cs.join('')]
Oops, something went wrong.

0 comments on commit 2e4dae4

Please sign in to comment.