Permalink
Browse files

add EXPRESSION {value1,value2,...} support to parser (#4648)

  • Loading branch information...
1 parent e04cdcd commit 772dcf2d657b6bd74eaa7dd3d0a973bc21dbb31c @tbonfort tbonfort committed Mar 8, 2013
Showing with 1,909 additions and 1,913 deletions.
  1. +8 −2 mapfile.c
  2. +1,636 −1,619 maplexer.c
  3. +9 −0 maplexer.l
  4. +206 −281 mapparser.c
  5. +28 −9 mapparser.h
  6. +1 −1 mapparser.y
  7. +1 −0 mapserver.h
  8. +19 −0 maputil.c
  9. +1 −1 msautotest
View
@@ -2282,7 +2282,7 @@ int loadExpression(expressionObj *exp)
/* TODO: should we fall freeExpression if exp->string != NULL? We do some checking to avoid a leak but is it enough... */
msyystring_icase = MS_TRUE;
- if((exp->type = getSymbol(5, MS_STRING,MS_EXPRESSION,MS_REGEX,MS_ISTRING,MS_IREGEX)) == -1) return(-1);
+ if((exp->type = getSymbol(6, MS_STRING,MS_EXPRESSION,MS_REGEX,MS_ISTRING,MS_IREGEX,MS_LIST)) == -1) return(-1);
if (exp->string != NULL)
msFree(exp->string);
exp->string = msStrdup(msyystring_buffer);
@@ -2330,7 +2330,7 @@ int loadExpressionString(expressionObj *exp, char *value)
freeExpression(exp); /* we're totally replacing the old expression so free (which re-inits) to start over */
msyystring_icase = MS_TRUE;
- if((exp->type = getSymbol2(4, MS_EXPRESSION,MS_REGEX,MS_IREGEX,MS_ISTRING)) != -1) {
+ if((exp->type = getSymbol2(5, MS_EXPRESSION,MS_REGEX,MS_IREGEX,MS_ISTRING,MS_LIST)) != -1) {
exp->string = msStrdup(msyystring_buffer);
if(exp->type == MS_ISTRING) {
@@ -2383,6 +2383,9 @@ char *msGetExpressionString(expressionObj *exp)
case(MS_EXPRESSION):
snprintf(exprstring, buffer_size, "(%s)", exp->string);
return exprstring;
+ case(MS_LIST):
+ snprintf(exprstring, buffer_size, "{%s}", exp->string);
+ return exprstring;
default:
/* We should never get to here really! */
free(exprstring);
@@ -2399,6 +2402,9 @@ static void writeExpression(FILE *stream, int indent, const char *name, expressi
writeIndent(stream, ++indent);
switch(exp->type) {
+ case(MS_LIST):
+ fprintf(stream, "%s {%s}", name, exp->string);
+ break;
case(MS_REGEX):
msIO_fprintf(stream, "%s /%s/", name, exp->string);
break;
View
Oops, something went wrong.
View
@@ -586,6 +586,15 @@ char path[MS_MAXPATHLEN];
return(MS_EXPRESSION);
}
+<INITIAL,URL_STRING>\{.*\} {
+ msyytext++;
+ msyytext[strlen(msyytext)-1] = '\0';
+ MS_LEXER_STRING_REALLOC(msyystring_buffer, strlen(msyytext),
+ msyystring_buffer_size, msyystring_buffer_ptr);
+ strcpy(msyystring_buffer, msyytext);
+ return(MS_LIST);
+ }
+
<INITIAL,URL_STRING>\'|\" {
msyystring_return_state = MS_STRING;
msyystring_begin = msyytext[0];
Oops, something went wrong.

0 comments on commit 772dcf2

Please sign in to comment.