Home Download Buy Blog Forum Support

need help in developing a syntax for a markup language

need help in developing a syntax for a markup language

Postby gogol on Thu Dec 13, 2012 12:46 pm

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
Code: Select all
<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.
gogol
 
Posts: 2
Joined: Thu Dec 13, 2012 12:36 pm

Re: need help in developing a syntax for a markup language

Postby agibsonsw on Thu Dec 13, 2012 1:12 pm

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.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: need help in developing a syntax for a markup language

Postby gogol on Fri Dec 14, 2012 4:33 am

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.
gogol
 
Posts: 2
Joined: Thu Dec 13, 2012 12:36 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 10 guests