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