mirror of
https://github.com/corn-config/corn.git
synced 2026-07-11 05:16:10 +01:00
[PR #43] Semi rewrite #43
Labels
No labels
bug
bug
documentation
enhancement
enhancement
pull-request
tooling
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
corn-config/corn#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/corn-config/corn/pull/43
Author: @puppymati
Created: 6/15/2025
Status: 🔄 Open
Base:
master← Head:semi-rewrite📝 Commits (10+)
2f7b71dClean up cargo manifestd2b29f6Add implementation for Value008abd7Make object and integer public27daca2Fix too compact testsd1269c8Implement a full lexer56abcf6Add more exaustive integer parsing6420c79Implement a lalrpop parser24926a0Expose error to library rootc9bdf52Mark integer as repr transparent80abd83Make the lexer and parser borrow the input📊 Changes
160 files changed (+2203 additions, -3665 deletions)
View changed files
📝
.github/workflows/ci.yml(+2 -2)➕
.gitmodules(+3 -0)📝
Cargo.lock(+484 -453)📝
Cargo.toml(+43 -38)➖
assets/inputs/array.corn(+0 -3)➖
assets/inputs/basic.corn(+0 -3)➖
assets/inputs/basic_empty_let.corn(+0 -3)➖
assets/inputs/boolean.corn(+0 -4)➖
assets/inputs/chained.corn(+0 -3)➖
assets/inputs/chained_complex.corn(+0 -8)➖
assets/inputs/char.corn(+0 -3)➖
assets/inputs/comment.corn(+0 -4)➖
assets/inputs/compact.corn(+0 -15)➖
assets/inputs/complex.corn(+0 -56)➖
assets/inputs/complex_keys.corn(+0 -9)➖
assets/inputs/environment_variable.corn(+0 -3)➖
assets/inputs/float.corn(+0 -4)➖
assets/inputs/input.corn(+0 -18)➖
assets/inputs/input_references_input.corn(+0 -6)➖
assets/inputs/integer.corn(+0 -5)...and 80 more files
📄 Description
This PR is a major rewrite of the parser that comes with many improvements and changes. At its core, the main change is the underlying technology.
Instead of using a Pest grammar which is hard to maintain and read, the new parser separates the steps into a proper lexer using Logos and a simple but very efficient parser using LALRPOP. This gets turned into an AST which also allows for more efficient and streamlined implementation of the deserializer.
The parser is largely backwards compatible except where the old parser was wrong. The new parser should be more correct, and some tests have been updated to reflect that. The value enum has also been updated to be more ergonomic and easier to use.
There are a few breaking changes that improve the syntax and were agreed upon beforehand:
truefalsewon't work anymore"$var"→"${var}""\u{FFFD}"Enhanced Integer Parsing Support:
There might be other changes that are more of a result of the older parser not properly respecting the spec at times.
The changes should address all the concerns highlighted in #42.
There are other changes planned and more extensive error handling which will be implemented in other PRs. The new code should allow much easier extensibility.
Lua is fully working, the CLI has been updated too. WASM support is now fully working and fixed.
Overall, the new code is more readable, maintainable, correct, more efficient and possibly even faster, although that wasn't the goal of this rewrite.
Resolves #42
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.