[621] | 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 |
---|
| 25 | %option yylineno |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | %{ |
---|
| 29 | |
---|
| 30 | #include <string.h> |
---|
| 31 | #include "service_conf.tab.h" |
---|
| 32 | |
---|
[618] | 33 | char *lmsg=NULL; |
---|
[1] | 34 | |
---|
| 35 | %} |
---|
| 36 | |
---|
| 37 | S [ \t\r\n]+ |
---|
| 38 | |
---|
| 39 | CharRef "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";" |
---|
| 40 | |
---|
| 41 | egalevolue {S}?"="{S}? |
---|
| 42 | |
---|
| 43 | Name ([_:]|[\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])(([\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])|[0-9.\-_:])* |
---|
| 44 | |
---|
[13] | 45 | chardata [^<]* |
---|
[1] | 46 | |
---|
[550] | 47 | attname [a-zA-Z0-9._\-]+ |
---|
[638] | 48 | attvalue1 [\x80-\xbf\xc2-\xdf\xe0-\xef\xf0-\xf4="#°²θé\^\*\+\,\;;?!~`ú@a-zA-Z0-9%_\-:\:.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+ |
---|
[1] | 49 | |
---|
| 50 | attvalue \"[^"]*\"|\'[^']*\'\(\) |
---|
| 51 | |
---|
[214] | 52 | whitespace [\t]{0,}|[ ]{0,} |
---|
| 53 | whitesp [\t]|[ ] |
---|
[1] | 54 | newline [\r\n]|[\n] |
---|
| 55 | newlines [\r\n]{1,}|[\n]{1,} |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | %x DANSBALISE HORSBALISE PAIRSTART |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | %% |
---|
| 64 | |
---|
[621] | 65 | "\n" { } |
---|
[1] | 66 | |
---|
[621] | 67 | {newline}+{whitesp}* { return NEWLINE; } |
---|
[1] | 68 | |
---|
[9] | 69 | <INITIAL,HORSBALISE>"["{attname}"]" { srlval.chaine=yytext;return ANID; } |
---|
[1] | 70 | |
---|
[9] | 71 | <INITIAL,HORSBALISE>{attname} { srlval.chaine=yytext; return SPAIR; } |
---|
[1] | 72 | |
---|
[9] | 73 | <PAIRSTART,HORSBALISE>{attvalue1} { srlval.chaine=yytext;/*BEGIN(INITIAL);*/ return EPAIR;} |
---|
[1] | 74 | |
---|
| 75 | <PAIRSTART,INITIAL,HORSBALISE>{whitesp}*"="{whitesp}* { BEGIN(PAIRSTART);} |
---|
| 76 | |
---|
[621] | 77 | <PAIRSTART,INITIAL,HORSBALISE>{newline}+{whitesp}* { BEGIN(INITIAL); return NEWLINE;} |
---|
[1] | 78 | |
---|
[9] | 79 | <DANSBALISE,INITIAL,HORSBALISE>{S} { } |
---|
[1] | 80 | |
---|
[9] | 81 | <INITIAL,HORSBALISE>{newline}*"<" { BEGIN(DANSBALISE); return INFCAR;} |
---|
[1] | 82 | |
---|
| 83 | |
---|
[9] | 84 | <DANSBALISE>">" { BEGIN(HORSBALISE);return SUPCAR;} |
---|
[1] | 85 | |
---|
| 86 | |
---|
[9] | 87 | <DANSBALISE>"/" {return SLASH;} |
---|
[1] | 88 | |
---|
| 89 | |
---|
[9] | 90 | <DANSBALISE>{egalevolue} {return Eq;} |
---|
[1] | 91 | |
---|
| 92 | |
---|
[57] | 93 | <DANSBALISE>{Name}{newline}* {memmove(srlval.chaine,yytext,(strlen(yytext)+1)*sizeof(char));return ID;} |
---|
[1] | 94 | |
---|
| 95 | |
---|
[9] | 96 | <DANSBALISE>{attvalue} {return ATTVALUE;} |
---|
[1] | 97 | |
---|
| 98 | |
---|
[476] | 99 | <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;} |
---|
[1] | 100 | |
---|
| 101 | %% |
---|
| 102 | |
---|