CLM.. some parsing

25 views
Skip to first unread message

Jakob Peterhänsel

unread,
May 15, 2020, 11:29:54 AM5/15/20
to BBedit Group
Hi All,

BBEdit 13.1 beta..

Messing around with a CLM here, trying to follow this: http://www.barebones.com/support/develop/clm.html

Comments
We should not use these ‘old’ types any more:
<key>Open Line Comments</key>
<string>-- </string>
<key>Open Block Comments</key>
<string><![CDATA[<!-- ]]></string>
<key>Close Block Comments</key>
<string><![CDATA[-->]]></string>

But use the new BBLMCommentLineDefault, BBLMCommentPrefixDefault/BBLMCommentSuffixDefault?
<key>BBLMCommentLineDefault </key>
<string>-- </string>
<key>BBLMCommentPrefixDefault</key>
<string><![CDATA[<!-- ]]></string>
<key>BBLMCommentSuffixDefault</key>
<string><![CDATA[-->]]></string>


If I use the old tags, comments are color coded just fine and blocks are foldable, not if I use the new ones.
In any case Un/Comment line/Block does not seem to work.

What am I missing? Do I need to make a Comment Pattern?


‘Functions/Parts of the file'

The configuration files I try to make a CLM for, has special areas in the file, inclosed in HTML-like tags:

<area-one>
..config here..
</area-one>

<another-area>
..config here..
</another-area>

It seems like I can’t do like this:
<key>BBLMKeywordList</key>
<array>
<string><![CDATA[<area-one>]]></string>
<string><![CDATA[</area-one>]]></string>

So I guess I need to make a Structural Element  with a Function Pattern, that would also make it foldable, and make the RegEx specific enough to find the open & close tags..

Am I on the right path? ;-)


-- 

    Jakob Peterhänsel
    

"Be a part of the Love Generation - carry a smile, not a gun."
- JP, May 2006

Phone:     +45 29808600

Rich Siegel

unread,
May 15, 2020, 11:35:33 AM5/15/20
to bbe...@googlegroups.com
On 5/15/20 at 11:26 AM, maroo...@gmail.com (Jakob
Peterhänsel) wrote:

>Comments
>If I understand this correctly: http://www.barebones.com/support/develop/clm.html#UnCommentMarkers
>We should not use these ‘old’ types any more: [...]
>
>But use the new BBLMCommentLineDefault, BBLMCommentPrefixDefault/BBLMCommentSuffixDefault?

The "Open Line Comments", "Open Block Comments", and "Close
Block Comments" values are used for interpreting the text, so
you need them. They do not affect the behavior of Un/Comment Lines/Block.

The "BBLMCommentLineDefault", "BBLMCommentPrefixDefault", and
"BBLMCommentSuffixDefault" values alter the behavior of
Un/Comment Lines/Block, and do not play any part in syntax
coloring or function scanning.

So, you need them both (and their values may be the same).

>‘Functions/Parts of the file'
>
>The configuration files I try to make a CLM for, has special
>areas in the file, inclosed in HTML-like tags: [...]
>
>So I guess I need to make a Structural Element with a Function
>Pattern, that would also make it foldable, and make the RegEx
>specific enough to find the open & close tags..
>
>Am I on the right path? ;-)

Probably. :-) Trying to parse HTML-like things with regular
expressions, or expressing them with a codeless language module,
is generally a losing battle; but if you constrain things enough
you may be able to make it work.

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Jakob Peterhänsel

unread,
May 15, 2020, 12:06:18 PM5/15/20
to BBedit Group
Thanks Rich,

Then I just need to brush up on the Grep in CDATA.. is the Grep Ref in the BBEdit manual still the best place?

Stuff like this needs some getting used too:

(?x:
(?P<function>
^(?!\.\.\s)\ ?(?P<function_name>\S[^\r]+)\r
^(?P<bar>[-=`:.'"~^_*+#!$%&(),/;<>?@[\]\{|}])(?P=bar)+\s*$
(?s).*?(?-s)
)
(?=
(^\s*\r((?P<overline>[-=`:.'"~^_*+#!$%&(),/;<>?@[\]\{|}])(?P=overline)+\s*\r)?
^(?!\.\.\s)\ ?\S[^\r]+\r
^(?P<nextbar>[-=`:.'"~^_*+#!$%&(),/;<>?@[\]\{|}])(?P=nextbar)+\s*$
) | (?-m)$
)

😉 



-- 

    Jakob Peterhänsel
    

"Be a part of the Love Generation - carry a smile, not a gun."
- JP, May 2006

Phone:     +45 29808600
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-F0276DEFB8B745C5AA56E9BEE22CF64A%40Stormwind.local.

Reply all
Reply to author
Forward
0 new messages