Comments (6)
For reference I am constantly making this mistake typing out examples for kdlscript because I made it look SO CLOSE to rust that my brain forgets I'm writing kdl lol.
from kdl-rs.
oh this one's gonna be tricky to get a good error out of ๐ค
from kdl-rs.
I think maybe one good way to detect it is to extend the internal grammar to accept idents in argument position and then emit an error whenever you successfully parse such an item.
But I'm not sure if there's some fundamental ambiguity you're trying to avoid by requiring quoting of strings.
from kdl-rs.
No, I think your idea might actually work pretty well! I can't think of anything in the grammar that would prevent idents from being treated as string values.
from kdl-rs.
Nice I got it working!
Before
Error:
ร Expected valid node terminator.
โญโ[7:1]
7 โ
8 โ struct Vec { }
ยท โโโโฌโโโ
ยท โฐโโ parsed node
โฐโโโโ
help: Nodes can only be terminated by `;` or a valid line ending.
After
thread 'parser::node_tests::errant_ident' panicked at 'failed to parse:
ร Expected a valid node entry.
โญโโโโ
1 โ struct Vec { }
ยท โโฌโ
ยท โฐโโ plain identifiers can't be used here
โฐโโโโ
help: If this was supposed to be a string, wrap it in quotes.
If this was supposed to be a new node, terminate the previous node with `;` or `}`
from kdl-rs.
This feature has been tagged and released as [email protected]
:)
from kdl-rs.
Related Issues (20)
- Type annotations are ignored HOT 2
- Derive for KDL HOT 1
- Unquoted strings cause hard to reason about KDL error HOT 2
- Expose `identifier`, `node_value`, etc. functions? HOT 1
- Query API
- Better formatter
- Test against main kdl compliance test suite. HOT 1
- Custom float printer for consistent default float printing
- Kaydle is mentioned in the README but the only version has been yanked. HOT 3
- `KdlEntry::clear_fmt` does not clear all formatting
- Cannot easily format nodes if std::fmt::Display is in scope
- Odd error span with invalid float HOT 4
- `doc.to_string().parse()` is not idempotent HOT 1
- Insertion/removal behavior HOT 2
- `result.replace("\n", "\r\n")` for `KdlDocument::to_string` on Windows HOT 1
- Insert into dash-val block HOT 1
- raw string formatter is broken
- port to winnow
- Continue parsing on parse error and collect all parse errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kdl-rs.