New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label using TEXT shows field name instead of field contents #4012
Comments
Author: saharlan |
attachment http://trac.osgeo.org/mapserver/attachment/ticket/4012/msbugrep.zip :
|
Wow, this one is weird, I was able to reproduce with master. @sdlime this seems parser related, can you have a look? (The supplied testcase works out of the box) |
these are some tests I've run, with the string passed to TEXT first, and the resulting output second: Louri[NAME] => Louri44
Louq[NAME] => segfault
when run inside valgrind the code doesn't segfault, but there's an additional message:
Lour[NAME] => Lour44 I have also tried all the other letters of the alphabet, i.e. Lou Lou[NAME] => Lou44 |
Will have a look... May be a token processing issue. |
debug output when using Loup[NAME]:
|
some further debugging: in msTokenizeExpression() the code goes through |
ccing @aboudreault as is seems that this could be related to 95cb999. The following patch fixes the issue for me, but it surely has some side-effects I am not aware of.
without this patch, msyylex() returns a single character instead of a token, which completely messes up the logic in msTokenizeExpression() . I'm surprised this hasn't been brought up earlier as this isn't an unusual use-case. |
well... the original code seems to do what it should... returning a single char. The question is why the string was not caught by the previous regex... |
Who owns this one now? Steve |
@sdlime it's all your's if you can have a go at it |
some more tests that might help debugging: it seems that whenever class->text is of the form |
The following diff solves this issue, by ensuring that a single character returned by msyylex does not collide with one of our enum'd tokens. diff --git a/mapserver.h b/mapserver.h
index fed2467..8c20ff9 100644
--- a/mapserver.h
+++ b/mapserver.h
@@ -635,20 +635,20 @@ extern "C" {
/* expressionObj & tokenObj */
/************************************************************************/
- enum MS_TOKEN_LOGICAL_ENUM { MS_TOKEN_LOGICAL_AND=100, MS_TOKEN_LOGICAL_OR, MS_TOKEN_LOGICAL_NOT };
- enum MS_TOKEN_LITERAL_ENUM { MS_TOKEN_LITERAL_NUMBER=110, MS_TOKEN_LITERAL_STRING, MS_TOKEN_LITERAL_TIME, MS_TOKEN_LITERAL_SHAPE };
+ enum MS_TOKEN_LOGICAL_ENUM { MS_TOKEN_LOGICAL_AND=300, MS_TOKEN_LOGICAL_OR, MS_TOKEN_LOGICAL_NOT };
+ enum MS_TOKEN_LITERAL_ENUM { MS_TOKEN_LITERAL_NUMBER=310, MS_TOKEN_LITERAL_STRING, MS_TOKEN_LITERAL_TIME, MS_TOKEN_LITERAL_SHAPE };
enum MS_TOKEN_COMPARISON_ENUM {
- MS_TOKEN_COMPARISON_EQ=120, MS_TOKEN_COMPARISON_NE, MS_TOKEN_COMPARISON_GT, MS_TOKEN_COMPARISON_LT, MS_TOKEN_COMPARISON_LE, MS_TOKEN_COMPARISON_GE, MS_TOKEN_COMPARISON_IEQ,
+ MS_TOKEN_COMPARISON_EQ=320, MS_TOKEN_COMPARISON_NE, MS_TOKEN_COMPARISON_GT, MS_TOKEN_COMPARISON_LT, MS_TOKEN_COMPARISON_LE, MS_TOKEN_COMPARISON_GE, MS_TOKEN_COMPARISON_IEQ,
MS_TOKEN_COMPARISON_RE, MS_TOKEN_COMPARISON_IRE,
MS_TOKEN_COMPARISON_IN, MS_TOKEN_COMPARISON_LIKE,
MS_TOKEN_COMPARISON_INTERSECTS, MS_TOKEN_COMPARISON_DISJOINT, MS_TOKEN_COMPARISON_TOUCHES, MS_TOKEN_COMPARISON_OVERLAPS, MS_TOKEN_COMPARISON_CROSSES, MS_TOKEN_COMPARISON_WITHIN, MS_TOKEN_COMPARISON_CONTAINS,
MS_TOKEN_COMPARISON_BEYOND, MS_TOKEN_COMPARISON_DWITHIN
};
enum MS_TOKEN_FUNCTION_ENUM {
- MS_TOKEN_FUNCTION_LENGTH=140, MS_TOKEN_FUNCTION_TOSTRING, MS_TOKEN_FUNCTION_COMMIFY, MS_TOKEN_FUNCTION_AREA, MS_TOKEN_FUNCTION_ROUND, MS_TOKEN_FUNCTION_FROMTEXT,
+ MS_TOKEN_FUNCTION_LENGTH=340, MS_TOKEN_FUNCTION_TOSTRING, MS_TOKEN_FUNCTION_COMMIFY, MS_TOKEN_FUNCTION_AREA, MS_TOKEN_FUNCTION_ROUND, MS_TOKEN_FUNCTION_FROMTEXT,
MS_TOKEN_FUNCTION_BUFFER, MS_TOKEN_FUNCTION_DIFFERENCE
};
- enum MS_TOKEN_BINDING_ENUM { MS_TOKEN_BINDING_DOUBLE=150, MS_TOKEN_BINDING_INTEGER, MS_TOKEN_BINDING_STRING, MS_TOKEN_BINDING_TIME, MS_TOKEN_BINDING_SHAPE };
+ enum MS_TOKEN_BINDING_ENUM { MS_TOKEN_BINDING_DOUBLE=350, MS_TOKEN_BINDING_INTEGER, MS_TOKEN_BINDING_STRING, MS_TOKEN_BINDING_TIME, MS_TOKEN_BINDING_SHAPE };
enum MS_PARSE_TYPE_ENUM { MS_PARSE_TYPE_BOOLEAN, MS_PARSE_TYPE_STRING, MS_PARSE_TYPE_SHAPE };
#ifndef SWIG @sdlime I wouldn't be surprised there are side-effects to this, can you check ? |
Really, really good catch. I can't see where the patch should cause new problems. I'll check to make sure the 300-360 range is unused. To be clear you're proposing only the change to mapserver.h and not a change to the lexer, correct? Steve |
@sdlime what do you mean by "a change to the lexer"? If you're referring to the initial patch to maplexer.l I proposed, then no, it should not be applied. |
Reporter: saharlan
Date: 2011/09/08 - 15:35
Trac URL: http://trac.osgeo.org/mapserver/ticket/4012
I am labeling a simple line using the TEXT directive in a CLASS element. The field used to label is called NAME and I am adding a text prefix to the label. The line "TEXT 'Bus [NAME]'" labels the line correctly. However, if I change the word 'Bus' to the word 'Loop', the map label does not display the contents of the field NAME. Instead, it displays the name of the field.
The text was updated successfully, but these errors were encountered: