Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Experiment - Multi-line string

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Apr 14th, 2012, 6:48pm    Post subject: Experiment - Multi-line string Reply with quote

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
View user's profile Send private message Send e-mail
STPendl
Full Member


Joined: 20 Aug 2007
Posts: 161
Location: Austria

PostPosted: Apr 14th, 2012, 7:01pm    Post subject: Re: Experiment - Multi-line string Reply with quote

RB is generating HTML, where spaces are consolidated anyways.

The VF way of doing this seems to be parser- and user-friendly Wink

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
View user's profile Send private message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Apr 14th, 2012, 8:09pm    Post subject: Re: Experiment - Multi-line string Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language All times are GMT
Page 1 of 1
Jump to:  
Quick Reply
Username:
Message:
   Shortcut keys: Alt+Q to activate, Alt+P to preview, Alt+S to submit
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



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group