'a''b''c' accepted, 'abc' not accepted.

Bug #273293 reported by Paul Ingemi
2
Affects Status Importance Assigned to Milestone
PyMeta
New
Undecided
Unassigned

Bug Description

Based on other OMeta platforms, I expected 'abc' to be the same as ('a' 'b' 'c') however the former doesn't work. The OMeta paper states:

"For convenience, OMeta accepts the syntax ’xyz’ (in single quotes) as shorthand for the sequence ’x’ ’y’ ’z’." (dls07 2.2)

From that description, I extended the definition of a character in PyMeta like so:

character ::= ( <token "'"> (<escapedChar> | <anything>):c <token "'"> => self.builder.exactly(c)
              | <token "'"> (<escapedChar> | ~('\'') <anything>)*:rs <token "'"> => self.builder.sequence([self.builder.exactly(x) for x in rs])
              )

That's a fairly literal translation based on the statement in dls07. The behavior of sequence in this context is somewhat unhelpful in that the result of a successful match will be the last character rather than the entire string. I'm not sure if other OMeta implementations behave this way or not.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.