<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 14pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi,</p>
<p>It's because space* accepts the zero-length string. So "abc" is actually three words with zero-length whitespace in between. Well, technically it's both that and what you want, so you need to remove the ambiguity. What you need is more like this:</p>
<p>space* wyraz ( space+ wyraz )*</p>
<p>-Adrian</p>
<p>On 2018-02-05 07:06, xoru wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div>
<pre>How put "a ab abc \t abcd\n  abcde"<br />and get<br />'a'<br />'ab'<br />'abc'<br />'abcd'<br />'abcde'<br /><br />When i use main :=  (space* wyraz )* i get only chars not words<br /><br />/* @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;
}</pre>
</div>
<br />
<pre>_______________________________________________
ragel mailing list
<a href="mailto:ragel@colm.net">ragel@colm.net</a>
<a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel">http://www.colm.net/cgi-bin/mailman/listinfo/ragel</a>
</pre>
</blockquote>
</body></html>