A Better Programming Environment

Post Reply
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

A Better Programming Environment

Post by xProgrammer »

Hi all fivelinux programmers.

You are probably using gedit to write / edit your source code.

I figured that there are probably some ways to make this a better environment. Antonio has already shown how you can build your application from within gedit. I figured that the default syntax highlighting wasn't exactly what I wanted. (What I have been using is the C style syntax highlighting which I get by default for my .prg files once they have been saved once (and thus have a known file extension = type).

I haven't fully understood everything about this but I have started editing my c.lang file (in /usr/share/gtksourceview-2.0/language-specs) and whilst some things I have tried to do aren't working yet. I'm finding it a help.

Maybe someone knows of an xBase pption for gedit (and I can save my time) - if so please let me know.

If not maybe someone(s) want to help getting gedit so that it better suits us?

My modifications to date are:

Code: Select all

                <!-- Keywords -->
                <context id="keywords" style-ref="keyword">
                    <keyword>CLASS</keyword>
                    <keyword>INIT</keyword>
                    <keyword>READONLY</keyword>
                    <keyword>PERSISTENT</keyword>
                    <keyword>ENDCLASS</keyword>
                    <keyword>FROM</keyword>
                    <keyword>BEGIN SEQUENCE</keyword>
                    <keyword>BREAK</keyword>
                    <keyword>RECOVER</keyword>
                    <keyword>ENDSEQUENCE</keyword>
                    <keyword>DO CASE</keyword>
                    <keyword>CASE</keyword>
                    <keyword>OTHERWISE</keyword>
                    <keyword>ENDCASE</keyword>
                    <keyword>SWITCH</keyword>
                    <keyword>IF</keyword>
                    <keyword>ELSE</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>ENDIF</keyword>
                    <keyword>ENDDO</keyword>
                    <keyword>DO WHILE</keyword>
                    <keyword>FOR EACH</keyword>
                    <keyword>FOR</keyword>
                    <keyword>TO</keyword>
                    <keyword>STEP</keyword>
                    <keyword>IN</keyword>
                    <keyword>EXIT</keyword>
                    <keyword>LOOP</keyword>
                    <keyword>RETURN</keyword>
                    <keyword>LOCAL</keyword>
                    <keyword>MEMVAR</keyword>
                    <keyword>FIELD</keyword>
                    <keyword>MESSAGE</keyword>
                    <keyword>OPERATOR</keyword>
                    <keyword>OVERRIDE PARAMETERS</keyword>
                    <keyword>REQUEST</keyword>
                    <keyword>END</keyword>
                    <keyword>TRY</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>TRY</keyword>
                    <keyword>THROW</keyword>
                    <keyword>CATCH</keyword>
                    <keyword>FINALLY</keyword>
                    <keyword>WITH OBJECT</keyword>
                    <keyword>REPLACE</keyword>
                    <keyword>WITH</keyword>
                    <keyword>/@</keyword>                    
                    <keyword>SAY</keyword>
                    <keyword>GET</keyword>
                    <keyword>OF</keyword> 
                    <keyword>SIZE</keyword>  
                    <keyword>WHEN</keyword>
                    <keyword>DEFINE DIALOG</keyword>
                    <keyword>TITLE</keyword>                
                </context>

                <context id="types" style-ref="type">
                    <keyword>DATA</keyword>
                    <keyword>CONSTRUCTOR</keyword>
                    <keyword>PROCEDURE</keyword>
                    <keyword>METHOD</keyword>
                    <keyword>FUNCTION</keyword>
                    <keyword>self</keyword>
                    <keyword>nil</keyword>

                </context>

                <context id="storage-class" style-ref="storage-class">
                    <keyword>PUBLIC</keyword>
                    <keyword>VIRTUAL</keyword>
                    <keyword>PRIVATE</keyword>
                    <keyword>STATIC</keyword>
                    <keyword>EXPORTED:</keyword>
                    <keyword>PROTECTED:</keyword>
                    <keyword>HIDDEN:</keyword>
                    <keyword>GLOBAL</keyword>

                </context>

                <context id="common-defines" style-ref="common-defines">
                    <keyword>CRLF</keyword>
                    <keyword>TRUE</keyword>
                    <keyword>FALSE</keyword>

                </context>

                <!-- C99 booleans -->                
                <context id="boolean" style-ref="boolean">
                    <keyword>.T.</keyword>
                    <keyword>.F.</keyword>
                </context>
Note that some things aren't working ( eg @, .T., .F. - probably need regular expressions somewhere? Only some keywords included in list. Assignment to the various styles probably not optimal - style choices still the original C ones. Don't want to have to overwrite C style - want to be able to pick up an xBase one and create proper file type recognition in Linux.
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

More Info

Post by xProgrammer »

Hi all

I have found out how to get xBase highlighting to come out as an extra option on the syntax highlighting menu of gedit. That means you don't have to overwrite your C syntax highlighting.

The following file doesn't work perfectly - there are some C features still left in, and some xBase features aren't working - I think regex's required.

But if you create a (text) file called xBase.lang in your /usr/share/gtksourceview-2.0 directory and set it contents to the code below you will have xBase / fivelinux syntax highlighting available under gedit that you can play with.

I now have to figure out how to get .prg files to automatically pick up this syntax highlighting.

Hope this helps.

xProgrammer

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--

 Authors: Marco Barisione, Emanuele Aina
 Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
 Copyright (C) 2005-2007 Emanuele Aina

 Modified by xProgrammer for xBase 2007.  This is a partially
 working version only.  Use at your own peril!

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

-->
<language id="x" _name="xBase" version="2.0" _section="Sources">
    <metadata>
      <property name="mimetypes">text/x-c;text/x-csrc;image/x-xpixmap</property>
      <property name="globs">*.c</property>
      <property name="line-comment-start">//</property>
      <property name="block-comment-start">/*</property>
      <property name="block-comment-end">*/</property>
    </metadata>

    <styles>
        <style id="comment"           _name="Comment"             map-to="def:comment"/>
        <style id="error"             _name="Error"               map-to="def:error"/>
        <style id="string"            _name="String"              map-to="def:string"/>
        <style id="preprocessor"      _name="Preprocessor"        map-to="def:preprocessor"/>
        <style id="common-defines"    _name="Common Defines"      map-to="def:special-constant"/>
        <style id="included-file"     _name="Included File"       map-to="def:string"/>
        <style id="char"              _name="Character"           map-to="def:character"/>
        <style id="keyword"           _name="Keyword"             map-to="def:keyword"/>
        <style id="type"              _name="Data Type"           map-to="def:type"/>
        <style id="storage-class"     _name="Storage Class"       map-to="def:type"/>
        <style id="printf"            _name="printf Conversion"   map-to="def:character"/>
        <style id="escaped-character" _name="Escaped Character"   map-to="def:special-char"/>
        <style id="floating-point"    _name="Floating point number" map-to="def:floating-point"/>
        <style id="decimal"           _name="Decimal number"      map-to="def:decimal"/>
        <style id="octal"             _name="Octal number"        map-to="def:base-n-integer"/>
        <style id="hexadecimal"       _name="Hexadecimal number"  map-to="def:base-n-integer"/>
        <style id="boolean"           _name="Boolean value"       map-to="def:boolean"/>
    </styles>

    <definitions>
        <!-- TODO: what about scanf ? -->
        <!-- man 3 printf -->
        <context id="printf" style-ref="printf" extend-parent="false">
            <match extended="true">
                \%\%|
                \%([1-9][0-9]*\$)?
                [#0\-\ \+\'I]*
                (\-?[1-9][0-9]*)?
                (\.\-?[1-9][0-9]*)?
                (hh|ll|[hlLqjzt])?
                [diouxXeEfFgGaAcsCSpnm]
            </match>
        </context>

        <!-- http://en.wikipedia.org/wiki/C_syntax#Strings -->
        <define-regex id="escaped-character" extended="true">
            \\(                   # leading backslash
            [\\\"\'nrtfav\?e] |   # escaped character
            [0-7]{1,3} |          # one, two, or three octal digits
            x[0-9A-Fa-f]{0,2}     # 'x' followed by zero, one, or two hex digits
            )
        </define-regex>

        <context id="x">
            <include>

                <!-- gtk-doc -->
                <context ref="gtk-doc:inline-docs-section"/>

                <!-- Comments -->
                <context id="comment" style-ref="comment" end-at-line-end="true">
                    <start>//</start>
                    <include>
                      <context ref="def:in-line-comment"/>
                    </include>
                </context>

                <context id="comment-multiline" style-ref="comment">
                    <start>/\*</start>
                    <end>\*/</end>
                    <include>
                        <context ref="def:in-comment"/>
                    </include>
                </context>

                <context id="close-comment-outside-comment" style-ref="error">
                    <match>\*/(?!\*)</match>
                </context>

                <!-- Preprocessor -->
                <define-regex id="preproc-start">^\s*#\s*</define-regex>

                <context id="if0-comment" style-ref="comment">
                    <start>\%{preproc-start}if\b\s*0\b</start>
                    <end>\%{preproc-start}(endif|else|elif)\b</end>
                    <include>
                        <context id="if-in-if0">
                            <start>\%{preproc-start}if(n?def)?\b</start>
                            <end>\%{preproc-start}endif\b</end>
                            <include>
                                <context ref="if-in-if0"/>
                                <context ref="def:in-comment"/>
                            </include>
                        </context>
                        <context ref="def:in-comment"/>
                    </include>
                </context>

                <context id="include" style-ref="preprocessor">
                    <match extended="true">
                            \%{preproc-start}
                            (include|import)\s*
                            (".*?"|<.*>)
                    </match>
                    <include>
                        <context id="included-file" sub-pattern="2" style-ref="included-file"/>
                    </include>
                </context>

                <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
                    <start extended="true">
                            \%{preproc-start}
                            (define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
                            \b
                    </start>
                    <include>
                        <context ref="def:line-continue" ignore-style="true"/>
                        <context ref="string" ignore-style="true"/>
                        <context ref="comment"/>
                        <context ref="comment-multiline"/>
                    </include>
                </context>

                <context id="string" style-ref="string" end-at-line-end="true">
                    <start>"</start>
                    <end>"</end>
                    <include>
                        <context ref="printf"/>
                        <context id="escaped-character" style-ref="escaped-character">
                            <match>\%{escaped-character}</match>
                        </context>
                        <context ref="def:line-continue"/>
                    </include>
                </context>

                <context id="char" style-ref="char">
                    <match>'(\%{escaped-character}|.)'</match>
                </context>

                <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
                <context id="float" style-ref="floating-point">
                    <match extended="true">
                        (?<![\w\.])
                        ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
                         ([0-9]+[Ee][+-]?[0-9]*))
                        [fFlL]?
                        (?![\w\.])
                    </match>
                </context>

                <context id="hexadecimal" style-ref="hexadecimal">
                    <match extended="true">
                        (?<![\w\.])
                        0[xX][a-fA-F0-9]+[uUlL]*
                        (?![\w\.])
                    </match>
                </context>

                <context id="octal" style-ref="octal">
                    <match extended="true">
                        (?<![\w\.])
                        0[0-7]+[uUlL]*
                        (?![\w\.])
                    </match>
                </context>

                <context id="decimal" style-ref="decimal">
                    <match extended="true">
                        (?<![\w\.])
                        [0-9]+[uUlL]*
                        (?![\w\.])
                    </match>
                </context>

                <!-- Keywords -->
                <context id="keywords" style-ref="keyword">

                    <keyword>DEFINE WINDOW</keyword>
                    <keyword>ACTIVATE WINDOW</keyword>
                    <keyword>DEFINE DIALOG</keyword>
                    <keyword>ACTIVATE DIALOG</keyword>
                    <keyword>TITLE</keyword>
                    <keyword>VALID</keyword>
                    <keyword>ON CLICK</keyword>
                    <keyword>ON LEFT CLICK</keyword>
                    <keyword>ON RIGHT CLICK</keyword>
                    <keyword>CENTER</keyword>
                    <keyword>CENTERED</keyword>
                    <keyword>NOWAIT</keyword>
                    <keyword>NOMODAL</keyword>
                    <keyword>DEFINE BUTTONBAR</keyword>
                    <keyword>DEFINE BUTTON</keyword>
                    <keyword>HEADERS</keyword>
                    <keyword>ALIAS</keyword>
                    <keyword>FIELDS</keyword>
                    <keyword>UPDATE</keyword>
                    <keyword>ACTION</keyword>
                    <keyword>SIZE</keyword>
                    <keyword>VALID</keyword> 
                    <keyword>WHEN</keyword>
                    <keyword>CHECKBOX</keyword>
                    <keyword>COMBOBOX</keyword>  
                    <keyword>PROMPTS</keyword>
                    <keyword>MULTILINE</keyword>
                    <keyword>MEMO</keyword>
                    <keyword>TEXT</keyword> 
                    <keyword>FOLDER</keyword>
                    <keyword>VAR</keyword>
                    <keyword>GROUP</keyword>
                    <keyword>IMAGE</keyword>        
                    <keyword>PICTURE</keyword>  
                    <keyword>METER</keyword>
                    <keyword>RADIO</keyword>
                    <keyword>SCROLLBAR</keyword> 
                    <keyword>MENU</keyword>
                    <keyword>MENUITEM</keyword>
                    <keyword>PROMPT</keyword>
                    <keyword>SEPARATOR</keyword>
                    <keyword>ACTIVATE MENU</keyword> 
                    <keyword>ACTIVATE POPUP</keyword>
                    <keyword>SET MESSAGE</keyword>
                    <keyword>PRINTER</keyword>
                    <keyword>FROM USER</keyword>
                    <keyword>PAGE</keyword> 
                    <keyword>ENDPAGE</keyword>
                    <keyword>ENDPRINTER</keyword>
                    <keyword>WINDOW</keyword>
                    <keyword>DIALOG</keyword>
                    <keyword>RESOURCE</keyword>
                    <keyword>NAME</keyword>
                    <keyword>RESNAME</keyword>
                    <keyword>PROGRESS</keyword>
                    <keyword>TOTAL</keyword>
                    <keyword>ALIAS</keyword>
                    <keyword>CLASS</keyword>
                    <keyword>INIT</keyword>
                    <keyword>READONLY</keyword>
                    <keyword>PERSISTENT</keyword>
                    <keyword>ENDCLASS</keyword>
                    <keyword>FROM</keyword>
                    <keyword>BEGIN SEQUENCE</keyword>
                    <keyword>BREAK</keyword>
                    <keyword>RECOVER</keyword>
                    <keyword>ENDSEQUENCE</keyword>
                    <keyword>DO CASE</keyword>
                    <keyword>CASE</keyword>
                    <keyword>OTHERWISE</keyword>
                    <keyword>ENDCASE</keyword>
                    <keyword>SWITCH</keyword>
                    <keyword>IF</keyword>
                    <keyword>ELSE</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>ENDIF</keyword>
                    <keyword>ENDDO</keyword>
                    <keyword>DO WHILE</keyword>
                    <keyword>FOR EACH</keyword>
                    <keyword>FOR</keyword>
                    <keyword>TO</keyword>
                    <keyword>STEP</keyword>
                    <keyword>IN</keyword>
                    <keyword>EXIT</keyword>
                    <keyword>LOOP</keyword>
                    <keyword>RETURN</keyword>
                    <keyword>LOCAL</keyword>
                    <keyword>MEMVAR</keyword>
                    <keyword>FIELD</keyword>
                    <keyword>MESSAGE</keyword>
                    <keyword>OPERATOR</keyword>
                    <keyword>OVERRIDE PARAMETERS</keyword>
                    <keyword>REQUEST</keyword>
                    <keyword>END</keyword>
                    <keyword>TRY</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>TRY</keyword>
                    <keyword>THROW</keyword>
                    <keyword>CATCH</keyword>
                    <keyword>FINALLY</keyword>
                    <keyword>WITH OBJECT</keyword>
                    <keyword>REPLACE</keyword>
                    <keyword>WITH</keyword>
                    <keyword>@</keyword>                   
                    <keyword>SAY</keyword>
                    <keyword>GET</keyword>
                    <keyword>OF</keyword>
                    <keyword>SIZE</keyword> 
                    <keyword>WHEN</keyword>
                    <keyword>DEFINE DIALOG</keyword>
                    <keyword>TITLE</keyword>                
                </context>

                <context id="types" style-ref="type">
                    <keyword>DATA</keyword>
                    <keyword>CONSTRUCTOR</keyword>
                    <keyword>PROCEDURE</keyword>
                    <keyword>METHOD</keyword>
                    <keyword>FUNCTION</keyword>
                    <keyword>self</keyword>
                    <keyword>nil</keyword> 
                </context>

                <context id="storage-class" style-ref="storage-class">
                    <keyword>PUBLIC</keyword>
                    <keyword>VIRTUAL</keyword>
                    <keyword>PRIVATE</keyword>
                    <keyword>STATIC</keyword>
                    <keyword>EXPORTED:</keyword>
                    <keyword>PROTECTED:</keyword>
                    <keyword>HIDDEN:</keyword>
                    <keyword>GLOBAL</keyword>

                </context>

                <context id="common-defines" style-ref="common-defines">
                    <keyword>CRLF</keyword>
                    <keyword>TRUE</keyword>
                    <keyword>FALSE</keyword>
                </context>

                <!-- C99 booleans -->                
                <context id="boolean" style-ref="boolean">
                    <keyword>.T.</keyword>
                    <keyword>.F.</keyword>
                </context>

            </include>
        </context>
    </definitions>
</language>

User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Correction

Post by xProgrammer »

Oops!

The file has to be in /usr/share/gtksourceview-2.0/language-specs directory.

xProgrammer
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post by xProgrammer »

Booleans work with this fix

Code: Select all

                <!-- C99 booleans -->                
                <context id="boolean" style-ref="boolean">
                    <match extended="true">
                        \.[tTfF]\.
                    </match>
                </context>
Main remaining items are now @, class data and getting .prg files associated with xBase syntax highlighting BUT its now past my bedtime.

xProgrammer
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post by xProgrammer »

Here is an improved version with support for @ and class variables (ie ::)

I wrote 2007 in the file and its 2008 - I am DEFINITELY going to bed now!

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--

 Authors: Marco Barisione, Emanuele Aina
 Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
 Copyright (C) 2005-2007 Emanuele Aina

 Modified by xProgrammer for xBase 2007.  This is a partially
 working version only.  Use at your own peril!

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

-->
<language id="x" _name="xBase" version="2.0" _section="Sources">
    <metadata>
      <property name="mimetypes">text/x-prg;text/x-csrc;image/x-xpixmap</property>
      <property name="globs">*.prg</property>
      <property name="line-comment-start">//</property>
      <property name="block-comment-start">/*</property>
      <property name="block-comment-end">*/</property>
    </metadata>

    <styles>
        <style id="comment"           _name="Comment"             map-to="def:comment"/>
        <style id="error"             _name="Error"               map-to="def:error"/>
        <style id="string"            _name="String"              map-to="def:string"/>
        <style id="preprocessor"      _name="Preprocessor"        map-to="def:preprocessor"/>
        <style id="common-defines"    _name="Common Defines"      map-to="def:special-constant"/>
        <style id="included-file"     _name="Included File"       map-to="def:string"/>
        <style id="char"              _name="Character"           map-to="def:character"/>
        <style id="keyword"           _name="Keyword"             map-to="def:keyword"/>
        <style id="type"              _name="Data Type"           map-to="def:type"/>
        <style id="storage-class"     _name="Storage Class"       map-to="def:type"/>
        <style id="printf"            _name="printf Conversion"   map-to="def:character"/>
        <style id="escaped-character" _name="Escaped Character"   map-to="def:special-char"/>
        <style id="floating-point"    _name="Floating point number" map-to="def:floating-point"/>
        <style id="decimal"           _name="Decimal number"      map-to="def:decimal"/>
        <style id="octal"             _name="Octal number"        map-to="def:identifier"/>
        <style id="hexadecimal"       _name="Hexadecimal number"  map-to="def:base-n-integer"/>
        <style id="boolean"           _name="Boolean value"       map-to="def:boolean"/>
    </styles>

    <definitions>
        <!-- TODO: what about scanf ? -->
        <!-- man 3 printf -->
        <context id="printf" style-ref="printf" extend-parent="false">
            <match extended="true">
                \%\%|
                \%([1-9][0-9]*\$)?
                [#0\-\ \+\'I]*
                (\-?[1-9][0-9]*)?
                (\.\-?[1-9][0-9]*)?
                (hh|ll|[hlLqjzt])?
                [diouxXeEfFgGaAcsCSpnm]
            </match>
        </context>

        <!-- http://en.wikipedia.org/wiki/C_syntax#Strings -->
        <define-regex id="escaped-character" extended="true">
            \\(                   # leading backslash
            [\\\"\'nrtfav\?e] |   # escaped character
            [0-7]{1,3} |          # one, two, or three octal digits
            x[0-9A-Fa-f]{0,2}     # 'x' followed by zero, one, or two hex digits
            )
        </define-regex>

        <context id="x">
            <include>

                <!-- gtk-doc -->
                <context ref="gtk-doc:inline-docs-section"/>

                <!-- Comments -->
                <context id="comment" style-ref="comment" end-at-line-end="true">
                    <start>//</start>
                    <include>
                      <context ref="def:in-line-comment"/>
                    </include>
                </context>

                <context id="comment-multiline" style-ref="comment">
                    <start>/\*</start>
                    <end>\*/</end>
                    <include>
                        <context ref="def:in-comment"/>
                    </include>
                </context>

                <context id="close-comment-outside-comment" style-ref="error">
                    <match>\*/(?!\*)</match>
                </context>

                <!-- Preprocessor -->
                <define-regex id="preproc-start">^\s*#\s*</define-regex>

                <context id="if0-comment" style-ref="comment">
                    <start>\%{preproc-start}if\b\s*0\b</start>
                    <end>\%{preproc-start}(endif|else|elif)\b</end>
                    <include>
                        <context id="if-in-if0">
                            <start>\%{preproc-start}if(n?def)?\b</start>
                            <end>\%{preproc-start}endif\b</end>
                            <include>
                                <context ref="if-in-if0"/>
                                <context ref="def:in-comment"/>
                            </include>
                        </context>
                        <context ref="def:in-comment"/>
                    </include>
                </context>

                <context id="include" style-ref="preprocessor">
                    <match extended="true">
                            \%{preproc-start}
                            (include|import)\s*
                            (".*?"|<.*>)
                    </match>
                    <include>
                        <context id="included-file" sub-pattern="2" style-ref="included-file"/>
                    </include>
                </context>

                <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
                    <start extended="true">
                            \%{preproc-start}
                            (define|undef|error|pragma|ident|if(n?def)?|else|elif|endif|line|warning)
                            \b
                    </start>
                    <include>
                        <context ref="def:line-continue" ignore-style="true"/>
                        <context ref="string" ignore-style="true"/>
                        <context ref="comment"/>
                        <context ref="comment-multiline"/>
                    </include>
                </context>

                <context id="string" style-ref="string" end-at-line-end="true">
                    <start>"</start>
                    <end>"</end>
                    <include>
                        <context ref="printf"/>
                        <context id="escaped-character" style-ref="escaped-character">
                            <match>\%{escaped-character}</match>
                        </context>
                        <context ref="def:line-continue"/>
                    </include>
                </context>

                <context id="char" style-ref="keyword">
                    <match>@</match>
                </context>

                <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html -->
                <context id="float" style-ref="floating-point">
                    <match extended="true">
                        (?<![\w\.])
                        ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
                         ([0-9]+[Ee][+-]?[0-9]*))
                        [fFlL]?
                        (?![\w\.])
                    </match>
                </context>

                <context id="hexadecimal" style-ref="hexadecimal">
                    <match extended="true">
                        (?<![\w\.])
                        0[xX][a-fA-F0-9]+[uUlL]*
                        (?![\w\.])
                    </match>
                </context>

                <context id="octal" style-ref="octal">
                    <match extended="true">
                      ::[A-Za-z][A-Za-z0-9]*
                    </match>
                </context>

                <context id="decimal" style-ref="decimal">
                    <match extended="true">
                        (?<![\w\.])
                        [0-9]+[uUlL]*
                        (?![\w\.])
                    </match>
                </context>



                <!-- Keywords -->
                <context id="keywords" style-ref="keyword">

                    <keyword>DEFINE WINDOW</keyword>
                    <keyword>ACTIVATE WINDOW</keyword>
                    <keyword>DEFINE DIALOG</keyword>
                    <keyword>ACTIVATE DIALOG</keyword>
                    <keyword>TITLE</keyword>
                    <keyword>VALID</keyword>
                    <keyword>ON CLICK</keyword>
                    <keyword>ON LEFT CLICK</keyword>
                    <keyword>ON RIGHT CLICK</keyword>
                    <keyword>CENTER</keyword>
                    <keyword>CENTERED</keyword>
                    <keyword>NOWAIT</keyword>
                    <keyword>NOMODAL</keyword>
                    <keyword>DEFINE BUTTONBAR</keyword>
                    <keyword>DEFINE BUTTON</keyword>
                    <keyword>BUTTON</keyword>
                    <keyword>HEADERS</keyword>
                    <keyword>ALIAS</keyword>
                    <keyword>FIELDS</keyword>
                    <keyword>UPDATE</keyword>
                    <keyword>ACTION</keyword>
                    <keyword>SIZE</keyword>
                    <keyword>VALID</keyword> 
                    <keyword>WHEN</keyword>
                    <keyword>CHECKBOX</keyword>
                    <keyword>COMBOBOX</keyword>  
                    <keyword>PROMPTS</keyword>
                    <keyword>MULTILINE</keyword>
                    <keyword>MEMO</keyword>
                    <keyword>TEXT</keyword> 
                    <keyword>FOLDER</keyword>
                    <keyword>VAR</keyword>
                    <keyword>GROUP</keyword>
                    <keyword>IMAGE</keyword>        
                    <keyword>PICTURE</keyword>  
                    <keyword>METER</keyword>
                    <keyword>RADIO</keyword>
                    <keyword>SCROLLBAR</keyword> 
                    <keyword>MENU</keyword>
                    <keyword>MENUITEM</keyword>
                    <keyword>PROMPT</keyword>
                    <keyword>SEPARATOR</keyword>
                    <keyword>ACTIVATE MENU</keyword> 
                    <keyword>ACTIVATE POPUP</keyword>
                    <keyword>SET MESSAGE</keyword>
                    <keyword>PRINTER</keyword>
                    <keyword>FROM USER</keyword>
                    <keyword>PAGE</keyword> 
                    <keyword>ENDPAGE</keyword>
                    <keyword>ENDPRINTER</keyword>
                    <keyword>WINDOW</keyword>
                    <keyword>DIALOG</keyword>
                    <keyword>RESOURCE</keyword>
                    <keyword>NAME</keyword>
                    <keyword>RESNAME</keyword>
                    <keyword>PROGRESS</keyword>
                    <keyword>TOTAL</keyword>
                    <keyword>ALIAS</keyword>
                    <keyword>CLASS</keyword>
                    <keyword>INIT</keyword>
                    <keyword>READONLY</keyword>
                    <keyword>PERSISTENT</keyword>
                    <keyword>ENDCLASS</keyword>
                    <keyword>FROM</keyword>
                    <keyword>BEGIN SEQUENCE</keyword>
                    <keyword>BREAK</keyword>
                    <keyword>RECOVER</keyword>
                    <keyword>ENDSEQUENCE</keyword>
                    <keyword>DO CASE</keyword>
                    <keyword>CASE</keyword>
                    <keyword>OTHERWISE</keyword>
                    <keyword>ENDCASE</keyword>
                    <keyword>SWITCH</keyword>
                    <keyword>IF</keyword>
                    <keyword>ELSE</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>ENDIF</keyword>
                    <keyword>ENDDO</keyword>
                    <keyword>DO WHILE</keyword>
                    <keyword>FOR EACH</keyword>
                    <keyword>FOR</keyword>
                    <keyword>TO</keyword>
                    <keyword>STEP</keyword>
                    <keyword>IN</keyword>
                    <keyword>EXIT</keyword>
                    <keyword>LOOP</keyword>
                    <keyword>RETURN</keyword>
                    <keyword>LOCAL</keyword>
                    <keyword>MEMVAR</keyword>
                    <keyword>FIELD</keyword>
                    <keyword>MESSAGE</keyword>
                    <keyword>OPERATOR</keyword>
                    <keyword>OVERRIDE PARAMETERS</keyword>
                    <keyword>REQUEST</keyword>
                    <keyword>END</keyword>
                    <keyword>TRY</keyword>
                    <keyword>ELSEIF</keyword>
                    <keyword>TRY</keyword>
                    <keyword>THROW</keyword>
                    <keyword>CATCH</keyword>
                    <keyword>FINALLY</keyword>
                    <keyword>WITH OBJECT</keyword>
                    <keyword>REPLACE</keyword>
                    <keyword>WITH</keyword>
                    <keyword>@</keyword>                   
                    <keyword>SAY</keyword>
                    <keyword>GET</keyword>
                    <keyword>OF</keyword>
                    <keyword>SIZE</keyword> 
                    <keyword>WHEN</keyword>
                    <keyword>DEFINE DIALOG</keyword>
                    <keyword>TITLE</keyword>                
                </context>

                <context id="types" style-ref="type">
                    <keyword>DATA</keyword>
                    <keyword>CONSTRUCTOR</keyword>
                    <keyword>PROCEDURE</keyword>
                    <keyword>METHOD</keyword>
                    <keyword>FUNCTION</keyword>
                    <keyword>self</keyword>
                    <keyword>nil</keyword> 
                </context>

                <context id="storage-class" style-ref="storage-class">
                    <keyword>PUBLIC</keyword>
                    <keyword>VIRTUAL</keyword>
                    <keyword>PRIVATE</keyword>
                    <keyword>STATIC</keyword>
                    <keyword>EXPORTED:</keyword>
                    <keyword>PROTECTED:</keyword>
                    <keyword>HIDDEN:</keyword>
                    <keyword>GLOBAL</keyword>

                </context>

                <context id="common-defines" style-ref="common-defines">
                    <keyword>CRLF</keyword>
                    <keyword>TRUE</keyword>
                    <keyword>FALSE</keyword>
                </context>

                <!-- C99 booleans -->                
                <context id="boolean" style-ref="boolean">
                    <match extended="true">
                        \.[tTfF]\.
                    </match>
                </context>

            </include>
        </context>
    </definitions>
</language>
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Doug,

We have found that the Wine emulator is working better and better, so we use our familiar UEStudio in Linux too :-)

So we use the same source code editor in Windows and Linux now :-)

You can easily install Wine in Ubuntu from add/remove software menu option
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post by xProgrammer »

Hi Antonio

Thanks for the info.

I now have gedit behaving pretty much as I want it so I'd rather stay with something that isn't relying on an emulator.

I have made further improvements since last version of xbase.lang posted here. Still shows signs of being a hack from c.lang. I'll fix that doing some renaming and removing superfluous stuff (already started). I have reallocated a few keywords and reworked the preprocessor commands so that they line up with (x)Harbour.

I only mention this in case anyone else wants to use gedit and would like a better xbase.lang file than what I have already posted.

Regards
Doug
(xProgrammer)
Post Reply