-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-line comments etc. #2
Conversation
…te, the Reader pattern can outperform parsing from a string.
Codecov Report
@@ Coverage Diff @@
## master #2 +/- ##
==========================================
- Coverage 94.73% 74.54% -20.2%
==========================================
Files 1 1
Lines 57 220 +163
==========================================
+ Hits 54 164 +110
- Misses 1 43 +42
- Partials 2 13 +11
Continue to review full report at Codecov.
|
The bad:
The good:
Conclusion: What I can offer is to implement the best part of this PR which imho is the interface change from a |
Of course, I completely understand. I had already made these changes and thought I'd run them past you, it didn't occur to me that a pull request might not be the best place to do this. Thanks very much for taking the time to review and respond with such useful information. |
Hello,
I've incorporated comment parsing, both single and multi-line directly into the CodeTree parser, while this does reduce the agnosticism of the CodeTree format a bit I believed it was the optimal place to do it. I'm also allowing multi-file input and recording the type, line number and filename of each node with a view to generating CSS sourcemaps from Scarlet.
Possibly contentious: I've changed the main parsing loop to a finite(ish) state machine reading a byte at a time from a Reader. I think using a Reader is more idiomatic, versatile and, assuming the file is re-read every time which in the wild it would be, optimal as there's less copying going on. See commit for benchmarks. However this may be undesirable if it begins to carry the project away from an ideal of beautiful simplicity that you've certainly achieved, if so I understand completely.