mjackson / citrus

Parsing Expressions for Ruby

Home Page:http://mjackson.github.io/citrus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected behavior for names method

djwonk opened this issue · comments

grammar Alias
  rule something
    digit
  end

  rule digit
    [0-9]
  end
end

require 'rubygems'
require 'citrus'
Citrus.load('alias')
m = Alias.parse('1')

puts m.names
# => [:digit]
# I would expect...
# => [:something, :digit]

The current behavior makes it look as if 'something' did not match at all.

Match#names has been removed from the current release, so this example no longer works. However, this particular behavior is still the same.

When you get a Match object back from something, it results from the execution of digit, since something is an alias for digit. There is no match object to wrap this object since none is needed. In other words, the match object that you get back from executing something is from the perspective of something.

Closing this ticket because this method is no longer supported.