mirror of https://github.com/tbklang/tlang.git
⚡ Feature: Comment support #171
Labels
No Label
dependency
emit
hashmapper
lebanonmapper
lexer
meta
needsfix
parser
qol
question
resolution
typing
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 1 day 4 hours
Due Date
deavmi
1 day 4 hours
Dependencies
No dependencies set.
Reference: tlang/tlang#171
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose ✍️
To add support for comments and have them attach to the nearest AST node.
Checklist 🗒️
CommentParser
that understands both/**
(multi-line) and//
(single-line) commentsComment
s in the right places at the right times, within theParser
@<param>
to span multiple lines till next2
is encounteredParser
to maybe use previous-token checks rather than what is on stack, for checking for comments. We need to keep track ofprevToken
maybe, and then on-demand "Is there aSymbolType.COMMENT
inprevToken
?".Comment
, and return itnextToken()
, etc. methods (this will storethis.prevToken
for us)Working on ther comment sdtack now
Will continue tomorrow
Working on the
CommentParser
now...CommentParser
looks like it is working for multi-line.Now need to add singl-line support.
Working on parsing things like
@param i This is stuff
Damn man, why is this such a dogshit implementation. It is so ugly, let me do it propetly:
Look at that, doc string parsing!
Working on adding support for
@returns
parsing now...Added ✅
Added some fixes here and there
Tomorrow I will continue. I am also working on it in a nicer refactored parser for now and I am much happier with how the code is looking now.
Neatening some things up
Done ✅
Came up with a method to improve how comments are matched in the
Parser
.The
this.prevToken
won't necessarily work.Or it may, I could be wrong, it's just where you hoist the comment out from, or when
Fixing single line extraction...
Comments
Parser
Fixed ✅
Cleaned up more of the parsing to handle a lot of more edge cases and neatly return the doc s
Done for tonight 😴
Working now on unittests for the comment parsing. These will be placed within the
parsing/core.d
I want to have this be an early commit. I know I have not yet implemented run-on-lines doc-strings but I am not so sure how urgent that is right now.