Skip to content

Conversation

@Iain-S
Copy link
Contributor

@Iain-S Iain-S commented Oct 29, 2023

Summary

Add lexer for Kusto.

Also corrects a minor typo in the docs.

Checks

  • tox tests pass
  • Run tox -e mapfiles

Linting

  • black
  • flake8
  • isort

Closes

This (hopefully) closes #2098

Further Work \ Known Limitations

  • There are other number formats, such as 1e5, which we don't currently support.
  • Datetime literals (e.g. datetime(2015-12-31) should all be treated as a single literal but we simply mark datetime as a keyword.
  • Normal or verbatim strings can be obfuscated by pretending either h or H but we ignore this and would treat h/H as a name.

@Iain-S
Copy link
Contributor Author

Iain-S commented Nov 6, 2023

I've made the suggested changes. Let me know if you want me to squash any commits.

@jeanas
Copy link
Contributor

jeanas commented Nov 7, 2023

@Iain-S I've pushed a commit, mostly to make the code style more like the rest of the code base (note that we do not use Black).

I've also noticed that this state:

        "multi_string": [
            (r"[^`]+", String),
            (r"```", String, "#pop"),
        ],

does not allow single backticks inside ```-delimited strings. I suppose this is not intentional, right? In that case, it needs an extra rule (r"`", String)`.

@Iain-S
Copy link
Contributor Author

Iain-S commented Nov 7, 2023

I suppose this is not intentional, right? In that case, it needs an extra rule (r"`", String)`.

True, that was an oversight. I've added your suggested tuple and a test to confirm that it works.

@jeanas jeanas merged commit 7e8b3a9 into pygments:master Nov 7, 2023
@jeanas
Copy link
Contributor

jeanas commented Nov 7, 2023

LGTM now, thank you.

@Anteru Anteru added this to the 2.17 milestone Nov 7, 2023
@Anteru Anteru added A-lexing area: changes to individual lexers changelog-update Items which need to get mentioned in the changelog labels Nov 7, 2023
@jeanas jeanas removed the changelog-update Items which need to get mentioned in the changelog label Nov 7, 2023
@Iain-S Iain-S deleted the kusto branch November 12, 2023 22:50
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 kusto (.csl and .kusto).

3 participants