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

TEL parser tweaks + standardized AST nodes (to abstract ANTLR from users) #13

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

dvdotsenko
Copy link

@dvdotsenko dvdotsenko commented Nov 9, 2020

What Changed:

  • split g4 into separate Lexer and Parser files (originally to allow reuse of Lexer file in more ambitious Parser. That parser not included in this PR).
  • converted majority of expr into left, operator , right format to simplify Visitor logic.
  • Embedded a markup-to-AST Visitor into this repo (to allow simple reuse in non-Diesel code).
  • Expanded tests from "does not blow up" into "let's see that it parsed the right thing
  • added support for IN , LIKE ILIKE to TEL expressions. (these are allowed as Filter expressions in Blending Husky and are very commonly used by users in normal TEL).
  • added syntax error detailing logic that highlights the issue in fragment:
    pql_grammar.from_pql.ParseError: Unexpected "ilike" (positions 3 to 7) in fragment "a -->ilike<-- 'asdf'" (See TelErrorListener - allows init without need to pass input stream to it.

Goals:

  • add "standard" markup-to-ast visitor to TEL_Grammar repo to allow simple reuse in scripts.
  • "standardize" simple / serializable "light" AST for expressing (NOT validating, NOT transformation) the contents of TEL, basic traversal through it, tools to find nodes in it easily - all to help in reuse of this code in stand-alone scripts outside of Husky.
  • add support for extra keywords while we are at it.

…ed" properly

This is different from raw_value which may have original text, spacing and different quotation. .value is pure synthetically-re-assembed taxon expression value
…d visit(node) style. More in-line with ANTLR way of doing things.
@dvdotsenko dvdotsenko changed the title PQL Parser - SQL-like dialect that combines TEL + SQL = Husky proto expression TEL parser tweaks + standardized AST nodes (to abstract ANTLR from users) Dec 8, 2020
Reduces noise in the file, allows better reuse of visitor
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