On Thu, Oct 23, 2014 at 8:42 AM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
Le 23/10/2014 08:23, phil@highoctane.be a écrit :
On Thu, Oct 23, 2014 at 8:17 AM, Thierry Goubier <thierry.goubier@gmail.com <mailto:thierry.goubier@gmail.com>> wrote:
Le 23/10/2014 08:09, phil@highoctane.be <mailto:phil@highoctane.be> a écrit :
How hard would it be to parse such a file with this kind of content?
https://github.com/mitsuhiko/__flask/blob/master/examples/__ minitwit/minitwit.py <https://github.com/mitsuhiko/flask/blob/master/examples/ minitwit/minitwit.py>
Not hard. A bit of work on PythonParser2.
Well, I meant "a file like this in Smalltalk" :-) Still, a cool idea of yours!
That in Smalltalk may be better, especially to induce people to extend it with Pharo afterwards :)
That's the idea indeed.
But Pharo has issues with long methods (such as a single, long file). I wrote some code to split methods for SmaCC at the AST level (parse, split, create sub-methods, replace code with call to method, compile), but it works in SmaCC generated code; I didn't really try to make it general.
How long is long? Now, the point is to see all that as a stream, cut methods at appropriate places and compile code under a WAComponent subclass. I don't know about SmaCC but I think I can do something with PetitParser and Smalltalk compile: Phil
This would generate a WAComponent subclass with methods in it, register the thing and go for it.
The level of Python in it look not too difficult to convert. But it relies on a framework for which I can't answer. What is jinja ?
Jinja is the template engine: http://jinja.pocoo.org/
Ok,
Thierry