Hello Andrew,

On https://en.wikibooks.org/wiki/GLPK/Linux_IDEs we have:

*To do: improve!*

I attach a file (*glpk.xml*) for highlighting GLPK files on Kate (Linux
text editor).

The *glpk.xml* file is used to get Kate color highlighting similar to GUSEK
color highlighting when using GLPK files with Glpsol solver.

Files extensions: .mod;.md;.dat;.mps;.lp;.out;.glp;.glpk;.sol;.sen;.run

You should *copy the file and paste it on Kate syntax folder*

sudo cp glpk.xml /usr/share/kde4/apps/katepart/syntax

Then, close and open Kate (to update),

Open a .mod or .dat file, for example, and set:

*Tools > Highlighting > Scientific > MathProg*

In my opinion, Kate is a good text editor because it can synchronize GLPK
commands (available on --help) with terminal.

Settings > Configure Kate > Plugins > Terminal Tool View

View → Tool Views → Show Terminal

https://docs.kde.org/trunk5/en/applications/kate/kate-
application-plugin-konsole.html

I am not an experienced programmer. I do not have the kate maintainers
contact.
I hope the GLPK community can improve this file and let us know.

I hope it helps.

Bests,
--
​​João Flávio de Freitas Almeida
Professor Adjunto A N-01
Departamento de Engenharia de Produção
Universidade Federal de Minas Gerais
30.310-290 Belo Horizonte MG Brasil
Tel: +55 31 3409-3476
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
  ====================================================================
  MathProg syntax highlighting file for the KDE editor Kate
  ====================================================================
      works (at least) for GLPK versions 4.59
      works with Kate 3.14.2 (KDE 4.14.2)
      
      Author: João Flávio de Freitas Almeida, 
              Universidade Federal de Minas Gerais, UFMG, Brazil
              ([email protected])

      Change log: 
      07-Mai-17  Created.
        
        http://docs.kde.org/stable/en/applications/kate/highlight.html
        Ref: language.dtd documentation.
-->


<language 
  name="MathProg" 
  section="Scientific" 
  version="4.59" 
  kateversion="3.14.2" 
  indenter="cstyle"
  style="GLPK"
  mimetype="text/glpk" 
  extensions="*.mod;*.md;*.dat;*.mps;*.lp;*.out;*.glp;*.glpk;*.sol;*.sen;*.run" 
  casesensitive="TRUE" 
  author="Joao Flavio F. Almeida ([email protected])" 
  license="GPL" 
  priority="3"
 >
  
  <highlighting>
    
    <!-- Reserved keywords in MathProg 
    
    Color reference: GUSEK (http://gusek.sourceforge.net/gusek.html)
    
    Comment:    #006000         Gree           
    Number:     #007F7F         Light Blue
    Keyword:    #00007F         Dark Blue     Bold
    String:     #7F007F         Print            " "
    Delimiters: #3B4D65         Grey
    Operator:   #000000         Black
    
    Folder: /usr/share/kde4/apps/katepart/syntax
    -->
    
    <list name="keywords">
      <item> and </item>
      <item> by </item>
      <item> cross </item>      
      <item> diff </item>
      <item> dimen </item>
      <item> div </item>
      <item> else </item>
      <item> if </item>
      <item> in </item>
      <item> inter </item>
      <item> less </item>
      <item> mod </item>
      <item> not </item>
      <item> or </item>      
      <item> symdiff </item>    
      <item> then </item>    
      <item> union </item>    
      <item> within </item>    
    </list>
                
    <list name="functions">
      <item> abs </item>
      <item> atan </item>
      <item> atan </item>
      <item> card </item>
      <item> ceil </item>
      <item> cos </item>
      <item> exp </item>
      <item> floor </item>
      <item> gmtime </item>
      <item> Irand224 </item>
      <item> length </item>
      <item> log </item>
      <item> log10 </item>
      <item> max( </item>
      <item> min( </item>    
      <item> Normal </item>    
      <item> Normal01 </item>      
      <item> round </item>
      <item> round </item>    
      <item> sin </item>    
      <item> sqrt </item>    
      <item> str2time </item>
      <item> substr </item>
      <item> substr </item>
      <item> time2str </item>
      <item> trunc </item>    
      <item> trunc </item>    
      <item> Uniform </item>    
      <item> Uniform01 </item>
    </list>

    <list name="statements">
      <item> set </item>
      <item> param </item>
      <item> var </item>
      <item> s.t. </item>
      <item> subject to </item>
      <item> Subject To </item>
      <item> subj </item>
      <item> minimize </item>
      <item> Minimize </item>
      <item> maximize </item>
      <item> Maximize </item>
      <item> solve </item>
      <item> check </item>
      <item> display </item>
      <item> printf </item>
      <item> printf</item>
      <item> for </item>
      <item> table </item> 
      <item> data </item>
      <item> Bounds </item>    
    </list>    
    
    <list name="suffixes">
      <item> max.abs.err </item>
      <item> max.rel.err </item>      
      <item> .lb </item>
      <item> .ub </item>
      <item> .status </item>
      <item> .val </item>
      <item> .dual </item>
    </list>     
              
    <list name="iterated">      
      <item> exists </item>
      <item> forall </item>
      <item> max </item>
      <item> min </item>
      <item> prod </item>  
      <item> setof </item>   
      <item> sum </item>
    </list>     
             
    <list name="attributes">
      <item> binary </item>
      <item> integer </item>
      <item> symbolic </item>      
      <item> default </item>      
      <item> IN </item>    
      <item> OUT </item>
      <item> end </item>
      <item> tr </item>      
    </list>  
    
    <list name="types">
      <item> char </item>
      <item> const </item>
      <item> double </item>
      <item> float </item>
      <item> int </item>
    </list>
    
    
    <contexts>
      
      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
        <DetectSpaces />
        
        <!-- Handling of keywords, comments, functions, identifiers, numbers and braces -->        
        <keyword context="#stay" attribute="Keyword" String="keywords" />
        <keyword context="#stay" attribute="Functions" String="functions" />
        <keyword context="#stay" attribute="Statements" String="statements" />
        <keyword context="#stay" attribute="Suffixes" String="suffixes" />
        <keyword context="#stay" attribute="Iterated" String="iterated" />
        <keyword context="#stay" attribute="Attributes" String="attributes" />        
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <DetectIdentifier />
        <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
        <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
        <Float attribute="Float" context="#stay">
          <AnyChar String="fF" attribute="Float" context="#stay"/>
        </Float>
        
        <Int attribute="Decimal" context="#stay"/>
        <HlCChar attribute="Char" context="#stay"/>
        <DetectChar attribute="String" context="String" char="&quot;" />
	<DetectChar attribute="String" context="String2" char="'" /> 	
        <DetectChar attribute="Comment" context="Commentar 1" char="#" />
        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
      </context>
      
      <context attribute="String" lineEndContext="#pop" name="String">
        <LineContinue attribute="String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>
        <DetectChar attribute="String" context="#pop" char="&quot;"/>	
      </context>
      
      <context attribute="String" lineEndContext="#pop" name="String2">
        <LineContinue attribute="String" context="#stay"/>
        <HlCStringChar attribute="String Char" context="#stay"/>        
	<DetectChar attribute="String" context="#pop" char="'"/>
      </context>

      <context attribute="Comment" lineEndContext="#pop" name="Commentar 1">
        <LineContinue attribute="Comment" context="#stay"/>
      </context>

      <context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
      </context>  
      
    </contexts>    
    
    <itemDatas>
      <itemData name="Normal Text"      defStyleNum="dsNormal"          color="#000000" bold="FALSE"    spellChecking="false"/>
      
      <itemData name="Keyword"          defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false" />
      <itemData name="Functions"        defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false"/>
      <itemData name="Statements"       defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false"/>
      <itemData name="Suffixes"         defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false"/>
      <itemData name="Iterated"         defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false"/>
      <itemData name="Attributes"       defStyleNum="dsKeyword"         color="#00007F" bold="TRUE"     spellChecking="false"/>

      <itemData name="Data Type"    defStyleNum="dsDataType"            color="#007F7F" bold="FALSE"    spellChecking="false"/> 
      <itemData name="Decimal"      defStyleNum="dsDecVal"              color="#007F7F" bold="FALSE"    spellChecking="false"/>
      <itemData name="Float"        defStyleNum="dsFloat"               color="#007F7F" bold="FALSE"    spellChecking="false"/>
      <itemData name="Char"         defStyleNum="dsChar"                color="#7F007F" bold="FALSE"    spellChecking="false"/>
      <itemData name="String"       defStyleNum="dsString"              color="#7F007F" bold="FALSE"    spellChecking="false"/>
      <itemData name="String Char"  defStyleNum="dsChar"                color="#7F007F" bold="FALSE"    spellChecking="false"/>
      <itemData name="Comment"      defStyleNum="dsComment"             color="#006000" bold="FALSE"    spellChecking="false"/> 
      <itemData name="Symbol"       defStyleNum="dsNormal"              color="#3B4D65" bold="TRUE"     spellChecking="false"/>

    </itemDatas>
    
  </highlighting>
  
  <general>
    <comments>
      <comment name="singleLine" start="#"/>      
      <comment name="multiLine" start="/*" end="*/"/>      
    </comments>
    <keywords casesensitive="TRUE" weakDeliminator="."/>
  </general>
  
</language>
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to