Comments (4)
I've just made a change so that the errors with the longest parse length are returned. It's not amazing error reporting, but it's a step in the right direction.
Every Failure to parse returns the structure below.
FLexer/src/FLexer.Core/Classifier.fs
Lines 28 to 31 in 9d321d6
The LastStatus field contains the information below. The TokenizerError field isn't used very well right now and is inconsistent, so don't rely on that.
FLexer/src/FLexer.Core/Classifier.fs
Lines 4 to 9 in 9d321d6
With the longest error being returned, by printing out the ConsumedWords list as shown in the FLexer.Example project, I can see that the Parser got this far:
*** *** *** *** *** *** *** *** *** *** *** *** *** ***
-------------------------------------------------------------------------------------
Rejected "SELECT Column1, Column2,,,NoColumn FROM Contacts"
LookaheadFailure
-- Consumed Text ------------------------------------------------------------------
Text Length
-------------------------------------------------------------------------------------
SELECT | 6
(Whitespace) | 1
Column1 | 7
, | 1
(Whitespace) | 1
Column2 | 7
, | 1
Ideally, FLexer should be able to support custom error messages being returned from any point, but I haven't quite been able to make that happen yet.
from flexer.
Performance comparison is an excellent question that I don't have an answer for immediately.
Error reporting is a little sparse right now beyond seeing how far the tokens could be read. The current example from the README here illustrates the lack of information.
// Rejected "SELECT Column1, Column2,,,NoColumn FROM Contacts"
//
// LookaheadFailure
//
// -- Consumed Tokens ----------------------------------------------------------------
// StartChar | EndChar | Text | Classification
// -------------------------------------------------------------------------------------
// 0 | 5 | SELECT | Select
I have some features regarding better error reporting in development, as well as making it easier to write more performant code. I can't say that FLexer will ever be always super fast, but it should be easy to get right.
FLexer is ultimately a recursive descent parser with infinite backtrack (a depth first search). With this approach, I'm putting the responsibility of being optimal on the developer. So, the happy path will be "right first try"; however, the potential to backtrack to the worst case still exists.
from flexer.
I can't promise anything on performance comparisons, but I'll ping you back here when I get better error reporting added in a few weeks.
from flexer.
from flexer.
Related Issues (1)
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 flexer.