Re: LC Server: shebang breaks tags?

2020-02-10 Thread Richard Gaskin via use-livecode

Monte Goulding wrote:

>> On 11 Feb 2020, at 6:10 am, Richard Gaskin wrote:
>>
>> Can the merge function be extended to support scripts interleaved
>> between blocks of non-code?
>>
>> e.g. this works in Server, and not in Merge:
>>
>> 
>> This is some non-code
>> 
>> Some other non-code
>> 
>
> I suspect it could but might require merge to do two parses to execute
> server style then execute merge style so in the end it might be better
> to have a separate function. A way to just parse once and execute
> multiple times like a regular script would be useful. Perhaps the
> engine could maintain a stack of compiled server style scripts like it
> does for regex. I’m not overly sure it adds a great deal to the
> platform though. Probably use cases for this are better served my
> multi-line string literals.

Like heredoc?

https://quality.livecode.com/show_bug.cgi?id=17471

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LC Server: shebang breaks tags?

2020-02-10 Thread Monte Goulding via use-livecode


> On 11 Feb 2020, at 6:10 am, Richard Gaskin via use-livecode 
>  wrote:
> 
> Can the merge function be extended to support scripts interleaved between 
> blocks of non-code?
> 
> e.g. this works in Server, and not in Merge:
> 
> 
> This is some non-code
> 
> Some other non-code
> 

I suspect it could but might require merge to do two parses to execute server 
style then execute merge style so in the end it might be better to have a 
separate function. A way to just parse once and execute multiple times like a 
regular script would be useful. Perhaps the engine could maintain a stack of 
compiled server style scripts like it does for regex. I’m not overly sure it 
adds a great deal to the platform though. Probably use cases for this are 
better served my multi-line string literals.

Cheers

Monte
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LC Server: shebang breaks tags?

2020-02-10 Thread Richard Gaskin via use-livecode

Thanks, Monte.  With your explanation that does make sense.

I have plenty of options for doing what I need to do, so no worries on 
this, but it does leave me with one question:


Can the merge function be extended to support scripts interleaved 
between blocks of non-code?


e.g. this works in Server, and not in Merge:

 
 This is some non-code
 
 Some other non-code
 

--
 Richard Gaskin
 Fourth World Systems

Monte wrote:

Hey guys!

This is one of my early community contributions. The server has an in tag mode 
and a not in tag mode. The shebang both tells the OS where to find the 
executable to run the script and sets enters tag mode. So:

#! /some/path

put the long date && the long time
?>FooBar

Should generate the same output as:

FooBar

You can see why this is necessary if you consider that you don’t want the 
engine to output the shebang line.

Cheers


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LC Server: shebang breaks tags?

2020-02-10 Thread matthias rebbe via use-livecode
i am using 2 scripts for that. Both have the same name but an other extension
One .lc script which contains the complete script and has the  tags

and one shell script which always looks the same

#! /some/path
put the filename of me into tInclude
replace ".sh" with ".lc" in tInclude
include tInclude

I just have to make sure, that both files have the same name prefix or however 
this would be called.

This way  i can run my scripts directly on shell and also from the browser if 
needed.
-
Matthias Rebbe
Life Is Too Short For Boring Code

> Am 08.02.2020 um 05:04 schrieb Richard Gaskin via use-livecode 
> :
> 
> LC Server 6.6 and later allows you to use LC as you would other system 
> utility languages, by including the path to the engine on the first line 
> following a shebang - see discussion here:
> https://livecode.com/livecode-server/
> 
> This lets us use the old MetaCard style with command line scripts, without 
> needing to put "" around the code.
> 
> But oddly, it seems that running a script this way not only doesn't need to 
> comment wrappers, it actually tries to execute them - and of course fails.
> 
> For example, this script:
> 
>#! ./lcs
> 
>put the long date && the long time
>?>
> 
> ...throws this error:
> 
>   row 3, col 1: script: not a command (<)
> 
> 
> Weirder, I've found that if I omit the shebang and call the engine directly 
> in the path on the command line it runs well:
> 
>  ./lcs test.lc
> 
> What is it about the shebang that's breaking execution in comment blocks?
> 
> I have a need to embed code within larger blocks of non-code, and had 
> considered using LC Server as a helper app for that.* It doesn't matter much 
> to me if I launch it with the app path or not, but since most of my systems 
> have LC Server installed for general use it would be nice to use the shebang 
> method.  So this seeming anomaly is certainly not critical, just odd.
> 
> 
> 
> * Yes, I know I can use the merge function for this, but LC desktop's merge 
> is far more limited to the implicit merge that happens when using LC Server.
> 
> The merge function doesn't continue code execution across blocks of code 
> separated by non-code, whereas LC Server does this well:
> 
>
>This is some non-code
>
>Some other non-code
>
> 
> Maybe we could have the desktop merge function expanded to work like Server's 
> implicit merge?  That would be most awesome.
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.comhttp://www.FourthWorld.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LC Server: shebang breaks tags?

2020-02-09 Thread Monte Goulding via use-livecode
Hey guys!

This is one of my early community contributions. The server has an in tag mode 
and a not in tag mode. The shebang both tells the OS where to find the 
executable to run the script and sets enters tag mode. So:

#! /some/path

put the long date && the long time
?>FooBar

Should generate the same output as:

FooBar

You can see why this is necessary if you consider that you don’t want the 
engine to output the shebang line.

Cheers

Monte
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: LC Server: shebang breaks tags?

2020-02-07 Thread Brian Milby via use-livecode
Can’t answer regarding the design decision, but here is the pertinent line:

One recent feature that was introduced in LiveCode 6.6 was the ability to use 
hashbangs (#! /path/to/livecode) in LiveCode server scripts instead of script 
open and close tags ().

Of note is the “instead of” statement which leads me to believe that it was 
designed that way.  It makes sense if trying to use it for automation since you 
don’t need the code tags.

I would guess that a command line parameter could be added to have it work the 
other way.

Thanks,
Brian
On Feb 7, 2020, 11:05 PM -0500, Richard Gaskin via use-livecode 
, wrote:
> LC Server 6.6 and later allows you to use LC as you would other system
> utility languages, by including the path to the engine on the first line
> following a shebang - see discussion here:
> https://livecode.com/livecode-server/
>
> This lets us use the old MetaCard style with command line scripts,
> without needing to put "" around the code.
>
> But oddly, it seems that running a script this way not only doesn't need
> to comment wrappers, it actually tries to execute them - and of course
> fails.
>
> For example, this script:
>
> #! ./lcs
>
>  put the long date && the long time
> ?>
>
> ...throws this error:
>
> row 3, col 1: script: not a command (<)
>
>
> Weirder, I've found that if I omit the shebang and call the engine
> directly in the path on the command line it runs well:
>
> ./lcs test.lc
>
> What is it about the shebang that's breaking execution in comment blocks?
>
> I have a need to embed code within larger blocks of non-code, and had
> considered using LC Server as a helper app for that.* It doesn't matter
> much to me if I launch it with the app path or not, but since most of my
> systems have LC Server installed for general use it would be nice to use
> the shebang method. So this seeming anomaly is certainly not critical,
> just odd.
>
>
>
> * Yes, I know I can use the merge function for this, but LC desktop's
> merge is far more limited to the implicit merge that happens when using
> LC Server.
>
> The merge function doesn't continue code execution across blocks of code
> separated by non-code, whereas LC Server does this well:
>
> 
> This is some non-code
> 
> Some other non-code
> 
>
> Maybe we could have the desktop merge function expanded to work like
> Server's implicit merge? That would be most awesome.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> 
> ambassa...@fourthworld.com http://www.FourthWorld.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


LC Server: shebang breaks tags?

2020-02-07 Thread Richard Gaskin via use-livecode
LC Server 6.6 and later allows you to use LC as you would other system 
utility languages, by including the path to the engine on the first line 
following a shebang - see discussion here:

https://livecode.com/livecode-server/

This lets us use the old MetaCard style with command line scripts, 
without needing to put "" around the code.


But oddly, it seems that running a script this way not only doesn't need 
to comment wrappers, it actually tries to execute them - and of course 
fails.


For example, this script:

#! ./lcs



...throws this error:

   row 3, col 1: script: not a command (<)


Weirder, I've found that if I omit the shebang and call the engine 
directly in the path on the command line it runs well:


  ./lcs test.lc

What is it about the shebang that's breaking execution in comment blocks?

I have a need to embed code within larger blocks of non-code, and had 
considered using LC Server as a helper app for that.* It doesn't matter 
much to me if I launch it with the app path or not, but since most of my 
systems have LC Server installed for general use it would be nice to use 
the shebang method.  So this seeming anomaly is certainly not critical, 
just odd.




* Yes, I know I can use the merge function for this, but LC desktop's 
merge is far more limited to the implicit merge that happens when using 
LC Server.


The merge function doesn't continue code execution across blocks of code 
separated by non-code, whereas LC Server does this well:



This is some non-code

Some other non-code


Maybe we could have the desktop merge function expanded to work like 
Server's implicit merge?  That would be most awesome.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode