[ragel] sample code

xoru xoru at onet.pl
Mon Feb 5 12:06:51 UTC 2018


How put "a ab abc \t abcd\n abcde"
and get
'a'
'ab'
'abc'
'abcd'
'abcde'
When i use main := (space* wyraz )* i get only chars not words
/* @LANG: c */ #include <stdio.h> #include <string.h> %%{ machine foo; action beginning { pocz = p; } action ending { printf("'%.*s'\n",(int)(p - pocz), pocz); } wyraz = [a-z]+ >beginning %ending; main := ( space* wyraz ) ; write data noerror nofinal; }%% int main(int argc, char **argv) { int cs = 0; char *pocz; if (argc > 1) { char *p = argv[1]; char *pe = p + strlen(p); char *eof = pe; %%write init; %%write exec; } return 0; }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20180205/55c90fdb/attachment-0002.html>


More information about the ragel-users mailing list