source: trunk/zoo-project/zoo-kernel/service_conf.l @ 550

Last change on this file since 550 was 550, checked in by djay, 9 years ago

Add otb2zcfg and OTB applications support without observer by now. Fix issue with maxOccurs and multiple downloaded value for the same input.

File size: 4.2 KB
Line 
1%option noyywrap
2%option yylineno
3
4
5%{
6//======================================================
7/**
8
9 authors : Jean-Marie CODOL, Naitan GROLLEMUND
10
11**/
12//======================================================
13
14
15#include <string.h>
16#include "service_conf.tab.h"
17
18#ifdef DEBUG_SERVICE_CONF
19int affichetrace = 1;
20#else
21int affichetrace = 0;
22#endif
23
24char *lmsg;
25int attentionImpossibleDeTrouverXMLDeclapres = 0 ;
26
27int attentionImpossibleDeTrouverPIapres = 0 ;
28
29%}
30
31
32S               [ \t\r\n]+
33
34CharRef         "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
35
36egalevolue              {S}?"="{S}?
37
38Name            ([_:]|[\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])(([\x41-\x5A]|[\x61-\x7A]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\xFF])|[0-9.\-_:])*
39
40chardata        [^<]*
41
42attname [a-zA-Z0-9._\-]+
43attvalue1       [°²θé#\^\*\+,;@a-zA-Z0-9%_\-::.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+
44
45attvalue                \"[^"]*\"|\'[^']*\'\(\)
46
47whitespace                      [\t]{0,}|[ ]{0,}
48whitesp                      [\t]|[ ]
49newline                 [\r\n]|[\n]
50newlines                 [\r\n]{1,}|[\n]{1,}
51
52
53%x DANSBALISE HORSBALISE PAIRSTART
54
55
56
57
58%%
59
60"\n" {  if (affichetrace==1) fprintf (stderr,"\n\nNEWLINE\n") ;return NEWLINE;}
61
62{newline}+{whitesp}*                    {  if (affichetrace==1) fprintf (stderr,"\n\nNEWLINE 1\n") ; return NEWLINE;}
63
64<INITIAL,HORSBALISE>"["{attname}"]"             {  srlval.chaine=yytext;return ANID; }
65
66<INITIAL,HORSBALISE>{attname}             {  srlval.chaine=yytext; return SPAIR; }
67
68<PAIRSTART,HORSBALISE>{attvalue1}             { srlval.chaine=yytext;/*BEGIN(INITIAL);*/ return EPAIR;}
69
70<PAIRSTART,INITIAL,HORSBALISE>{whitesp}*"="{whitesp}*             {  BEGIN(PAIRSTART);}
71
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
91
92<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
99<INITIAL,HORSBALISE>{newline}*"<"                   { BEGIN(DANSBALISE); return INFCAR;}
100
101
102<DANSBALISE>">"                 { BEGIN(HORSBALISE);return SUPCAR;}
103
104
105<DANSBALISE>"/"         {return SLASH;}
106
107
108<DANSBALISE>{egalevolue}                        {return Eq;}
109
110
111<DANSBALISE>{Name}{newline}*                    {memmove(srlval.chaine,yytext,(strlen(yytext)+1)*sizeof(char));return ID;}
112
113
114<DANSBALISE>{attvalue}          {return ATTVALUE;}
115
116
117<INITIAL,HORSBALISE>"<!--"([^-]|"-"[^-])*"-->"          {attentionImpossibleDeTrouverXMLDeclapres=1; }
118
119
120<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
122%%
123
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