[Ometa] Problem with an attribute rule

Rüdiger Plantiko ruediger.plantiko at astrotexte.ch
Wed Mar 24 09:26:34 PDT 2010


Hello Justin,

I had also found out (and it was mentioned in Alex' diss, btw) that the
negation doesn't consume characters from the stream. This was easy to
resolve by adding the rule "anything" after the negation condition:

valueChar = '\\' '"' -> '\\"' | ~'"' anything,

You see, only the second alternative contains a negation. I supplemented
the negation with "anything":

~'"' anything

If the not-test fails, the rule fails already. If it passes, the following
"anything" will eat the character.

This works fine. When I test the valueChar rule itself, the matching and
non-matching works as expected. The problem somehow arises in combination
with the att rule at the end. I still have no clue what's happening.

ometa M {
  name  = ( '_' | letterOrDigit )+:n -> n.join(''),
  valueChar = '\\' '"' -> '\\"' | ~'"' anything,
  value = '"' valueChar*:v '"' -> v.join(''),
  att   = name:n spaces '=' spaces value:v -> n + ':"' + v + '"'
  }

Regards,
Rüdiger





More information about the OMeta mailing list