diff options
author | sanine <sanine.not@pm.me> | 2023-02-07 17:52:17 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-07 17:52:17 -0600 |
commit | 79f4b0d33cbb490f957d081bd7c8bc97bd4c689c (patch) | |
tree | be04a0dd98ca341a46bd65cf400a20e1c66f3563 /yy/kalmia.l | |
parent | f547164540f4ac7f8436fef8e981b1fef503f08c (diff) |
fix parser using REJECT so that example works
Diffstat (limited to 'yy/kalmia.l')
-rw-r--r-- | yy/kalmia.l | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/yy/kalmia.l b/yy/kalmia.l index 85f68e3..42ab9e1 100644 --- a/yy/kalmia.l +++ b/yy/kalmia.l @@ -1,7 +1,7 @@ -%option noinput nounput noyywrap 8bit nodefault +%option noinput nounput noyywrap noreject 8bit %option reentrant bison-bridge bison-locations %option prefix="kalmia" -%start STRING TAG +%start STRING TAG_START TAG %{ #include <string.h> @@ -39,18 +39,19 @@ ATTR ([\x20\x0a\x0d\x09]*)?"=" } -<INITIAL>"<" { BEGIN(TAG); return S_TAG_OPEN; } -<INITIAL>"</" { BEGIN(TAG); return E_TAG_OPEN; } +<INITIAL>"<" { BEGIN(TAG_START); return S_TAG_OPEN; } +<INITIAL>"</" { BEGIN(TAG_START); return E_TAG_OPEN; } <TAG>">" { BEGIN(INITIAL); return TAG_CLOSE; } <TAG>"/>" { BEGIN(INITIAL); return EMPTY_TAG_CLOSE; } -<TAG>[a-zA-Z_:][a-zA-Z0-9\.\-_:]* { +<TAG_START>[a-zA-Z_:][a-zA-Z0-9\.\-_:]* { /* generic tag name */ + BEGIN(TAG); yylval->string = strdup(yytext); return NAME; } -<TAG>[a-zA-Z_:][a-zA-Z0-9\.\-_:]*/{ATTR} { +<TAG>[a-zA-Z_:][a-zA-Z0-9\.\-_:]* { /* generic attribute key */ yylval->string = strdup(yytext); return ATTR; |