Skip to content

Commit

Permalink
Down to 90/29
Browse files Browse the repository at this point in the history
  • Loading branch information
Josep M. Bach committed Jan 24, 2012
1 parent 68757ed commit b034f03
Show file tree
Hide file tree
Showing 2 changed files with 331 additions and 394 deletions.
12 changes: 4 additions & 8 deletions lib/noscript/parser/noscript.y
Expand Up @@ -98,21 +98,17 @@ rule
;

Array:
'[' ArrayList ']' { result = ArrayLiteral.new(lineno, val[1]) }
'[]' { p 'parsing empty array!'; result = ArrayLiteral.new(lineno, []) }
| '[' ArrayList ']' { result = ArrayLiteral.new(lineno, val[1]) }
;

ArrayList:
/* nothing */ { result = [] }
| ArrayListElement { result = [val[0]] }
| ArrayList "," ArrayListElement { result = val[0] += [val[2]] }
| Expression { result = [val[0]] }
| ArrayList "," Expression { result = val[0] += [val[2]] }
| ArrayList Newline { result = val[0] }
;

ArrayListElement:
Expression { result = val[0] }
| Newline Expression { result = val[1] }
;

Tuple:
'{' TupleList '}' { result = HashLiteral.new(lineno, val[1].flatten) }
| '{' TupleList Newline '}' { result = HashLiteral.new(lineno, val[1].flatten) }
Expand Down

0 comments on commit b034f03

Please sign in to comment.