lib/citrus/file.rb in citrus-1.2.2 vs lib/citrus/file.rb in citrus-1.3.0
- old
+ new
@@ -72,11 +72,11 @@
def choices
@choices ||= [ sequence ] + choice.sequences
end
def values
- choices.map {|s| s.value }
+ choices.map {|c| c.value }
end
def value
choices.length > 1 ? Choice.new(values) : values[0]
end
@@ -135,15 +135,11 @@
end
}
end
rule :primary do
- any(:super, :alias, :rule_body_paren, :terminal) {
- def value
- first.value
- end
- }
+ any(:super, :alias, :rule_body_paren, :terminal)
end
rule :rule_body_paren do
all(:lparen, :rule_body, :rparen) {
def value
@@ -203,11 +199,11 @@
end
rule :terminal do
any(:quoted_string, :character_class, :anything_symbol, :regular_expression) {
def value
- Rule.create(first.value)
+ Rule.create(super)
end
}
end
rule :quoted_string do
@@ -241,15 +237,11 @@
end
}
end
rule :qualifier do
- any(:and, :not, :label) {
- def wrap(rule)
- first.wrap(rule)
- end
- }
+ any(:and, :not, :label)
end
rule :and do
all('&', :space) {
def wrap(rule)
@@ -279,11 +271,11 @@
end
rule :extension do
any(:tag, :block) {
def wrap(rule)
- rule.ext = first.value
+ rule.ext = value
rule
end
}
end
@@ -303,12 +295,9 @@
}
end
rule :quantifier do
any(:question, :plus, :repeat) {
- def min; first.min end
- def max; first.max end
-
def wrap(rule)
Repeat.new(min, max, rule)
end
}
end