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

Refactor antlr tool #207

Merged
merged 8 commits into from
Jan 28, 2021
Merged

Refactor antlr tool #207

merged 8 commits into from
Jan 28, 2021

Conversation

BillWagner
Copy link
Member

I'm making updates to the grammar extraction tool and batch file to make this easier to run as a github action.

Rework the bat file to generate an ANTLR file, and update the grammar in the standard.

Note that this does pick up a couple PRs that affected the grammar.
I think this will help us validate the grammar and fix validation errors.
@@ -0,0 +1,2274 @@

// Source: 7.3.1 General
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RexJaeschke @jskeet @gafter Will these comments help us to validate the ANTLR grammar? I added them to Rex's work on the grammar extraction tool because they helped me get started. I can leave this output in place if we think it will be useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of validation, I like the idea of keeping them just to make things easier for anyone reading the standard.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep; looks good to me.

@BillWagner BillWagner marked this pull request as ready for review January 27, 2021 20:16
@BillWagner
Copy link
Member Author

BillWagner commented Jan 27, 2021

Marking this ready for review. See #217 for my proposal on what to do next.

/cc @RexJaeschke @jskeet

Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits, but otherwise fab.

tools/update-grammar-annex.sh Outdated Show resolved Hide resolved
.github/workflows/grammar-vlidator.yaml Outdated Show resolved Hide resolved
@@ -10,6 +10,7 @@ This annex contains the grammar productions found in the specification, includin

```ANTLR

// Source: §7.3.1 General
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wonderful

while ((inputLine = Console.ReadLine()) != null)
{
if (inputLine.Length < 8) // Is it long enough to contain an opening fence?
while ((inputLine = await inputFile.ReadLineAsync()) != null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a new pattern yesterday:

while (await inputFile.ReadLineAsync() is string inputLine)

(and remove the earlier declaration).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!

tools/validate-grammar.sh Show resolved Hide resolved
@BillWagner BillWagner merged commit b1a874e into draft-v6 Jan 28, 2021
@BillWagner BillWagner deleted the refactor-antlr-tool branch January 28, 2021 14:54
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.

3 participants