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

Add WKT generation based on hypothesis[lark] #219

Open
cleder opened this issue Mar 26, 2024 · 2 comments
Open

Add WKT generation based on hypothesis[lark] #219

cleder opened this issue Mar 26, 2024 · 2 comments

Comments

@cleder
Copy link
Owner

cleder commented Mar 26, 2024

Use the Lark hypothesis extension to generate WKT from EBNF to improve hypothesis test cases.

@cleder
Copy link
Owner Author

cleder commented Mar 26, 2024

@cleder
Copy link
Owner Author

cleder commented Dec 2, 2024

Lark grammar:

// Simplified WKT Grammar for basic geometric shapes

// Ignore whitespace
%import common.WS
%import common.SIGNED_NUMBER
%ignore WS

?start: well_known_text_representation

well_known_text_representation: point_text_representation
                             | linestring_text_representation
                             | polygon_text_representation
                             | multipoint_text_representation
                             | multilinestring_text_representation
                             | multipolygon_text_representation
                             | geometrycollection_text_representation

point_text_representation: "POINT" z_m? point_text

linestring_text_representation: "LINESTRING" z_m? linestring_text

polygon_text_representation: "POLYGON" z_m? polygon_text_body

multipoint_text_representation: "MULTIPOINT" z_m? multipoint_text

multilinestring_text_representation: "MULTILINESTRING" z_m? multilinestring_text

multipolygon_text_representation: "MULTIPOLYGON" z_m? multipolygon_text

geometrycollection_text_representation: "GEOMETRYCOLLECTION" z_m? geometrycollection_text

point_text: empty_set | "(" point ")"

point: x y z? m?

x: SIGNED_NUMBER
y: SIGNED_NUMBER
z: SIGNED_NUMBER
m: SIGNED_NUMBER

linestring_text: empty_set | "(" point ("," point)* ")"

polygon_text_body: empty_set | "(" linestring_text ("," linestring_text)* ")"

multipoint_text: empty_set | "(" point_text  ("," point_text)* ")"

multilinestring_text: empty_set | "(" linestring_text ("," linestring_text)* ")"

multipolygon_text: empty_set | "(" polygon_text_body ("," polygon_text_body)* ")"

geometrycollection_text: empty_set | "(" well_known_text_representation ("," well_known_text_representation)* ")"

empty_set: "EMPTY"

z_m: "ZM" | "Z" | "M"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant