I don't have the code handy, but in the past I've extended RBParser to
treat {} as a code block. It was a lot less work than I was afraid it
would be.
In a nutshell, the changes I had to make were:
* Send RBScanner the message "initializeChars: '{}' to: #special",
probably in a class-side #initialize somewhere.
* Create an RBProgramNode subclass to handle brace-constructor
blocks. I subclassed RBBlockNode with something like
RBBraceConstructionNode. The only method you really need to implement
is #acceptVisitor: to send its argument a message called
#acceptBraceConstructionNode:.
* Override RBParser>>parsePrimitiveObject to with a statement like
"currentToken value == ${ ifTrue: [^self parseBraceConstructor]."
* Implement RBParser>>parseBraceConstructor to construct an instance
of RBBraceConstructorNode, using RBParser>>parseBlock as a guide
(omitting the messages that parse block arguments and so on.)
* Implement #acceptBraceConstructionNode: on the formatter subclass,
with something like "self bracketWith: '{}' around: [self formatBlock:
aNode"
Hope that helps, and if anyone has a cleaner solution I'd love to hear it.
- Ash
On Wed, Apr 22, 2009 at 7:12 PM, Stevenson, Dave (Contr)
<
[hidden email]> wrote:
>
> Anyone know how to make BraceConstructor and the formatter in 7.6 play nice?
>
> Formatter gives unknown symbol error. I can accept without formatting, but formatting is nice to have.
>
> Stevenson, Dave (contr) <
[hidden email]>
> 972-946-4890
>
> _______________________________________________
> vwnc mailing list
>
[hidden email]
>
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc>
--
http://twitter.com/smashwilson_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc