Skip to content

Add lexer for JMESPath#2175

Merged
jeanas merged 7 commits intopygments:masterfrom
mondeja:jmespath-lexer
Jul 5, 2022
Merged

Add lexer for JMESPath#2175
jeanas merged 7 commits intopygments:masterfrom
mondeja:jmespath-lexer

Conversation

@mondeja
Copy link
Copy Markdown
Contributor

@mondeja mondeja commented Jul 5, 2022

Closes #2174

@mondeja mondeja mentioned this pull request Jul 5, 2022
@mondeja mondeja marked this pull request as draft July 5, 2022 14:43
@mondeja mondeja marked this pull request as ready for review July 5, 2022 14:51
mondeja and others added 4 commits July 5, 2022 18:45
Co-authored-by: Jean Abou-Samra <jean@abou-samra.fr>
Co-authored-by: Jean Abou-Samra <jean@abou-samra.fr>
@jeanas jeanas merged commit 16921ee into pygments:master Jul 5, 2022
@jeanas
Copy link
Copy Markdown
Contributor

jeanas commented Jul 5, 2022

Thanks for the PR!

@innovate-invent
Copy link
Copy Markdown

This is a great start but fails for some syntax, like &expression-type.

Here is a sizeable example query:

[0].let({org: (annotations.organism || annotations.source)}, &(features[?type=='CDS' && qualifiers.translation].{id:
join('|', [
        (qualifiers.db_xref[?starts_with(@, 'GI')].['gi', split(':', @)[1]]),
        (qualifiers.protein_id[*].['ref', @]),
        (qualifiers.locus_tag[*].['locus', @]),
        join('', [':', [location][?strand==`-1`] && 'c' || '', to_string(sum([location.start, `1`])), '..', to_string(location.end)])
][][]),
seq: qualifiers.translation[0],
description: (org && join('', [qualifiers.product[0], ' [', org, ']']) || qualifiers.product[0])}))

@mondeja
Copy link
Copy Markdown
Contributor Author

mondeja commented Jul 8, 2022

Sure, do you've more examples of expression-type like before subexpression as in &(features)?

@innovate-invent
Copy link
Copy Markdown

https://github.com/jmespath-community/jmespath.spec/blob/main/functions/max_by.yml

@mondeja mondeja mentioned this pull request Jul 8, 2022
@mondeja
Copy link
Copy Markdown
Contributor Author

mondeja commented Jul 8, 2022

Great, opened #2179 to track it.

@Anteru Anteru added this to the 2.13.0 milestone Aug 14, 2022
@Anteru Anteru added the A-lexing area: changes to individual lexers label Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lexer for JMESPath

4 participants