Changeset 621 for trunk/zoo-project/zoo-kernel/service_conf.l
- Timestamp:
- Apr 9, 2015, 5:23:06 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_conf.l
r618 r621 1 /* 2 * Author : Gérald FENOY 3 * 4 * Copyright (c) 209-2015 GeoLabs SARL 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 * THE SOFTWARE. 23 */ 1 24 %option noyywrap 2 25 %option yylineno … … 4 27 5 28 %{ 6 //======================================================7 /**8 9 authors : Jean-Marie CODOL, Naitan GROLLEMUND10 11 **/12 //======================================================13 14 29 15 30 #include <string.h> 16 31 #include "service_conf.tab.h" 17 32 18 #ifdef DEBUG_SERVICE_CONF19 int affichetrace = 1;20 #else21 int affichetrace = 0;22 #endif23 24 33 char *lmsg=NULL; 25 int attentionImpossibleDeTrouverXMLDeclapres = 0 ;26 27 int attentionImpossibleDeTrouverPIapres = 0 ;28 34 29 35 %} … … 41 47 42 48 attname [a-zA-Z0-9._\-]+ 43 attvalue1 [#°²θé\^\*\+,; @a-zA-Z0-9%_\-:\:.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+49 attvalue1 [#°²θé\^\*\+,;?!~`ú@a-zA-Z0-9%_\-:\:.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+ 44 50 45 51 attvalue \"[^"]*\"|\'[^']*\'\(\) … … 58 64 %% 59 65 60 "\n" { if (affichetrace==1) fprintf (stderr,"\n\nNEWLINE\n") ;return NEWLINE;}66 "\n" { } 61 67 62 {newline}+{whitesp}* { if (affichetrace==1) fprintf (stderr,"\n\nNEWLINE 1\n") ; return NEWLINE;}68 {newline}+{whitesp}* { return NEWLINE; } 63 69 64 70 <INITIAL,HORSBALISE>"["{attname}"]" { srlval.chaine=yytext;return ANID; } … … 70 76 <PAIRSTART,INITIAL,HORSBALISE>{whitesp}*"="{whitesp}* { BEGIN(PAIRSTART);} 71 77 72 <PAIRSTART,INITIAL,HORSBALISE,DANSBALISE>{newline}+{whitesp}* { BEGIN(INITIAL); return NEWLINE;} 73 74 <INITIAL>"<?"[Xx][Mm][Ll] { if (attentionImpossibleDeTrouverXMLDeclapres == 1 || attentionImpossibleDeTrouverPIapres == 1) {/* il y a eut un commentaire ou une balise applicative avant la declaration xml */ fprintf(stderr,"\nerror : a la ligne %d : il y a eut un commentaire ou un PI avant la declaration xml\n",srlineno); exit (10) ; } ; return STARTXMLDECL;} 75 76 <INITIAL>"version"{egalevolue}\"1.0\"|"version"{egalevolue}\'1.0\' { return VERSIONDECL; } 77 <INITIAL>"version"{egalevolue}\"[^"]*\"|"version"{egalevolue}\'[^']*\' {/* erreur de version encoding */ fprintf(stderr,"\nerror : a la ligne %d : la version xml n est pas reconnue : %s\n",srlineno,yytext); exit (9) ; } 78 79 80 <INITIAL>"encoding"{egalevolue}\"[Ii][Ss][Oo]"-8859-1"\"|"encoding"{egalevolue}\'[Ii][Ss][Oo]"-8859-1"\' { return ENCODINGDECL;} 81 <INITIAL>"encoding"{egalevolue}\"[^"]*\"|"encoding"{egalevolue}\'[^']*\' {/* erreur de version encoding */ fprintf(stderr,"\nerror : a la ligne %d : la version d encodage n est pas reconnue : %s\n",srlineno,yytext); exit (8) ; } 82 83 84 <INITIAL>"standalone"{egalevolue}\"yes\"|"standalone"{egalevolue}\'yes\'|"standalone"{egalevolue}\"no\"|"standalone"{egalevolue}\'no\' { return SDDECL;} 85 86 <INITIAL>"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\'|"standalone"{egalevolue}\"[^"]*\"|"standalone"{egalevolue}\'[^']*\' { /* erreur de version encoding */ fprintf(stderr,"\nerror : a la ligne %d : la version standalone n est pas reconnue : %s\n",srlineno,yytext); exit (7) ; } 87 88 89 <INITIAL>"?>" { BEGIN(HORSBALISE); return ENDXMLDECL;} 90 78 <PAIRSTART,INITIAL,HORSBALISE>{newline}+{whitesp}* { BEGIN(INITIAL); return NEWLINE;} 91 79 92 80 <DANSBALISE,INITIAL,HORSBALISE>{S} { } 93 94 95 <HORSBALISE>"<?"[Xx][Mm][Ll]{S}({S}|{chardata})*"?>"|"<?"[Xx][Mm][Ll]"?>" { return PIERROR;}96 <INITIAL,HORSBALISE>"<?"([^xX]|([xX][^mM])|([xX][mM][^lL]))({S}|([^?]|("?"[^>])))*"?>" { attentionImpossibleDeTrouverPIapres=1 ; return PI;}97 98 81 99 82 <INITIAL,HORSBALISE>{newline}*"<" { BEGIN(DANSBALISE); return INFCAR;} … … 115 98 116 99 117 <INITIAL,HORSBALISE>"<!--"([^-]|"-"[^-])*"-->" {attentionImpossibleDeTrouverXMLDeclapres=1; }118 119 120 100 <INITIAL,DANSBALISE,HORSBALISE>.|\n {lmsg=(char*)malloc(1024*sizeof(char));sprintf(lmsg,"error: line %d: character not allowed '%s'",srlineno,yytext);fprintf(stderr,"%s \n",lmsg);srlval.chaine=lmsg;fprintf(stderr,"%s \n",lmsg);return -1;} 121 101
Note: See TracChangeset
for help on using the changeset viewer.