Testing beginning of line in a scanner

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


Hi,

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;
    special;
    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'
failed
error.

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?

Thanks,



More information about the ragel-users mailing list