-^include{S}+[^" \t\r\n][\x20-\xff]*{S}*/\n {l();handleInclude(yytext, yyleng, 0);}
-{STRING} {l(); BEGIN(INITIAL);handleString(yytext, yyleng);return T_STRING;}
-{CDATA} {l(); BEGIN(INITIAL);handleCData(yytext, yyleng);return T_STRING;}
+^include{S}+[^" \t\xa0\r\n][\x20-\xff]*{S}*/\n {l();handleInclude(yytext, yyleng, 0);}
+{STRING} {l(); BEGIN(DEFAULT);handleString(yytext, yyleng);return T_STRING;}
+{CDATA} {l(); BEGIN(DEFAULT);handleCData(yytext, yyleng);return T_STRING;}
+
+<DEFAULT,BEGINNING,REGEXPOK>{
+{XMLCOMMENT} {l(); BEGIN(DEFAULT);handleRaw(yytext, yyleng);return T_STRING;}
+}
+
+<XML>{
+{XMLSTRING} {l(); handleRaw(yytext, yyleng);return T_STRING;}
+[{] {c(); BEGIN(REGEXPOK);return m('{');}
+[<] {c(); return m('<');}
+[/] {c(); return m('/');}
+[>] {c(); return m('>');}
+[=] {c(); return m('=');}
+{XMLID} {c(); handleRaw(yytext, yyleng);return T_IDENTIFIER;}
+{S} {l();}
+<<EOF>> {syntaxerror("unexpected end of file");}
+}
+
+<XMLTEXT>{
+[^<>{]+ {l(); handleRaw(yytext, yyleng);return T_STRING;}
+[{] {c(); BEGIN(REGEXPOK);return m('{');}
+[<] {c(); BEGIN(XML);return m('<');}
+[>] {c(); return m('>');}
+{XMLCOMMENT} {l(); handleRaw(yytext, yyleng);return T_STRING;}
+{CDATA} {l(); handleRaw(yytext, yyleng);return T_STRING;}
+<<EOF>> {syntaxerror("unexpected end of file");}
+}