custom gtksourceview file

Need help with C, C++, perl, python, etc?

custom gtksourceview file

Postby jcress410 » 2010-09-22 13:44

working on a custom gtksourceview .lang file for stata, I've written this thing once before and got it to work... but i have since lost the file... somewhere...

so i'm re writing it. Gedit finds the file and loads it (no errors in term when I switch to a stata .do file) but the syntax isn't highlighting,

in view->highlighting gedit correctly changes the highlight mode to "stata", but the text stays the same color.

I don't know jack taco about xml, so if there's an obvious problem i'm missing, please go easy.. :)

Any help would be appreciated. (i can't figure out how to attach the file... it says extension .lang not allowed and extension .txt not allowed, so i'll copy/paste important parts?)
Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<language id='do' _name='stata' version='2.0' _section='Scientific'>
<property name="mimetypes">text/x-stata-syntax</property>
<property name='globs'>*.do;*.ado</property>
<property name='block-comment-start'>\*</property>
<property name='block-comment-end'>*/</property>
<property name='line-comment-start'>*</property>

<style id='comment' _name='comment' map-to='def:comment'/>
<style id='assignment-operator' _name='Assignment Operator' map-to='def:operator'/>
<style id='string' _name='String' map-to='def:string'/>
<style id='keyword' _name='Keyword' map-to='def:keyword'/>
<style id='function' _name='Function' map-to='def:function'/>
<style id='integer-number' _name='Integer Number' map-to='def:base-n-integer'/>
<style id='macro' _name='macro' map-to='def:macro'/>

<context id='macro' end-at-line-end='true' style-ref='macro'>
<context id='string' end-at-line-end='true' style-ref='string'>

<context id='function' style-ref='function'>
<context id='delimiters' style-ref='delimiter'>
<context id='integer-number' style-ref='integer-number'>
<match extended='true'>
<context id='decimal' style-ref='integer-number'>
<context id='floating-point-number' style-ref='integer-number'>
<context id='comment' style-ref='comment' end-at-line-end='true'>
<context id='blcomment' style-ref='comment'>
<context id='keyword' style-ref='keyword'>

<context id='do'>
<context ref='def:string'/>
<context ref='def:function'/>
<context ref='def:macro'/>
<context ref='def:delimiters'/>
<context ref='def:integer-number'/>
<context ref='def:decimal'/>
<context ref='def:floating-point-number'/>
<context ref='def:blcomment'/>
<context ref='def:comment'/>
<context ref='def:keyword'/>


Posts: 39
Joined: 2010-09-21 18:13

Re: custom gtksourceview file

Postby jcress410 » 2010-09-22 22:45

nevermind, i figured it out.

I actually wrote a program in stata that generated the .lang file... which i think is kind of funny in its recursion...

So, the .lang file is in the zip file attached if anyone else is running stata/gedit on 'nix,

it also includes the .do file which generated it, and a version of thankful eyes i modified for the occasion.
(8.6 KiB) Downloaded 519 times
Posts: 39
Joined: 2010-09-21 18:13

Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests