The reason ragel seems to run endlessly is that you're getting a state explosion. The machine:
comment = '#' any* -- newline; Is not terminated with a newline. It's just a string that starts with '#' and cannot contain a newline. When you put this in front of alnum (in bulk?) you create an ambiguity that is costly for ragel to implement with a deterministic state machine. Do this instead: comment = '#' (any* -- newline) newline; Or use :>> as you suggested. Cheers, Adrian [email protected] wrote: > Hi > > When using this scanner (I removed actions), ragel seems to loop endless. > > %%{ > machine configuration_parser; > include scanner_common "scanner.rl"; > > newline = '\r'? '\n'; > > comment = '#' any* -- newline; > > bulk = ([\t\v\f\ ] | comment | newline)+; > > key = bulk? (alnum ([\_\.]? alnum)*); > > value = bulk? "\"" any* :>> "\""; > > values = bulk? value (bulk? ',' value)*; > > assign = key bulk? '=' values; > > main := assign* bulk?; > }%% > > > > But I works like a charm when: > > comment = '#' any* -- newline; > > become: > > comment = '#' any* :>> newline; > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > ragel-users mailing list > [email protected] > http://www.complang.org/mailman/listinfo/ragel-users _______________________________________________ ragel-users mailing list [email protected] http://www.complang.org/mailman/listinfo/ragel-users
