[ragel-users] Testing beginning of line in a scanner
Adrian Thurston
thurs... at cs.queensu.ca
Sun Jun 1 19:12:03 UTC 2008
Hey Mitchell, I just checked in a fix for this. Also, you might want to
try "when !starts_line" to enforce the negative sense of a condition.
This will prevent not_starts_line from being executed right after
starts_line to get the same info only negated.
-Adrian
mitchell wrote:
> 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,
> -Mitchell;
> >
>
More information about the ragel-users
mailing list