Comments (6)
Why not reusing RBParser for all this parsing? It could be like:
methodNode := RBParser new
initializeParserWith: source;
parseMessagePattern.
methodNode source: source.
^methodNode selectorAndArgumentNames
from tonel.
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]
from tonel.
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...).
from tonel.
from tonel.
at least Gemstone and Squeak have MC.
(and I was targeting Gemstone compatibility)
from tonel.
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...
from tonel.
Related Issues (20)
- run tests on github actions HOT 1
- Tonel should not use MonticelloMocks package - but have own mocks
- Cleanup: Condense MonticelloTonel packages
- Check that there is no user of withSqueakLineEndings or friends
- Tonel doesn't support custom #compilerClass
- Tonel cannot write the attach method
- Conversion from filetree to tonel: package wrongly converted HOT 5
- Tonel ignores MCVersion package name
- Tonel breaks with dots after selector
- Shadow variable in TonelWriter
- Tonel does not check for duplicated methods in .tonel file HOT 1
- TonelWriter should use traceCr: HOT 2
- TonelWriter>>writeSnapshot: includes tag name in package name when there's no OrganizationDefinition HOT 1
- Improve can't parse error
- Missing License
- STON should depend on GitHub STON not STHub STON HOT 1
- Read/write problem when a method has certain "unfinished statements" HOT 3
- Category cleanups and alignments
- Better error report
- TonelWriter uses the platform line ending HOT 3
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 tonel.