Skip to content
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

Map file with "FILTER ( type LIKE '611_%' )" can't be parse. #37

Closed
BarreSebastien opened this issue Aug 27, 2017 · 5 comments

Comments

@BarreSebastien
Copy link

@BarreSebastien BarreSebastien commented Aug 27, 2017

Hello,

I've got a Mapfile whith the line "FILTER ( type LIKE '611_%' )" in it and when I try do parse the file I've got this error message :
ERROR:root:Unexpected token Token(NAME, u'LIKE') at line 8283, column 18.
Expected: set([u'__AND13', u'__NE22', u'__IN21', '__TILDE', '__PLUS', '__EQUAL', '__LESSTHAN', '__MORETHAN', '__RPAR', '__ANONSTR_19', '__ANONSTR_18', '__LPAR', '__ANONSTR_20', u'__OR11', '__ANONSTR_12', u'__EQ23', '__ANONSTR_17', '__ANONSTR_16', '__ANONSTR_15', '__ANONSTR_14'])
Context:
Traceback (most recent call last):
File "C:\OSGEO41\apps\Python27\lib\site-packages\mappyfile\parser.py", line 99, in parse
ast = self.earley.parse(text)
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\lark\lark.py", line 193, in parse
return self.parser.parse(text)
File "C:\OSGEO41\apps\Python27\lib\site-packages\lark\parser_frontends.py", line 115, in parse
return self.parser.parse(tokens)
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\lark\parsers\earley.py", line 209, in parse
column = scan(i, token, column)
File "C:\OSGEO41\apps\Python27\lib\site-packages\lark\parsers\earley.py", line 198, in scan
raise UnexpectedToken(token, expect, stream, i)
UnexpectedToken: Unexpected token Token(NAME, u'LIKE') at line 8283, column 18.
Expected: set([u'__AND13', u'__NE22', u'__IN21', '__TILDE', '__PLUS', '__EQUAL', '__LESSTHAN', '__MORETHAN', '__RPAR', '__ANONSTR_19', '__ANONSTR_18', '__LPAR', '__ANONSTR_20', u'__OR11', '__ANONSTR_12', u'__EQ23', '__ANONSTR_17', '__ANONSTR_16', '__ANONSTR_15', '__ANONSTR_14'])
Context:
ERROR:root:Parsing with LALR and Earley unsuccessful
Traceback (most recent call last):
File "", line 1, in
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\mappyfile\utils.py", line 9, in load
ast = p.parse_file(fn)
File "C:\OSGEO41\apps\Python27\lib\site-packages\mappyfile\parser.py", line 76, in parse_file
return self.parse(text, fn=fn)
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\mappyfile\parser.py", line 99, in parse
ast = self.earley.parse(text)
File "C:\OSGEO41\apps\Python27\lib\site-packages\lark\lark.py", line 193, in parse
return self.parser.parse(text)
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\lark\parser_frontends.py", line 115, in parse
return self.parser.parse(tokens)
File "C:\OSGEO41\apps\Python27\lib\site-packages\lark\parsers\earley.py", line 209, in parse
column = scan(i, token, column)
File "C:\OSGEO4
1\apps\Python27\lib\site-packages\lark\parsers\earley.py", line 198, in scan
raise UnexpectedToken(token, expect, stream, i)
lark.common.UnexpectedToken: Unexpected token Token(NAME, u'LIKE') at line 8283, column 18.
Expected: set([u'__AND13', u'__NE22', u'__IN21', '__TILDE', '__PLUS', '__EQUAL', '__LESSTHAN', '__MORETHAN', '__RPAR', '__ANONSTR_19', '__ANONSTR_18', '__LPAR', '__ANONSTR_20', u'__OR11', '__ANONSTR_12', u'__EQ23', '__ANONSTR_17', '__ANONSTR_16', '__ANONSTR_15', '__ANONSTR_14'])
Context:

Thank you for your work.
Sébastien Barre.

@geographika

This comment has been minimized.

Copy link
Owner

@geographika geographika commented Aug 27, 2017

@BarreSebastien - what data are you filtering with that expression? LIKE isn't one of the comparisons listed at http://mapserver.org/mapfile/expressions.html

If you are filtering in a database you should now use the following syntax as recommended at http://mapserver.org/mapfile/layer.html

PROCESSING 'NATIVE_FILTER=id=234'

These filters should be wrapped in quotes.

@BarreSebastien

This comment has been minimized.

Copy link
Author

@BarreSebastien BarreSebastien commented Aug 28, 2017

@geographika

This comment has been minimized.

Copy link
Owner

@geographika geographika commented Aug 28, 2017

@BarreSebastien - no problem. Let me know if any parts of the Mapfile don't parse in mappyfile but work with MapServer.

@BarreSebastien

This comment has been minimized.

Copy link
Author

@BarreSebastien BarreSebastien commented Aug 29, 2017

@archaeogeek

This comment has been minimized.

Copy link

@archaeogeek archaeogeek commented Apr 10, 2019

Hi,

I've also come across this, and can confirm that LIKE filters work just fine in mapserver 6.4 but cause mappyfile to fail.

Thanks

Jo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.