Author Topic: User defined language with tags  (Read 138 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1787
  • Hero Points: 174
  • Text
User defined language with tags
« 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 "{{^"?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4796
  • Hero Points: 388
Re: User defined language with tags
« Reply #1 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.