-
Notifications
You must be signed in to change notification settings - Fork 26
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
Methods with comments in args can be written wrongly #50
Comments
Why not reusing RBParser for all this parsing? It could be like: methodNode := RBParser new
initializeParserWith: source;
parseMessagePattern.
methodNode source: source.
^methodNode selectorAndArgumentNames |
The main method can be rewritten as: TonelWriter>>splitMethodSource: aMethodDefinition into: aBlock
| source methodNode declaration body |
source := aMethodDefinition source.
methodNode := RBParser new
initializeParserWith: source;
parseMessagePattern.
methodNode source: source.
declaration := methodNode selectorAndArgumentNames.
body := source allButFirst: methodNode bodyStart - 1.
aBlock
value: (declaration trimLeft withLineEndings: self newLine)
value: (body withLineEndings: self newLine) It requires fix in #selectorAndArgumentNames because it does not take into account comments before selector. And it requires #bodyStart: RBMethodNode>>bodyStart
^ self arguments
ifEmpty: [self keywordsPositions first + self selector size]
ifNotEmpty: [self arguments last stop + 1] |
That was like that in the first version. |
I also thought that the reason of inlined parsing could be portability. But
then I found Monticello dependency.
So how you think it can be portable?
If MCDefinition's are supposed to be dialect specific then we can move this
logic to them. Something like:
aMethodDefinition withDeclarationAndBodyDo: [:declaration :body | ]
чт, 20 сент. 2018 г., 13:57 Esteban Lorenzano <[email protected]>:
… That was like that in the first version.
But... so far that's not possible because Tonel is designed to be ported
to different dialects and some of them do not have RBParser available (we
could put that into a dialect dependent package, but well...).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#50 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHxaoMeRZ15iv5xZM75YB5vHKhFZCOD2ks5uc5DTgaJpZM4Wxwi1>
.
|
at least Gemstone and Squeak have MC. |
We've got RBParser as well and I have just about finished creating an RBParser-based Tonel reader for Rowan ... I can share the RBParser implementation (NewTonelParser. RBTonelParser, and RBTonelScanner) if there's interest... |
Following tests are failed:
Problem with algorithm which extracts method name line from sources:
The text was updated successfully, but these errors were encountered: