/* Line number from bison */ %option yylineno %{ //====================================================== /** Zoo main configuration file parser **/ //====================================================== #include #include "main_conf_read.tab.h" static int affichetrace = 0 ; static int attentionImpossibleDeTrouverXMLDeclapres = 0 ; static int attentionImpossibleDeTrouverPIapres = 0 ; %} S [ \t\r\n]+ CharRef "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";" egalevolue {S}?"="{S}? Name ([_:]|[\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])(([\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])|[0-9.\-_:])* chardata [^<]* attname [a-zA-Z0-9_\-:]+ attvalue1 [,@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff]+ attvalue \"[^"]*\"|\'[^']*\' virgule [,]+ whitespace [ ]{0,} whitesp [ ] newline [\r\n]|[\n] newlines [\r\n]{1,}|[\n]{1,} %x DANSBALISE HORSBALISE PAIRSTART %% "\n" {if (affichetrace==1) printf ("\n\nNEWLINE\n") ; return NEWLINE;} {newline}+{whitesp}* {if (affichetrace==1) printf ("\n\nNEWLINE 1\n") ; return NEWLINE;} "["{attname}"]" {if (affichetrace==1) printf ("\n\nANID:%s\n",yytext); crlval.chaine=yytext;crlval.chaine[strlen(crlval.chaine)-1]=0;crlval.chaine+=1;return ANID; } {attname} {if (affichetrace==1) printf ("\n\nATT_NAME:%s\n",yytext); crlval.chaine=yytext; return SPAIR; } {attvalue1} {if (affichetrace==1) printf ("\n\nATT_VALUE:%s\n",yytext);crlval.chaine=yytext;BEGIN(INITIAL);return EPAIR;} {whitesp}*"="{whitesp}* {BEGIN(PAIRSTART);} {newline}+{whitesp}* {if (affichetrace==1) printf ("\n\nNEWLINE 2\n") ; BEGIN(INITIAL); return NEWLINE;} ""version"{egalevolue}\"1.0\"|"version"{egalevolue}\'1.0\' {if (affichetrace==1) printf ("\n\nVERSIONDECL:%s\n",yytext) ;return VERSIONDECL;} "version"{egalevolue}\"[^"]*\"|"version"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : XML Version not supported : %s\n",yylineno,yytext); exit (9) ; } "encoding"{egalevolue}\"[Ii][Ss][Oo]"-8859-1"\"|"encoding"{egalevolue}\'[Ii][Ss][Oo]"-8859-1"\' {if (affichetrace==1) printf ("\n\nENCODINGDECL:%s\n",yytext) ; return ENCODINGDECL;} "encoding"{egalevolue}\"[^"]*\"|"encoding"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : encoding version not supported : %s\n",yylineno,yytext); exit (8) ; } "standalone"{egalevolue}\"yes\"|"standalone"{egalevolue}\'yes\'|"standalone"{egalevolue}\"no\"|"standalone"{egalevolue}\'no\' {if (affichetrace==1) printf ("\n\nSDDECL:%s\n",yytext) ; return SDDECL;} "standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\'|"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\' {/* erreur de version encoding */ printf("\nerror : LINE %d : standalone version not supported : %s\n",yylineno,yytext); exit (7) ; } "?>" {if (affichetrace==1) printf ("\n\nENDXMLDECL:%s\n",yytext) ; BEGIN(HORSBALISE);return ENDXMLDECL;} {S} {if (affichetrace==1) printf ("\n\nS:'%s'\n",yytext) ; } ""|"" {if (affichetrace==1) printf ("\n\nPIERROR:%s\n",yytext) ; return PIERROR;} "])))*"?>" {attentionImpossibleDeTrouverPIapres=1 ; if (affichetrace==1) printf ("\n\nPI:%s\n",yytext) ; return PI;} {newline}*"<" {if (affichetrace==1) printf ("\n\nINFCAR:%s\n",yytext) ; BEGIN(DANSBALISE);return INFCAR;} ">" {if (affichetrace==1) printf ("\n\nSUPCAR:%s\n",yytext) ; BEGIN(HORSBALISE);return SUPCAR;} "/" {if (affichetrace==1) printf ("\n\nSLASH:%s\n",yytext) ; return SLASH;} {egalevolue} {if (affichetrace==1) printf ("\n\nEq:'%s'\n",yytext) ; return Eq;} {Name} {if (affichetrace==1) printf ("\n\nID:%s\n",yytext) ; crlval.s=yytext;return ID;} {attvalue} {if (affichetrace==1) printf ("\n\nATTVALUE:%s\n",yytext) ; return ATTVALUE;} "" {attentionImpossibleDeTrouverXMLDeclapres=1; } .|\n {if (affichetrace==1)printf("error : LINE %d : character not supported '%s'\n",yylineno,yytext); } %% int crwrap() {return 1;}