Sublime Forum

Need help in developing a syntax for a markup language

#1

Hi

I’d like to have some help in order to define a syntax for a language used in some obscure program
It’s a markup language without close tags
for instance

<tag1=this>
    <tag2=was>
        <tag3=a>
             very
<tag1=bad>
    <tag2=design>
           choice

First off, I’d like to locate folding markers. Is it possible ? It looks like a type-2 language problem so I’m not quite sure about that.
Then, how can I color tag-titles and tag-values with distinct color ? I achieved coloring tags by somehow copying what is found in XML.tmLanguage, but unfortunately it’s all red (I’m using tomorrow night as color scheme).

Thanks.

0 Likes

#2

Is the *indentation *significant in this language (a la Python)? If so, then (my advice/suggestion is that…) you need to start scoping at the inner-most level, otherwise everything will be captured within the first scope-rule (possibly why everything is red).

Someone can define their indentation using 2, 4, or even 3(?) spaces, and using tabs or spaces. I wonder if the Python language file does anything with this information? Probably not(?).

What defines the closing of the current scope? Presumably it would have to be EOL ($).

Sorry I can’t be more helpful at this stage. This reference uses the pList format but the principles are the same.

0 Likes

#3

Ok, I’ll try to answer to your questions.
This language is a proprietary program used to perform corpus (textual) analysis. It’s an expansive piece of software targeted to just a bunch of scholarly individuals. Even though everybody is used to XML in this field they decided to use a “simplified” syntax and even went as far as developing their own “linter”.
As far as I know their is no clear syntax definition either backus-naured or informal. It’s just “hey, the anchors/tags look like <TYPE=VALUE>”. Actually the manual of the program uses Comic Sans MS as title font.

Now, this syntax is indentation insensitive. There are examples in the manual that feature such a behavior. The scope of type-X tag ends where another type-X tag begins.

Concerning colors, the tags (both type and value) are displayed in red (or whatever color I might use), the actual text is fine (white). I was wondering if their was some convention in the way to name patterns so that they get displayed in different colors, but after some careful examination I think I might be able to handle this on my own.

Back to the folding heuristics : I actually got it working as I wished on one, clean, well-indented file but not on some indentation-less file. After some tests it turns out it works ONLY IF it is indented, so I suppose i must be relying on some sublime-text/textmate specific heuristic since I did not specify anything about indentation in my tmLanguage file.

0 Likes