Commits

Kaspar Schiess committed 4eac92e

Cleanup of alternation example

Comments (0)

Files changed (1)

examples/alternation.rb

 require 'par'
 include Par
 
-def integer source
-  source.pattern(/\+|-/).maybe >>
-    source.pattern(/\d+/)
+def integer s
+  s.cr {
+    s.pattern(/\+|-/).maybe >>
+      s.pattern(/\d+/)
+  }
 end
 def float s
   s.cr {
   }
 end
 def element s
-  p(float(s)) | p(integer(s))
+  float(s) | integer(s)
 end
 
 %w(