regex deconstructor

Mike Kerner MikeKerner at roadrunner.com
Thu Jan 25 19:43:55 EST 2018


It's similar.  It takes a bit of massaging to get one into the other,
especially once you get into the more advanced regex because there are
features that one supports and the other doesn't.  ST's regex engine is
customized more than Atom's is.

Here's the proposed not-quite-final indent rules file:


<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>LiveCode Script Indentation</string>
<key>scope</key>
<string>source.livecode</string>
<key>settings</key>
<!-- documenation found at
http://docs.sublimetext.info/en/latest/reference/metadata.html?highlight=indentation
-->
<dict>
<key>increaseIndentPattern</key>
<string><![CDATA[(?x)
(?<comment>\s*(?:\#|--|/\*)){0}
(?<eol_or_comment>\g<comment>|\s*\\?$){0}
^\s*
(
(on\s)
| (private\s+)?(command|function)\s+
| (else\g<eol_or_comment>)
| (else\s+)?
(if\s+.+?)?
\bthen\g<eol_or_comment>
| repeat\s
| switch\s
| case\s
| default\b
| try\b
| catch\b
| finally\b
)
]]></string>
<key>decreaseIndentPattern</key>
<string>(?x)
^\s*
(
end\s+.
| case\s+.
| default\b
| catch\b
| finally\b
)
</string>
<key>unIndentedLinePattern</key>
<!-- ignore any lines matching this pattern when computing the next line's
indent level -->
<string>^\s*(?:#|--|/\*)</string><!-- i.e. any comments -->
</dict>
</dict>
</plist>

On Thu, Jan 25, 2018 at 7:16 PM, Brian Milby via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Is that the same stuff that Atom uses? I’m not that good at writing RegEx
> from scratch, but wouldn’t mind taking a look. I don’t have ST, so I
> wouldn’t be able to test there.
> On Thu, Jan 25, 2018 at 1:04 PM Mike Kerner via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
> > Unfortunately I'm trying to fix the indenting in ST, so I'm stuck with
> it.
> > Then I asked for help.  The help is definitely better than what I came up
> > with, but I have a couple of things I want to fix.  The help disappeared,
> > and I'm having a hell of a time reading this because it uses some
> advanced
> > magic.
> >
> > On Wed, Jan 24, 2018 at 4:04 PM, Bob Sneidar via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> >
> > > That's because there are several flavors of RegEx. Nice huh?
> > >
> > > RegEx is in my opinion the top choice for inducing insanity. I have a
> > > utility where you type in what you start with and what you want to end
> up
> > > with and it tries to figure out the regex for it. It's less than
> perfect
> > as
> > > you can imagine.
> > >
> > > While RegEx is really handy when you need it, my feeling is to avoid it
> > if
> > > at all possible.
> > >
> > > Bob S
> > >
> > >
> > > > On Jan 24, 2018, at 05:48 , Mike Kerner via use-livecode <
> > > use-livecode at lists.runrev.com> wrote:
> > > >
> > > > @Lagi, yes, exactly.
> > > > I found another one last night: regex101.com/  That one is
> interesting
> > > > because it seems to support some expressions that the others do not.
> > >
> > >
> > > _______________________________________________
> > > use-livecode mailing list
> > > use-livecode at lists.runrev.com
> > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> >
> >
> >
> > --
> > On the first day, God created the heavens and the Earth
> > On the second day, God created the oceans.
> > On the third day, God put the animals on hold for a few hours,
> >    and did a little diving.
> > And God said, "This is good."
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list