Permalink
Browse files

* lib/racc/grammar.rb (separated_by): last commit was wrong. use opti…

…onal default return value of #option.

git-svn-id: file:///Users/aaron/Desktop/public/racc/trunk@3695 1b9489fe-b721-0410-924e-b54b9192deb8
  • Loading branch information...
1 parent dca110a commit d59522b5c830fe928f45b2f32be3459414023c73 aamine committed Feb 20, 2007
Showing with 8 additions and 6 deletions.
  1. +5 −0 ChangeLog
  2. +3 −6 lib/racc/grammar.rb
View
@@ -1,3 +1,8 @@
+Tue Feb 20 18:45:45 2007 Minero Aoki <aamine@loveruby.net>
+
+ * lib/racc/grammar.rb (separated_by): last commit was wrong. use
+ optional default return value of #option.
+
Tue Feb 20 18:27:48 2007 Minero Aoki <aamine@loveruby.net>
* lib/racc/grammar.rb (separated_by): return [] for empty list.
View
@@ -284,9 +284,9 @@ def action(&block)
alias _ action
- def option(sym, &block)
+ def option(sym, default = nil, &block)
_defmetasyntax("option", _intern(sym), block) {|target|
- seq() | seq(sym)
+ seq() { default } | seq(sym)
}
end
@@ -305,10 +305,7 @@ def many1(sym, &block)
end
def separated_by(sep, sym, &block)
- _defmetasyntax("separated_by", _intern(sym), block) {|target|
- seq() { [] }\
- | seq(target, sep, sym) {|list, _, x| list.push x; list }
- }
+ option(separated_by1(sep, sym), [], &block)
end
def separated_by1(sep, sym, &block)

0 comments on commit d59522b

Please sign in to comment.