Comments (14)
Did you have something in mind for how to handle this? Looking at the nom error management docs, the Merr pattern matching option seemed like a reasonable solution.
from angle-grinder.
from angle-grinder.
Looked into this a bit more -- we probably want to combine early-return from errors with merr. (Although merr might be overkill, the grammar is pretty stable)
from angle-grinder.
Cool. I'm finishing up a change to add the limit
operator. I can try the different approaches for errors and see how it goes after I'm done with limit.
from angle-grinder.
from angle-grinder.
The "merr" stuff in nom doesn't seem to be working anymore. The return_error!() macro seems to be sufficient, though. I'll try to put together something that handles a couple error cases, like non-terminated string and no column names for count by
and open a PR.
from angle-grinder.
If you have some time, can you check out this commit on my error-wip branch and say if you okay with the direction.
Here's a screenshot of the results so far:
from angle-grinder.
(this is from a fairly brief skim on my phone, more comments later)
First off, the results are gorgeous! I never would have thought to try to use the same library that rustc uses.
A couple of thoughts:
- I'm not in love with sticking postions ad-hoc into operators. What if we did something like:
WithPosition<T> {
position: [Positional information needed for syntax errors]
obj: T
}
We could have the parser return a seq of Positioned<Operator>
I think I'd prefer that strategy in general (wrapping objects with their positions) rather than having positional information leak into the underlying structs. We could even push that all the way down the execution engine for generating nice error messages at some point.
I'd also probably refactor the grammar a bit to push the positioning down a little bit so that you didn't need to create start and end tokens manually in most cases.
from angle-grinder.
eg.
Limit {
count: Positioned<f64>
}
WithPosition
can define into
for T
to easily extract the underlying type
from angle-grinder.
Another note: If it simplifies things, I'd be totally fine only exposing the first error in a pipeline
from angle-grinder.
I don't like the position stuff either. I like your proposal, I'll see if I can make it work.
from angle-grinder.
I've updated my error-wip branch if you want to take a look again. Let me know if that's fine for a PR or if you want me to break it up or do some more changes.
I was able to get your Positioned suggestion working by adding a with_pos!() parser that wraps the result of the child parser with a Positioned object. It's a definite improvement.
Thanks!
from angle-grinder.
from angle-grinder.
Main work is done in #44 , remaining tasks are incremental, closing.
from angle-grinder.
Related Issues (20)
- sort could cater for version numbers HOT 3
- windows support - `cargo install ag` failed HOT 3
- ag Crash Report HOT 2
- Allow filtering on missing variables HOT 1
- Be less eager to use live-updating table HOT 5
- Error self-updating from v0.15.0 to v0.16 HOT 3
- Version v0.16 does not build with rust >= 1.52 HOT 1
- Splitting within an ANSI color code causes all output to be printed in that color HOT 2
- Support reading from multiple files HOT 2
- Support tee-like output direction HOT 1
- Allow compound expressions in `where` HOT 5
- Error when parsing regex HOT 3
- Access to the raw input
- Support for applying sliding window to aggregates
- Support nodrop directive on split HOT 2
- Crash while parsing syslog for netfilter logs HOT 4
- Cargo.lock is not updated for 0.19.1 release HOT 1
- Crash while parsing netfilter using regex HOT 1
- Apache pipeline ignores log entries that do not contain "method url protocol" fields HOT 1
- Self update fails in command line install
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 angle-grinder.