-
Notifications
You must be signed in to change notification settings - Fork 358
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
Add TOML language parser #4845
Conversation
rewrite-toml/src/main/java/org/openrewrite/toml/internal/TomlPrinter.java
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/TomlPrinter.java
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/TomlPrinter.java
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/TomlPrinter.java
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/TomlPrinter.java
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserListener.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/tree/TomlRightPadded.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlLexer.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParser.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserBaseListener.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserBaseVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserListener.java
Outdated
Show resolved
Hide resolved
rewrite-toml/src/main/java/org/openrewrite/toml/internal/grammar/TomlParserVisitor.java
Outdated
Show resolved
Hide resolved
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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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). |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
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