| [621] | 1 | /* |
|---|
| 2 | * Zoo main configuration file parser |
|---|
| 3 | * |
|---|
| 4 | * Author : Gérald FENOY |
|---|
| 5 | * |
|---|
| 6 | * Copyright (c) 209-2015 GeoLabs SARL |
|---|
| 7 | * |
|---|
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 9 | * of this software and associated documentation files (the "Software"), to deal |
|---|
| 10 | * in the Software without restriction, including without limitation the rights |
|---|
| 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 12 | * copies of the Software, and to permit persons to whom the Software is |
|---|
| 13 | * furnished to do so, subject to the following conditions: |
|---|
| 14 | * |
|---|
| 15 | * The above copyright notice and this permission notice shall be included in |
|---|
| 16 | * all copies or substantial portions of the Software. |
|---|
| 17 | * |
|---|
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 24 | * THE SOFTWARE. |
|---|
| 25 | */ |
|---|
| [1] | 26 | %option yylineno |
|---|
| 27 | |
|---|
| 28 | %{ |
|---|
| 29 | |
|---|
| 30 | #include <string.h> |
|---|
| 31 | #include "main_conf_read.tab.h" |
|---|
| 32 | static int affichetrace = 0 ; |
|---|
| 33 | |
|---|
| 34 | %} |
|---|
| 35 | |
|---|
| [771] | 36 | attname [a-zA-Z0-9_\-:.]+ |
|---|
| [1] | 37 | |
|---|
| [784] | 38 | attvalue1 [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff?&=\!$]+ |
|---|
| [1] | 39 | |
|---|
| 40 | whitesp [ ] |
|---|
| 41 | newline [\r\n]|[\n] |
|---|
| 42 | |
|---|
| 43 | %x DANSBALISE HORSBALISE PAIRSTART |
|---|
| 44 | |
|---|
| 45 | %% |
|---|
| 46 | |
|---|
| 47 | "\n" {if (affichetrace==1) printf ("\n\nNEWLINE\n") ; return NEWLINE;} |
|---|
| 48 | |
|---|
| 49 | {newline}+{whitesp}* {if (affichetrace==1) printf ("\n\nNEWLINE 1\n") ; return NEWLINE;} |
|---|
| 50 | |
|---|
| [9] | 51 | <INITIAL,HORSBALISE>"["{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; } |
|---|
| [1] | 52 | |
|---|
| [9] | 53 | <INITIAL,HORSBALISE>{attname} {if (affichetrace==1) printf ("\n\nATT_NAME:%s\n",yytext); crlval.chaine=yytext; return SPAIR; } |
|---|
| [1] | 54 | |
|---|
| [9] | 55 | <PAIRSTART,HORSBALISE>{attvalue1} {if (affichetrace==1) printf ("\n\nATT_VALUE:%s\n",yytext);crlval.chaine=yytext;BEGIN(INITIAL);return EPAIR;} |
|---|
| [1] | 56 | |
|---|
| 57 | <PAIRSTART,INITIAL,HORSBALISE>{whitesp}*"="{whitesp}* {BEGIN(PAIRSTART);} |
|---|
| 58 | |
|---|
| 59 | <PAIRSTART,INITIAL,HORSBALISE,DANSBALISE>{newline}+{whitesp}* {if (affichetrace==1) printf ("\n\nNEWLINE 2\n") ; BEGIN(INITIAL); return NEWLINE;} |
|---|
| 60 | |
|---|
| 61 | %% |
|---|
| 62 | |
|---|
| 63 | |
|---|
| [9] | 64 | int crwrap() |
|---|
| [1] | 65 | {return 1;} |
|---|