BBEdit/Textwrangler LCM for livescript

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

BBEdit/Textwrangler LCM for livescript

jameshale
Hi,

I have modified Trevor's BBedit language module for livescript to bring it up to date with the current docs.
(At least within the limitations of the language modules themselves.)

It is now a Codeless Language Module and should work with the current version of these editors.

I have tried it for BBedit and am assuming it will work for TextWrangler

You can get it here

https://dl.dropboxusercontent.com/u/8212901/Livescript.plist <https://dl.dropboxusercontent.com/u/8212901/Livescript.plist>

Please note I haven't added the newer features available in BBEdit V11 as apart from working them out it would take a bit more extensive editing of all the keywords. If I give it a go I will post the update.

Enjoy

James


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Peter Haworth
Thanks for this James.

I'm new to using TextWrangler but it appears that it doesn't recognize
multiple words in a keyword definition.  For example "open file" isn't
colored as a keyword, only "file" because it has a separate keyword
definition.  Not sure if there is a way round this other than breaking the
multiple word keywords into separate keyword definitions.

I would also like to learn how to define if/end if, repeat/end repeat, etc
as structures that can be folded.  I tried using the Open Statement Blocks
and Close Statement Blocks keys in the plist to define "if" and "end" as a
statement block but they weren't recognized as foldable.

There are a number of other things that don't seem to be working as far as
colorization.  Strings enclosed in quotes and variables aren't colored per
the Preferences settings, and keywords within quote-delimited strings are
colorized but shouldn't be.  I tried using the Open Strings 1 and Close
Strings 1 set to quote but that had no effect.

Any ideas?

On Sun, Sep 6, 2015 at 7:36 AM James Hale <[hidden email]> wrote:

> Hi,
>
> I have modified Trevor's BBedit language module for livescript to bring it
> up to date with the current docs.
> (At least within the limitations of the language modules themselves.)
>
> It is now a Codeless Language Module and should work with the current
> version of these editors.
>
> I have tried it for BBedit and am assuming it will work for TextWrangler
>
> You can get it here
>
> https://dl.dropboxusercontent.com/u/8212901/Livescript.plist <
> https://dl.dropboxusercontent.com/u/8212901/Livescript.plist>
>
> Please note I haven't added the newer features available in BBEdit V11 as
> apart from working them out it would take a bit more extensive editing of
> all the keywords. If I give it a go I will post the update.
>
> Enjoy
>
> James
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Kay C Lan
On Mon, Sep 7, 2015 at 3:18 AM, Peter Haworth <[hidden email]> wrote:

>  it appears that it doesn't recognize
> multiple words in a keyword definition.
>

I note this with Brahmanathaswami's module:

    <!-- NB multi-word keywords will not be recognised.
                There's no good solution to this, within the limits of the
BBEdit 'codeless' language module.
                It would be an option to make each word of a multi-word
operator etc into a keyword,
                eg each word of "is not among the keys of" - but this might
cause more confusion.
                -->

 keywords within quote-delimited strings are
>
colorized but shouldn't be.  I tried using the Open Strings 1 and Close
> Strings 1 set to quote but that had no effect.
>
> Any ideas?
>
> In James module the string pattern is:

<key>String Pattern</key>
        <string><![CDATA[
        (?x: (&quot;(\\&quot;|[^&quot;\r]|\\\r)*&quot;))
        ]]></string>

In Ali's and Trevors it's:

<key>String Pattern</key>
            <string><![CDATA[(?x:
                    ("(\\"|[^"\r]|\\\r)*")
                    )
                    ]]></string>

I think the use of CDATA means you don't use &quote;

When I change James' to Ali's and Trevor's it treats strings correctly.

HTH
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

jameshale
Thanks Peter and Kan,

Multi word keywords:
There does seem to be a way around this as mentioned in the update to language modules doc (for BBEDIT 11+) but I am not clear as to the syntax.
As a work around (aren't they all!) I have split all multi word keywords into their components removing those BBEdit chokes on (mainly the operators like * < > >= & && etc)

Colorizing within quoted strings:
Put the modified string recognition pattern back.
Initially I was jumping back between xCode and BBedit to check the sysntax and make changes. Unfortunately this introduces a few problems of its own. I am now using the "plutil" to check that the XML is ok for a plist and the console to ensure BBedit can read it.

More colours:
The updated docs mention the ability to group keywords into sets and then apply a different color to each named set. I haven't been able to get this to work. Even though I am using the latest BBEdit the console is telling me that it cannot find any keywords if I use the new feature. I might be forced to write to there support.

I have updated the livescript.plist file.

James
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Kay C Lan
On Mon, Sep 7, 2015 at 3:28 PM, jameshale <[hidden email]> wrote:

> There does seem to be a way around this as mentioned in the update to
> language modules doc (for BBEDIT 11+) but I am not clear as to the syntax.
>

Yes, also struggling to make head nor tail.


> BBEdit chokes on (mainly the operators
> like * < > >= & && etc)
>
> Again, refering to Brahmanathaswani work he uses CDATA:

https://github.com/Brahmanathaswami/LiveCode-BBEdit-Language-Module

<string><![CDATA[-]]></string>
            <string><![CDATA[*]]></string>
            <string><![CDATA[/]]></string>
            <string><![CDATA[&]]></string>
            <string><![CDATA[&&]]></string>
            <string><![CDATA[>]]></string>
            <string><![CDATA[>=]]></string>
            <string><![CDATA[<]]></string>
            <string><![CDATA[<>]]></string>
            <string><![CDATA[<=]]></string>
            <string><![CDATA[^]]></string>
            <string><![CDATA[+]]></string>
            <string><![CDATA[=]]></string>

And the works fine here.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

jameshale
In reply to this post by jameshale
I contacted BBEdit re getting the newer version of the CLMs working and had some success and some failure.
Success: Keywords now broken up into classes with a different colour for each class.
Failure: multi word keywords are not possible with the CLM
             Control structure folding is thus not possible either (cannot tell "end if" from  "end repeat" as it can't handle multi word keys)

I originally contacted Rich as I was getting a BBEdit console error stating that there were no keywords and hence color syntax would not work. As it turns out, the error message is bogus and the colorsyntax wasn't working due to another bug. I will let Rich explain.

> As to the coloring generally: the module is constructed correctly, but the default colors aren't being loaded because of an obscure math bug that arose out of the need to support some legacy preferences. Fortunately, you can work around this permanently as follows: in each case where your language module specifies a color as "rgb(R, G, B)", you can rewrite this as a four-component RGBA color: "rgba(r, g, b, a)", where each component in the rgba color is computed by dividing the respective component in the RGB color by 256.0, and the "a" component is always 1.0. Thus:
>
> <key>com.barebones.bblm.livescript.commands</key>
> <string>rgb(110, 50, 200)</string>
>
> would become:
>
> <key>com.barebones.bblm.livescript.commands</key>
> <string>rgba(0.43, 0.19, 0.78, 1.0)</string>



So I have updated the LCM to now separate the keywords into the following:
        properties
        operators
        objects
        messages
        keywords
        functions
        constants
        commands
        controls
and given each a different color! (Well if its there, use it :-))

As a bonus, as these are named sets they appear in the "Text Colors" pane of the BBEdit preferences, so you can change them to your liking without the need to do the maths and edit the .plist (NB: for some reason the "controls" set does not show in the pref pane.)

I have uploaded the revised livescript.plist.
https://dl.dropboxusercontent.com/u/8212901/Livescript.plist


James

[hidden email]

Tel: +61 3 9386 2516    
Fax: +61 3 9386 1387




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Peter Haworth
Hi James,
Thanks for all your work on this.  Unfortunately, the grouping of keywords
doesn't seem to work in TextWrangler.  Only string literal are colored now
and there are no extra color preferences.  Not really surprising since
TextWrangler is free.

Maybe I'll have to give BBEdit a whirl, although the lack of folding is a
big minus for me.

On Mon, Sep 7, 2015 at 10:21 PM James Hale <[hidden email]> wrote:

> I contacted BBEdit re getting the newer version of the CLMs working and
> had some success and some failure.
> Success: Keywords now broken up into classes with a different colour for
> each class.
> Failure: multi word keywords are not possible with the CLM
>              Control structure folding is thus not possible either (cannot
> tell "end if" from  "end repeat" as it can't handle multi word keys)
>
> I originally contacted Rich as I was getting a BBEdit console error
> stating that there were no keywords and hence color syntax would not work.
> As it turns out, the error message is bogus and the colorsyntax wasn't
> working due to another bug. I will let Rich explain.
>
> > As to the coloring generally: the module is constructed correctly, but
> the default colors aren't being loaded because of an obscure math bug that
> arose out of the need to support some legacy preferences. Fortunately, you
> can work around this permanently as follows: in each case where your
> language module specifies a color as "rgb(R, G, B)", you can rewrite this
> as a four-component RGBA color: "rgba(r, g, b, a)", where each component in
> the rgba color is computed by dividing the respective component in the RGB
> color by 256.0, and the "a" component is always 1.0. Thus:
> >
> >               <key>com.barebones.bblm.livescript.commands</key>
> >               <string>rgb(110, 50, 200)</string>
> >
> > would become:
> >
> >               <key>com.barebones.bblm.livescript.commands</key>
> >               <string>rgba(0.43, 0.19, 0.78, 1.0)</string>
>
>
>
> So I have updated the LCM to now separate the keywords into the following:
>         properties
>         operators
>         objects
>         messages
>         keywords
>         functions
>         constants
>         commands
>         controls
> and given each a different color! (Well if its there, use it :-))
>
> As a bonus, as these are named sets they appear in the "Text Colors" pane
> of the BBEdit preferences, so you can change them to your liking without
> the need to do the maths and edit the .plist (NB: for some reason the
> "controls" set does not show in the pref pane.)
>
> I have uploaded the revised livescript.plist.
> https://dl.dropboxusercontent.com/u/8212901/Livescript.plist
>
>
> James
>
> [hidden email]
>
> Tel: +61 3 9386 2516
> Fax: +61 3 9386 1387
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

jameshale
In reply to this post by jameshale
Hi Peter,

That is a shame. I guess it makes sense though.

Code folding is possible if I use the SBK and make a compiled language module.
I will have a look but make no promises.

As far as shifting to BBEdit from TextWrangler, well it really depends on if you would use it for other things as well and really wanted the features it offered over TextWrangler.

I have been using BBEdit since day one but if I am honest could probably drop it and use TextWrangler.

James

> Unfortunately, the grouping of keywords
> doesn't seem to work in TextWrangler.  Only string literal are colored now
> and there are no extra color preferences.  Not really surprising since
> TextWrangler is free.
>
> Maybe I'll have to give BBEdit a whirl, although the lack of folding is a
> big minus for me.




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Peter Haworth
Thanks James.  Probably not worth spending any more time on it unless you
want the code folding yourself.  I've been checking out TextMate too and it
does include code folding and is free.

On Tue, Sep 8, 2015 at 4:49 PM James Hale <[hidden email]> wrote:

> Hi Peter,
>
> That is a shame. I guess it makes sense though.
>
> Code folding is possible if I use the SBK and make a compiled language
> module.
> I will have a look but make no promises.
>
> As far as shifting to BBEdit from TextWrangler, well it really depends on
> if you would use it for other things as well and really wanted the features
> it offered over TextWrangler.
>
> I have been using BBEdit since day one but if I am honest could probably
> drop it and use TextWrangler.
>
> James
>
> > Unfortunately, the grouping of keywords
> > doesn't seem to work in TextWrangler.  Only string literal are colored
> now
> > and there are no extra color preferences.  Not really surprising since
> > TextWrangler is free.
> >
> > Maybe I'll have to give BBEdit a whirl, although the lack of folding is a
> > big minus for me.
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Thierry Douez
Hi,

Replace the key 'Function Pattern' with the one below
and you might have a surprise with code folding..

        <key>Function Pattern</key>
        <string><![CDATA[
        ^(?P<f>(?P<function_name>(private\s+)?(on|command|function)\s+(?P<ff>[a-zA-Z0-9_]+))(?ms:.+?)^end\s+(?P=ff))
        ]]></string>


Tested successfully but very quickly with TextWrangler 4.5.12 ( the latest)

I have another option, but let comments arise before going further..

Regards,

Thierry

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

jameshale
In reply to this post by jameshale
Thierry wrote:
>
> Replace the key 'Function Pattern' with the one below
> and you might have a surprise with code folding..

Well I did and it works in BBEdit. Not sure what the surprise is though, unless you have something in mind with the two unused named patterns.

I also used it in a modified LiveCode Builder CLM and it works a treat there (I couldn't get my mod to work correctly)


                <key>Function Pattern</key>
                <string><![CDATA[
                        (?x:
                        ^(?P<f>(?P<function_name>
                        ((private\s+)|(public\s+)|(foreign\s+))?(handler)\s+)
                        (?P<ff>[a-zA-Z0-9_]+))
                        (?ms:.+?)
                        ^end\s+handler
                        )
                ]]></string>

So thank you very much!

I have now updated the livescript CLM with Thierry's mod and a fix for controls not appearing in the text color prefs.

I have also added my modified LiveCode Builder CLM which includes many more keywords (thanks Ali) broken into their "Types" as specified in the docs.
As with the livescript version due to the need to break keywords into single word entities some of my choices in eliminating duplicates may not be truly correct, but its a minor glitch.

The files can be obtained...

https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist <https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist>

https://dl.dropboxusercontent.com/u/8212901/Livescript.plist <https://dl.dropboxusercontent.com/u/8212901/Livescript.plist>



James

(looking forward to Thierry's next post)



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Peter Haworth
Hi Thierry,
I did as you suggested but not seeing any difference with code folding,
still just commands and functions are foldable.

On Wed, Sep 9, 2015 at 9:04 AM James Hale <[hidden email]> wrote:

> Thierry wrote:
> >
> > Replace the key 'Function Pattern' with the one below
> > and you might have a surprise with code folding..
>
> Well I did and it works in BBEdit. Not sure what the surprise is though,
> unless you have something in mind with the two unused named patterns.
>
> I also used it in a modified LiveCode Builder CLM and it works a treat
> there (I couldn't get my mod to work correctly)
>
>
>                 <key>Function Pattern</key>
>                 <string><![CDATA[
>                         (?x:
>                         ^(?P<f>(?P<function_name>
>
> ((private\s+)|(public\s+)|(foreign\s+))?(handler)\s+)
>                         (?P<ff>[a-zA-Z0-9_]+))
>                         (?ms:.+?)
>                         ^end\s+handler
>                         )
>                 ]]></string>
>
> So thank you very much!
>
> I have now updated the livescript CLM with Thierry's mod and a fix for
> controls not appearing in the text color prefs.
>
> I have also added my modified LiveCode Builder CLM which includes many
> more keywords (thanks Ali) broken into their "Types" as specified in the
> docs.
> As with the livescript version due to the need to break keywords into
> single word entities some of my choices in eliminating duplicates may not
> be truly correct, but its a minor glitch.
>
> The files can be obtained...
>
> https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist <
> https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist>
>
> https://dl.dropboxusercontent.com/u/8212901/Livescript.plist <
> https://dl.dropboxusercontent.com/u/8212901/Livescript.plist>
>
>
>
> James
>
> (looking forward to Thierry's next post)
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

jameshale
In reply to this post by jameshale
Updated livecodeBuilder CLM to adjust function regex so that function names appear in BBEdit's function popup

https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist <https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist

James
Reply | Threaded
Open this post in threaded view
|

Re: BBEdit/Textwrangler LCM for livescript

Kay C Lan
Thanks James, excellent work.

On Thu, Sep 10, 2015 at 10:35 PM, jameshale <[hidden email]> wrote:

> Updated livecodeBuilder CLM to adjust function regex so that function names
> appear in BBEdit's function popup
>
> https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist
> <https://dl.dropboxusercontent.com/u/8212901/LiveCodeBuilder.plist>
>
> James
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/BBEdit-Textwrangler-LCM-for-livescript-tp4696091p4696217.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode