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

Allow validation of CONFIG files #149

Open
geographika opened this issue Mar 30, 2022 · 1 comment
Open

Allow validation of CONFIG files #149

geographika opened this issue Mar 30, 2022 · 1 comment
Assignees

Comments

@geographika
Copy link
Owner

And add these to https://mappyfile.geographika.net/
Quickly find cause of getString(): Symbol definition error. Parsing error near (:):(line 4) (in this case due to an extra quote).

CONFIG
  ENV
        MS_MAP_PATTERN "."
	PROJ_LIB" "C:/MapServer/bin/proj7/SHARE"
  END
END
@geographika geographika self-assigned this Mar 30, 2022
@geographika
Copy link
Owner Author

geographika commented Jan 12, 2024

SYMBOLSET files are already supported by the parser - see code at:

start: "SYMBOLSET"i composite_body _END -> symbolset

For parsing a MapServer CONFIG file (see https://mapserver.org/mapfile/config.html) a new test branch has been created at: https://github.com/geographika/mappyfile/tree/config-parser

The current approach is to create a separate grammar file - https://github.com/geographika/mappyfile/blob/config-parser/mappyfile/configfile.lark

A new parameter is then passed to the Parser:

is_config: bool = False,

Keeping the grammars separate seems to make sense as the two files have different keywords and purposes. The Transformer however is reused.
Selecting the correct grammar file could perhaps be automated by checking the first string value in input file?

There are a few issues in the current branch around strings and quoting. All CONFIG examples seem to have the keywords unquoted, so perhaps only this should be supported. All values should be quoted.

@geographika geographika changed the title Allow validation of CONFIG and SYMBOLSET files Allow validation of CONFIG files Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant