1. RE: SMEL heredoc syntax ATTEN: tommy
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Jan 06, 2004
- 356 views
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? -- Tommy Carlier tommy online: http://users.pandora.be/tommycarlier
2. RE: SMEL heredoc syntax ATTEN: tommy
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Jan 06, 2004
- 373 views
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
3. RE: SMEL heredoc syntax ATTEN: tommy
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Jan 06, 2004
- 352 views
I have added the HereDocText-construction to SMEL. To implement it, you have to use a $, followed by an identifier (starts with a letter, and only contains letters, numbers, _ and -). In the following example, a HereDocText-value with delimiter END_OF_CODE is used: <smel version='1.1'> app(!MyApplication) { function(!MyFunction, params='object a, sequence b') { "-- Some regular double quote-delimited text" '-- Some regular single quote-delimited text and ' $ END_OF_CODE if sequence(a) then return a else return b end if END_OF_CODE } /* end of function */ } /* end of app */ -- Tommy Carlier tommy online: http://users.pandora.be/tommycarlier