source: trunk/zoo-project/zoo-kernel/main_conf_read.l @ 472

Last change on this file since 472 was 378, checked in by djay, 12 years ago

Directly use tmpUrl if it starts with "http://". Fix cache system. Add support for "%" in main.cfg to let user define printf format for instance.

File size: 4.8 KB
Line 
1/* Line number from bison */
2%option yylineno
3
4%{
5//======================================================
6/**
7Zoo main configuration file parser
8**/
9//======================================================
10
11
12#include <string.h>
13#include "main_conf_read.tab.h"
14static int affichetrace = 0 ;
15static int attentionImpossibleDeTrouverXMLDeclapres = 0 ;
16static int attentionImpossibleDeTrouverPIapres = 0 ;
17
18%}
19
20
21S               [ \t\r\n]+
22
23CharRef         "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
24
25egalevolue              {S}?"="{S}?
26
27Name            ([_:]|[\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])(([\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])|[0-9.\-_:])*
28
29chardata        [^<]*
30
31attname [a-zA-Z0-9_\-:]+
32
33attvalue1       [%\*,;@a-zA-Z0-9_\-.:" "\"\'/\\\(\)\+\x41-\xff]+
34
35attvalue                \"[^"]*\"|\'[^']*\'
36
37virgule [,]+
38
39whitespace                      [ ]{0,}
40whitesp                      [ ]
41newline                 [\r\n]|[\n]
42newlines                 [\r\n]{1,}|[\n]{1,}
43
44
45
46%x DANSBALISE HORSBALISE PAIRSTART
47
48
49
50
51%%
52
53"\n" {if (affichetrace==1) printf ("\n\nNEWLINE\n") ; return NEWLINE;}
54
55{newline}+{whitesp}*                    {if (affichetrace==1) printf ("\n\nNEWLINE 1\n") ; return NEWLINE;}
56
57<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; }
58
59<INITIAL,HORSBALISE>{attname}             {if (affichetrace==1) printf ("\n\nATT_NAME:%s\n",yytext); crlval.chaine=yytext; return SPAIR; }
60
61<PAIRSTART,HORSBALISE>{attvalue1}             {if (affichetrace==1) printf ("\n\nATT_VALUE:%s\n",yytext);crlval.chaine=yytext;BEGIN(INITIAL);return EPAIR;}
62
63<PAIRSTART,INITIAL,HORSBALISE>{whitesp}*"="{whitesp}*             {BEGIN(PAIRSTART);}
64
65<PAIRSTART,INITIAL,HORSBALISE,DANSBALISE>{newline}+{whitesp}*                   {if (affichetrace==1) printf ("\n\nNEWLINE 2\n") ; BEGIN(INITIAL); return NEWLINE;}
66
67<INITIAL>"<?"[Xx][Mm][Ll]  { if (attentionImpossibleDeTrouverXMLDeclapres == 1 || attentionImpossibleDeTrouverPIapres == 1) { printf("\nerror : LINE %d : comment ot PI before xml declaration\n",yylineno); exit (10) ; } ; if (affichetrace==1) printf ("\n\nSTARTXMLDECL:%s\n",yytext) ;return STARTXMLDECL;}
68
69<INITIAL>"version"{egalevolue}\"1.0\"|"version"{egalevolue}\'1.0\'  {if (affichetrace==1) printf ("\n\nVERSIONDECL:%s\n",yytext) ;return VERSIONDECL;}
70<INITIAL>"version"{egalevolue}\"[^"]*\"|"version"{egalevolue}\'[^']*\'  {/* erreur de version encoding */       printf("\nerror : LINE %d : XML Version not supported : %s\n",yylineno,yytext); exit (9) ; }
71
72
73<INITIAL>"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;}
74<INITIAL>"encoding"{egalevolue}\"[^"]*\"|"encoding"{egalevolue}\'[^']*\'  {/* erreur de version encoding */     printf("\nerror : LINE %d : encoding version not supported : %s\n",yylineno,yytext); exit (8) ; }
75
76
77<INITIAL>"standalone"{egalevolue}\"yes\"|"standalone"{egalevolue}\'yes\'|"standalone"{egalevolue}\"no\"|"standalone"{egalevolue}\'no\'  {if (affichetrace==1) printf ("\n\nSDDECL:%s\n",yytext) ; return SDDECL;}
78
79<INITIAL>"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) ; }
80
81
82<INITIAL>"?>"  {if (affichetrace==1) printf ("\n\nENDXMLDECL:%s\n",yytext) ; BEGIN(HORSBALISE);return ENDXMLDECL;}
83
84
85<DANSBALISE,INITIAL,HORSBALISE>{S}   {if (affichetrace==1) printf ("\n\nS:'%s'\n",yytext) ; }
86
87
88<HORSBALISE>"<?"[Xx][Mm][Ll]{S}({S}|{chardata})*"?>"|"<?"[Xx][Mm][Ll]"?>"       {if (affichetrace==1) printf ("\n\nPIERROR:%s\n",yytext) ; return PIERROR;}
89<INITIAL,HORSBALISE>"<?"([^xX]|([xX][^mM])|([xX][mM][^lL]))({S}|([^?]|("?"[^>])))*"?>"          {attentionImpossibleDeTrouverPIapres=1 ;  if (affichetrace==1) printf ("\n\nPI:%s\n",yytext) ; return PI;}
90
91
92<INITIAL,HORSBALISE>{newline}*"<"                   {if (affichetrace==1) printf ("\n\nINFCAR:%s\n",yytext) ; BEGIN(DANSBALISE);return INFCAR;}
93
94
95<DANSBALISE>">"                 {if (affichetrace==1) printf ("\n\nSUPCAR:%s\n",yytext) ; BEGIN(HORSBALISE);return SUPCAR;}
96
97
98<DANSBALISE>"/"         {if (affichetrace==1) printf ("\n\nSLASH:%s\n",yytext) ; return SLASH;}
99
100
101<DANSBALISE>{egalevolue}                        {if (affichetrace==1) printf ("\n\nEq:'%s'\n",yytext) ; return Eq;}
102
103
104<DANSBALISE>{Name}                      {if (affichetrace==1) printf ("\n\nID:%s\n",yytext) ; crlval.s=yytext;return ID;}
105
106
107<DANSBALISE>{attvalue}          {if (affichetrace==1) printf ("\n\nATTVALUE:%s\n",yytext) ; return ATTVALUE;}
108
109
110<INITIAL,HORSBALISE>"<!--"([^-]|"-"[^-])*"-->"          {attentionImpossibleDeTrouverXMLDeclapres=1; }
111
112
113<INITIAL,DANSBALISE,HORSBALISE>.|\n     {if (affichetrace==1)printf("error : LINE %d : character not supported '%s'\n",yylineno,yytext); }
114
115%%
116
117
118int crwrap()
119{return 1;}
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png