 |
Bay Six Software Beyond the Basics
|
View previous topic :: View next topic |
Author |
Message |
Brent Site Admin
Joined: 01 Jul 2005 Posts: 793
|
Posted: Apr 14th, 2012, 6:48pm Post subject: Experiment - Multi-line string |
|
|
If you have looked over the recently uploaded grammar spec, you may have seen some bits I haven't discussed before. I'll first address one small production—String.
Code: | String
=
stringLiteral { stringLiteral }
. |
My intention is to allow multi-line strings, but not the way Run BASIC does it. RB lets you do this Code: | code$ = "<table>
<tr>
<td>"+first$+"</td>
<td>"+second$+"</td>
</tr>
</table>" | I have intentionally indented the HTML for better readability, but this can be problematic because RB preserves all of the spaces and line breaks. so, doing this enough times can result in unintentionally bloated output.
The equivalent in VF Code: | code$ = "<table>"_
_"<tr>"_
_"<td>"+first$+"</td>"_
_"<td>"+second$+"</td>"_
_"</tr>"_
_"</table>" | I feel this form is just as readable as the RB code, and it allows comments to be interspersed among the substrings. _________________ Brent |
|
Back to top |
|
 |
STPendl Full Member
Joined: 20 Aug 2007 Posts: 161 Location: Austria
|
Posted: Apr 14th, 2012, 7:01pm Post subject: Re: Experiment - Multi-line string |
|
|
RB is generating HTML, where spaces are consolidated anyways.
The VF way of doing this seems to be parser- and user-friendly
So the leading underscore could be positioned at the beginning of the line to include leading spaces? _________________ Stefan
Any code I post can be freely used, just give credit. |
|
Back to top |
|
 |
Brent Site Admin
Joined: 01 Jul 2005 Posts: 793
|
Posted: Apr 14th, 2012, 8:09pm Post subject: Re: Experiment - Multi-line string |
|
|
Stefan, the leading underscore is part of the stringLiteral token. Although Web browsers collapse whitespace, the bytes are still downloaded which can slow down page loads. _________________ Brent |
|
Back to top |
|
 |
|
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|