Comments (3)
Agreed, it would be good if lrlex supported comments, and I'd happily take a PR to that effect! If flex supports them, I might also be inclined to support //
comments, but I don't feel strongly about it.
from grmtools.
Generally lrlex has focused on following the posix lex specification (but hasn't implemented comments yet if I recall),
my reading I didn't see any specific documentation of the comment format in lex, it is a little awkward, but generally mimics c-style comments but must be preceded by whitespace to avoid ambiguity with regexes. Except in cases where it is just a block of c code that gets copied verbatim.
Here are some examples, the latter showing some of the cases where initial whitespace is not required:
https://cs.gmu.edu/~henryh/330/Lex/comments.html
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/lex.html#tag_20_65_17
from grmtools.
So, I had noticed the text in #325 the following text in the posix lex spec:
Any such input (beginning with a or within "%{" and "%}" delimiter lines) appearing at the beginning of the Rules section before any rules are specified shall be written to lex.yy.c
Which is relevant to this bug, it would be easy enough to currently just ignore any line which starts with a space.
It seems like if we tried to emit these verbatim into generated sources, they would be in the middle of a vec![ Rule::new(), ..]
.
In order to actually emit them we'd need to change uses of struct Rule
to something like enum RuleOrVerbatim<StorageT>{ Verbatim(String), Rule(Rule<StorageT>)}
, as currently there isn't anywhere for them in our AST of the lex source format.
I believe Rule
is public but #[doc(hidden)]
and otherwise documented as unstable, so perhaps changing it to an enum is acceptable. But let me know if there are preferences here between emitting these verbatim or ignoring them entirely.
from grmtools.
Related Issues (20)
- GDB Support? HOT 5
- Explain why Copy is required for a type specified %parse-param HOT 7
- Nondeterministic generation of Rust code HOT 2
- Support lex-style definitions HOT 1
- Trying to replicate `tinylang.yy` and `tinylang.l` syntax with `nimbleparse` HOT 5
- Weird that `nimbleparse` works on `java7.y` `java7.l` even though the `GT` symbol in both is different. HOT 1
- Online Yacc/Lex editor/tester HOT 6
- Detailed debug info for reduce/reduce shift/reduce errors? HOT 27
- Docs Question - Optional Prefix to Regular Expressions HOT 5
- lrpar lose info about debug HOT 7
- nimbleparse:Suggestions for outputting information HOT 5
- lrlex: match beginning of line HOT 4
- lrpar:%prec not followed by token name HOT 11
- lpar:Unused rule HOT 6
- Is there a way to pass Conext in `$lexer` when doing action? HOT 3
- How to use the code generated by grmtools as a lib for others to use HOT 6
- Make generated parsers usable on the web HOT 2
- Errors in catching incorrectly terminated productions HOT 4
- Define lexemes in terms of other lexemes HOT 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 grmtools.