Permalink
Browse files

Added infix operator notation like in haskell.

  • Loading branch information...
1 parent 579e845 commit 5e3df7ec072975ae58cc021657bbc113ba63f20b @vic committed Sep 21, 2011
Showing with 4,823 additions and 4,639 deletions.
  1. +5 −1 lib/akin/grammar.kpeg
  2. +4,770 −4,634 lib/akin/grammar.rb
  3. +5 −1 lib/akin/operator.rb
  4. +5 −1 lib/akin/shuffle.rb
  5. +19 −2 spec/grammar_spec.rb
  6. +19 −0 spec/shuffle_spec.rb
View
@@ -76,10 +76,14 @@ parts(x) = parts(x):a - part(x):b {a + [b]}
kmsg(x) = parts(x):a ~n(a.first.pos, :kmsg, *a)
-literal(x) = symbol(x) | str | float | fixnum | regexp | name | oper
+literal(x) = symbol(x) | infix | str | float | fixnum | regexp | name | oper
symbol(x) = p:p ":" !&":" value(x.kmsg):v ~n(p, :symbol, v.first)
+infix_ = <"#"+> !&(brace|"!") {text.size} | {0}
+infix = p:p infix_:l <name|oper> infix_:r &{ l+r > 0 }
+ ~n(p, :infix, text, l, r)
+
regexp = p:p quoted(:text, & "/"):b ~n(p, :regexp, text_node(p, b))
float = p:p sign:s dec:n "." dec:f ~n(p, :float, (s+n+"."+f).to_f)
Oops, something went wrong.

0 comments on commit 5e3df7e

Please sign in to comment.