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 a line protocol syntax lexer #861

Open
1 task done
jstirnaman opened this issue Sep 25, 2023 · 0 comments
Open
1 task done

Add a line protocol syntax lexer #861

jstirnaman opened this issue Sep 25, 2023 · 0 comments
Labels
help wanted lexer missing Missing a lexer, please contribute

Comments

@jstirnaman
Copy link

jstirnaman commented Sep 25, 2023

Is there an existing issue for this?

  • I have searched the existing issues

What is the missing lexer?

Line protocol time series data syntax.

<?xml version="1.0" encoding="UTF-8"?>
<!-- The following draft is an untested lexer definition for the line protocol time series data structure syntax. -->
<!-- https://docs.influxdata.com/influxdb/cloud-dedicated/reference/syntax/line-protocol/ -->
<lexer name="line-protocol">
    <states>
        <state id="default">
            <!-- Comments (start with #) -->
            <rule regex="#[^\\n]*" scope="comment" />
            <!-- Measurement Name (alphanumeric) -->
            <rule regex="^[a-zA-Z_][a-zA-Z0-9_]*," scope="measurement" />
            <!-- Field Keys (alphanumeric) -->
            <rule regex="[a-zA-Z_][a-zA-Z0-9_]*=" scope="field-key" />
            <!-- Field Values (numbers, strings) -->
            <rule regex="[-+]?(\d+\.\d*|\.\d+|\d+)([eE][-+]?\d+)?" scope="field-value" />
            <rule regex="\"[^\"]*\"" scope="field-value" />
            <!-- Tags (key=value pairs) -->
            <rule regex="[a-zA-Z_][a-zA-Z0-9_]*=[a-zA-Z0-9_]+" scope="tag" />
            <!-- Timestamp (integer) -->
            <rule regex="\d{10}" scope="timestamp" />
            <!-- Delimiters -->
            <rule regex="[,\s]" />
        </state>
    </states>
</lexer>

Links to existing syntax definitions

The line protocol definition: https://docs.influxdata.com/influxdb/cloud-dedicated/reference/syntax/line-protocol/
An EBNF representation of line protocol: https://github.com/influxdata/line-protocol/blob/v2/line-protocol.ebnf

@jstirnaman jstirnaman added help wanted lexer missing Missing a lexer, please contribute labels Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted lexer missing Missing a lexer, please contribute
Projects
None yet
Development

No branches or pull requests

1 participant