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 TOML language parser #4845

Merged
merged 4 commits into from
Jan 3, 2025
Merged

Add TOML language parser #4845

merged 4 commits into from
Jan 3, 2025

Conversation

shanman190
Copy link
Contributor

@shanman190 shanman190 commented Jan 3, 2025

What's changed?

Implemented a language parser for TOML.

What's your motivation?

Finished implementation that was started in #4678. After speaking with @steplica, he felt that he didn't have the time to finish up the implementation and didn't feel the need for direct credit (but credit still here!), but sincerely appreciated the exercise and assistance in #4678 working through how to build a parser and the inner workings of the language bindings.

Anything in particular you'd like reviewers to focus on?

LST structure, other issues

Anyone you would like to review specifically?

Anybody is welcome. :)

Have you considered any alternatives or workarounds?

In #4678, there is an initial implementation. Concurrently with Steve, I was working on my own copy of the TOML parser. As you can see, the implementations diverged slightly, but are still true to the same common grammar.

Any additional context

None

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

timtebeek and others added 2 commits January 3, 2025 20:33
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ar/TomlParserVisitor.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
import static java.util.Collections.emptyList;

/**
* Wherever whitespace can occur in JSON, so can comments (at least block style comments).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Wherever whitespace can occur in JSON, so can comments (at least block style comments).
* Wherever whitespace can occur in TOML, so can comments (at least block style comments).

Copy link
Member

@sambsnyd sambsnyd left a comment

Choose a reason for hiding this comment

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

Nice work!

int5 = 1_000

# hexadecimal with prefix `0x`
hex1 = 0xDEADBEEF
Copy link
Member

Choose a reason for hiding this comment

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

Ah the classic 0xDEADBEEF I was so baffled/amused the first time I saw that value while debugging

@sambsnyd sambsnyd merged commit 02411bd into main Jan 3, 2025
2 checks passed
@sambsnyd sambsnyd deleted the feature/toml-language-parser branch January 3, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants