jhauberg / lext Goto Github PK
View Code? Open in Web Editor NEWLEXT is Lexical Templates
License: MIT License
LEXT is Lexical Templates
License: MIT License
In the most basic cases, where a function is indeed only either successful or not, bool
should always be used.
In cases where a non-successful result carries more information, an enum should be used. For example, lxt_parse
, which can hit several different failures, should return which exact failure it hit (e.g. max containers, entries etc.).
It might even be worthwhile to go further than just simple enums and instead return stateful information so that the library can report exactly where and why something went wrong; e.g. parsing errors at line and column numbers. But that is probably better fit as a separate issue.
Some patterns won't resolve as expected because variables are not parsed properly in certain cases.
For example, the following pattern starts out with a variable @letter
; however, this particular variable happens to be followed by a comma, making the parser think it is part of the variable name (e.g. variable,
). In this case, it shouldn't be.
letter (a, b, c) seq <@letter, @letter, @letter>
I suppose a simple fix is to break on both isspace(..)
and any non-alphabet character (such as ,
, .
etc.).
Alternatively, require an escape for any character not part of the name- something like <@letter\, @letter\, @letter>
.
For example, currently, you specifically can't use either @
or >
literally in a generator sequence, because these, respectively, indicates either start of variable or end of sequence. It would be nice being able to escape these so they can be used as literals.
Similarly, this is also an issue in container entries, where you e.g. can't use commas (,
) because they would indicate end of entry.
You can get around the issue by limiting commas to sequences, and limiting variable/end of sequence symbols to only occur in entries, but generally, you'd probably expect just being able to escape these as literals.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.