Testing beginning of line in a scanner

mitchell mforal.n... at gmail.com
Sat May 31 19:41:48 UTC 2008


I'm trying to test for a character that occurs only at the beginning
of a line in a scanner:

  special = '!' when starts_line @callback;
  line := |*
    [\t ]+ => callback;
    newline => callback;
    '!' when not_starts_line => callback;
    ^(space | '!') => callback;

I get a
  ragel: fsmgraph.h:385: TransAp::TransAp(const TransAp&): Assertion
  `lmActionTable.length() == 0 && other.lmActionTable.length() == 0'

If I remove the "'!' when not_starts_line" line, Ragel compiles, but I
cannot detect any '!'s in a place other than the beginning of a line
which is no good.

Any ideas?


More information about the ragel-users mailing list