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

GSQL lexer syntax changes #2006

Merged
merged 5 commits into from
Dec 30, 2021
Merged

GSQL lexer syntax changes #2006

merged 5 commits into from
Dec 30, 2021

Conversation

gregoryg
Copy link
Contributor

pygmentize was hanging or taking minutes to parse certain GSQL code.

Syntax changes include: adding [], <>, and _ (square brackets, angle brackets and single underscore) to the Punctuation class.
The test for that fix is now include in tests/examplefiles/gsql/test.gsql

A one-liner to test for that fix:
CREATE QUERY tg_astar (VERTEX source_vertex, VERTEX target_vertex, SET<STRING> e_type, STRING wt_type, STRING latitude, STRING longitude,

The string regex was causing backtracking in some cases - simplified here.

In GSQL DDL, parameter such as $0, $"fieldname" and _ to indicate empty position are possible. They were being flagged as errors. The test for that change is also added to the test.gsql file

A one-liner to test the DDL syntax fix:
LOAD Inventory TO EDGE in_warehouse_inventory VALUES($"warehouse", $1, $_)

Reusing edge names for multiple usage requires using pipe as an operator. Pipe is now added to that section.

Test case was added to test.gsql

A one-liner test for edge name reuse :
ADD UNDIRECTED EDGE in_code(FROM City, TO PostalCode | FROM Correspondence, TO PostalCode | FROM Address, TO PostalCode);

@Anteru Anteru added this to the 2.11.0 milestone Dec 30, 2021
@Anteru Anteru merged commit 830d7ba into pygments:master Dec 30, 2021
@Anteru
Copy link
Collaborator

Anteru commented Dec 30, 2021

Thanks, that was one nasty case of catastrophic backtracking you fixed there!

@gregoryg gregoryg deleted the gsql-lexer branch December 30, 2021 16:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants