Giter VIP home page Giter VIP logo

Comments (6)

Gankra avatar Gankra commented on September 2, 2024 1

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.

zkat avatar zkat commented on September 2, 2024

oh this one's gonna be tricky to get a good error out of ๐Ÿค”

from kdl-rs.

Gankra avatar Gankra commented on September 2, 2024

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.

zkat avatar zkat commented on September 2, 2024

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.

Gankra avatar Gankra commented on September 2, 2024

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.

zkat avatar zkat commented on September 2, 2024

This feature has been tagged and released as [email protected] :)

from kdl-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.