On Mon, 20 Dec 2010 10:26:16 +0100
"Johannes Pfau" <s...@example.com> wrote:

> Hi,
> I'm currently patching Ragel (http://www.complang.org/ragel/) to generate  
> D2 compatible code.

Interesting. Ragel-generated code works fine for me in D2. I suppose it mostly 
uses such a restricted C-like subset of language that it didn't change much 
from D1 to D2. But if you are going to patch it, please make it add extra {} 
around action code! The thing is that when there is a label before {} block 
(and in ragel generated code I saw it's always so) the block isn't considered 
as a new scope which causes problems when you have local variables declaration 
inside actions.

Anyway, good luck with whatever you plan :) Ragel is cool.

> Right now it creates output like this for static  
> arrays:
> ------------------------
> enum ubyte[] _parseResponseLine_key_offsets = [
>       0, 0, 17, 18, 37, 41, 42, 44,
>       50, 51, 57, 58, 78, 98, 118, 136,
>       138, 141, 143, 146, 148, 150, 152, 153,
>       159, 160, 160, 162, 164
> ];
> ------------------------
> Making it output "enum ubyte[30]" would be more complicated, so I wonder  
> if there's a difference between "enum ubyte[]" and "enum ubyte[30]"?

One is fixed size array and other is dynamic. Honestly I doubt that it matters 
for code generated by Ragel, since this is constant and won't be passed around. 
If it's harder to make it fixed-size then don't bother.

-- 
Nick Voronin <elfy...@gmail.com>

Reply via email to