Text syntax parser/loader
Added string quites around text containing spaces Added support for colon in text
This commit is contained in:
parent
2ece0b8f51
commit
820ed5686b
5 changed files with 116 additions and 14 deletions
|
|
@ -75,7 +75,8 @@ int clixon_text_syntax_parsewrap(void)
|
|||
|
||||
%}
|
||||
|
||||
%s COMMENT
|
||||
%x COMMENT
|
||||
%x STRING
|
||||
|
||||
%%
|
||||
|
||||
|
|
@ -89,8 +90,8 @@ int clixon_text_syntax_parsewrap(void)
|
|||
<INITIAL>\[ { return *yytext; }
|
||||
<INITIAL>\] { return *yytext; }
|
||||
<INITIAL>\; { return *yytext; }
|
||||
<INITIAL>\: { return *yytext; }
|
||||
<INITIAL>[^\n\r \t\[\]\{\}\;\:]+ {
|
||||
<INITIAL>\" { _TS->ts_lex_state =INITIAL; BEGIN(STRING); return *yytext; }
|
||||
<INITIAL>[^\n\r \t\[\]\{\}\;\"]+ {
|
||||
clixon_text_syntax_parselval.string = strdup(yytext);
|
||||
return TOKEN; }
|
||||
<INITIAL>. { return -1; }
|
||||
|
|
@ -99,6 +100,11 @@ int clixon_text_syntax_parsewrap(void)
|
|||
<COMMENT><<EOF>> { return MY_EOF; }
|
||||
<COMMENT>[^\n]+
|
||||
|
||||
<STRING>\" { BEGIN(_TS->ts_lex_state); return *yytext; }
|
||||
<STRING>[^\n\r\"]+ { clixon_text_syntax_parselval.string = strdup(yytext);
|
||||
return TOKEN; }
|
||||
<STRING>. { return -1; }
|
||||
|
||||
%%
|
||||
|
||||
/*! Initialize XML scanner.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue