RE: SMEL heredoc syntax ATTEN: tommy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Tommy Carlier wrote:
> Isaac, I'll see what I can do with that. The problem is that the 
> SMEL-parser reads SMEL-code character per character. And to implement 
> the 
> heredoc-construction the parser will have to read several characters 
> ahead 
> to know where the end is. Heredoc is easy to implement on a line-based 
> system (which reads lines), but SMEL is a character-based system. And 
> when 
> you say <<<END, the parser will have to read the END-string. Where does 
> the END-string end and the actual text-data begin?

I may have found a way to implement a construction that functions like 
the heredoc-construction. It begins with >ID and ends with ID: ID is an 
identifier that you can chose yourself (can ofcourse not occur in the 
text-data).
Example:
app(id=!MyApp start=!MyWindow)
{
window(id=!MyWindow size=[300,200] caption='My Window')
{
button(id=!MyButton1 location=[10,10] size=[50,20] caption='Close 1');
button(id=!MyButton2 location=[70,10] size=[50,20] caption='Close 2');

event(for=!MyWindow type=!OnClosing id=!MyWindow_Close);
event(for=[!MyButton1,!MyButton2] type=!OnClick id=!MyButtonX_Click);
}

procedure(id=!MyButtonX_Click params='object sender')
{ > PROCEDURE_MYBUTTONX_CLICK
if sender = MyButton1 then
wPuts(MyWindow, "Clicked MyButton1, closing...")
elsif sender = MyButton2 then
wPuts(MyWindow, "Clicked MyButton2, closing...")
end if
closeWindow(MyWindow)
PROCEDURE_MYBUTTONX_CLICK
}

procedure(id=!MyWindow_Close params='object sender')
{ > PROCEDURE_MYWINDOW_CLOSE
wPuts(MyWindow, "You can't see this because the window is closing.")
PROCEDURE_MYWINDOW_CLOSE
}
}
______________
tommy online: http://users.pandora.be/tommycarlier

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu