lib/ebnf/native.rb in ebnf-2.4.0 vs lib/ebnf/native.rb in ebnf-2.5.0

- old
+ new

@@ -31,10 +31,11 @@ cur_lineno += s.count("\n") debug("eachRule(comment)") { "[#{cur_lineno}] #{s.inspect}" } when s = scanner.scan(/\A["']/) # Found a quote, scan until end of matching quote s += scanner.scan_until(/#{scanner.matched}|$/) + s.quote_style = scanner.matched == "'" ? :squote : :dquote r += s when s = scanner.scan(%r(^@terminals)) #debug("eachRule(@terminals)") { "[#{cur_lineno}] #{s.inspect}" } yield(r) unless r.empty? @lineno = cur_lineno @@ -285,14 +286,14 @@ s = s.strip #STDERR.puts s.inspect case m = s[0,1] when '"', "'" # STRING1 or STRING2 l, s = s[1..-1].split(m.rstrip, 2) - [Unescape.unescape_string(l), s] + [Unescape.unescape(l).tap {|str| str.quote_style = (m == "'" ? :squote : :dquote)}, s] when '[' # RANGE, O_RANGE # Includes RANGE and O_RANGE which can't include a ']' l, s = s[1..-1].split(']', 2) - [[:range, Unescape.unescape_string(l)], s] + [[:range, Unescape.unescape(l)], s] when '#' # HEX s.match(/(#x\h+)(.*)$/) l, s = $1, $2 [[:hex, l], s] when /[\w\.]/ # SYMBOL \ No newline at end of file