SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: jporkkahtc on September 02, 2019, 09:20:35 PM

Title: User defined language with tags
Post by: jporkkahtc on September 02, 2019, 09:20:35 PM
I want to add support for mustache (http://mustache.github.io/#demo)

It has tags like HTML or XML
Code: [Select]
{{#person}}
  Text inside of a tag
{{/person}}
{{^repo}}
   Text inside of a tag   {{replacement_macro}}
{{/repo}}
{{!
This is a comment
}}

How can I teach Slick about "{{#" and "{{^"?
Title: Re: User defined language with tags
Post by: Clark on September 03, 2019, 01:34:52 AM
You should probably try come up with color coding first. The color coding engine doesn't yet have the ability to make a single regex with match groups where you can specify different color for different match groups. There are tricks you can play like defining {{# or }} to be symbol color. Then define a regex which matches the id portion (like "person") with look behind to match {{# before the id and colors that a different color. Remember, SlickEdit supports variable length look behind (Perl doesn't). This all depends on how you want things to be colored.

As for begin/end matching, you'll definitely have to write a macro for that. You'll need to write a _<LangId>__find_matching_word (ex. _html_find_matching_word).

Not sure if there is anything else you would want.