[geany/geany] d4e61b: Add support for Abaqus files

Baptiste Pierrat git-noreply at xxxxx
Tue Feb 12 13:56:38 UTC 2013


Branch:      refs/heads/master
Author:      Baptiste Pierrat <baptiste.pierrat at gmail.com>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Tue, 12 Feb 2013 13:56:38 UTC
Commit:      d4e61bf0933038b3de8f7a16425e82bb51c44285
             https://github.com/geany/geany/commit/d4e61bf0933038b3de8f7a16425e82bb51c44285

Log Message:
-----------
Add support for Abaqus files

Support for Abaqus (.inp) files, including scintilla lexer and tag
parser.

Signed-off-by: Baptiste Pierrat <baptiste.pierrat at gmail.com>


Modified Paths:
--------------
    data/filetype_extensions.conf
    data/filetypes.abaqus
    scintilla/Makefile.am
    scintilla/lexers/LexAbaqus.cxx
    scintilla/makefile.win32
    scintilla/scintilla_changes.patch
    scintilla/src/Catalogue.cxx
    src/filetypes.c
    src/filetypes.h
    src/highlighting.c
    src/highlightingmappings.h
    src/symbols.c
    tagmanager/ctags/Makefile.am
    tagmanager/ctags/abaqus.c
    tagmanager/ctags/makefile.win32
    tagmanager/ctags/parsers.h
    wscript

Modified: data/filetype_extensions.conf
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -2,6 +2,7 @@
 # Insert as many items as you want, seperate them with a ";".
 # See Geany's main documentation for details.
 [Extensions]
+Abaqus=*.inp;
 Abc=*.abc;*.abp;
 ActionScript=*.as;
 Ada=*.adb;*.ads;


Modified: data/filetypes.abaqus
67 files changed, 67 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,67 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# Edit these in the colorscheme .conf file instead
+default=default
+comment=comment_line
+commentblock=comment
+number=number
+string=string_1
+operator=operator
+word=string
+processors=preprocessor
+commands=keyword
+slashcommands=keyword
+starcommands=keyword
+arguments=parameter
+functions=function
+
+[keywords]
+# all items must be in one line
+starcommands=amplitude assembly beam boundary buckle bulk cload conditions conductivity contact damping density dload dsflux dsload dynamic el elastic element element output elgen elset encastre end step expansion explicit equation embedded element field freq frequency friction generate heading heat transfer history imperfectio import include initial initial conditions instance interactio internal interval marks material monitor mpc ncopy nfill ngen nlgeom node node output node print nset number output pair parameter part physical constants plastic print preprint radiate restart shell shell section solid section specific heat sradiate static step surface temperature time type variable viscosity 
+arguments=elset engineering inc input line material name nset pin tie type write generate field variable history stefan boltzmann absolute zero zero frequency steady state new old set change number shift model position newset oldset host
+
+[settings]
+# default extension used when saving files
+extension=inp
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# single comments, like # in this file
+comment_single=**
+# multiline comments
+#comment_open=
+#comment_close=
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+	#command_example();
+# setting to false would generate this
+#	command_example();
+# This setting works only for single line comments
+comment_use_indent=false
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
+
+[indentation]
+#width=4
+# 0 is spaces, 1 is tabs, 2 is tab & spaces
+#type=1
+
+
+[build_settings]
+# %f will be replaced by the complete filename
+# %e will be replaced by the filename without extension
+# (use only one of it at one time)
+compiler=
+run_cmd=abaqus job="%f" interactive datacheck
+
+[build-menu]
+FT_00_LB=Datacheck
+FT_00_CM=abaqus job="%f" interactive datacheck
+FT_00_BD=false
+FT_01_LB=Run Job
+FT_01_CM=abaqus job="%f" interactive
+FT_01_BD=false
+


Modified: scintilla/Makefile.am
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -6,6 +6,7 @@ noinst_LIBRARIES=libscintilla.a
 AM_CXXFLAGS = -DNDEBUG -DGTK -DSCI_LEXER -DG_THREADS_IMPL_NONE
 
 LEXER_SRCS= \
+lexers/LexAbaqus.cxx \
 lexers/LexAda.cxx \
 lexers/LexAsm.cxx \
 lexers/LexBash.cxx \


Modified: scintilla/lexers/LexAbaqus.cxx
620 files changed, 620 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,620 @@
+// Scintilla source code edit control
+/** @file LexABAQUS.cxx
+ ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz.
+ ** By Sergio Lucato.
+ ** Sort of completely rewritten by Gertjan Kloosterman
+ **/
+// The License.txt file describes the conditions under which this software may be distributed.
+
+// Code folding copyied and modified from LexBasic.cxx
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <ctype.h>
+
+#include "ILexer.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#include "WordList.h"
+#include "LexAccessor.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "CharacterSet.h"
+#include "LexerModule.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+static inline bool IsAWordChar(const int ch) {
+	return (ch < 0x80 && (isalnum(ch) || (ch == '_')));
+}
+
+static inline bool IsAKeywordChar(const int ch) {
+	return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' ')));
+}
+
+static inline bool IsASetChar(const int ch) {
+	return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
+}
+
+static inline bool IsAnOperator(char ch) {
+	// '.' left out as it is used to make up numbers
+	if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
+		ch == '(' || ch == ')' || ch == '=' || ch == '^' ||
+		ch == '[' || ch == ']' || ch == '<' || ch == '&' ||
+		ch == '>' || ch == ',' || ch == '|' || ch == '~' ||
+		ch == '$' || ch == ':' || ch == '%')
+		return true;
+	return false;
+}
+
+static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
+                            Accessor &styler) {
+	enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
+					  DAT_LINE_VAL, DAT_LINE_COMMA,\
+					  COMMENT_LINE,\
+					  ST_ERROR, LINE_END } state ;
+
+	// Do not leak onto next line
+	state = LINE_END ;
+	initStyle = SCE_ABAQUS_DEFAULT;
+	StyleContext sc(startPos, length, initStyle, styler);
+
+	// Things are actually quite simple
+	// we have commentlines
+	// keywordlines and datalines
+	// On a data line there will only be colouring of numbers
+	// a keyword line is constructed as
+	// *word,[ paramname[=paramvalue]]*
+	// if the line ends with a , the keyword line continues onto the new line
+
+	for (; sc.More(); sc.Forward()) {
+		switch ( state ) {
+        case KW_LINE_KW :
+            if ( sc.atLineEnd ) {
+                // finished the line in keyword state, switch to LINE_END
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            } else if ( IsAKeywordChar(sc.ch) ) {
+                // nothing changes
+                state = KW_LINE_KW ;
+            } else if ( sc.ch == ',' ) {
+                // Well well we say a comma, arguments *MUST* follow
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = KW_LINE_COMMA ;
+            } else {
+                // Flag an error
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            // Done with processing
+            break ;
+        case KW_LINE_COMMA :
+            // acomma on a keywordline was seen
+            if ( IsAKeywordChar(sc.ch)) {
+                sc.SetState(SCE_ABAQUS_ARGUMENT) ;
+                state = KW_LINE_PAR ;
+            } else if ( sc.atLineEnd || (sc.ch == ',') ) {
+                // we remain in keyword mode
+                state = KW_LINE_COMMA ;
+            } else if ( sc.ch == ' ' ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = KW_LINE_COMMA ;
+            } else {
+                // Anything else constitutes an error
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case KW_LINE_PAR :
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            } else if ( IsAKeywordChar(sc.ch) || (sc.ch == '-') ) {
+                // remain in this state
+                state = KW_LINE_PAR ;
+            } else if ( sc.ch == ',' ) {
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = KW_LINE_COMMA ;
+            } else if ( sc.ch == '=' ) {
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = KW_LINE_EQ ;
+            } else {
+                // Anything else constitutes an error
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case KW_LINE_EQ :
+            if ( sc.ch == ' ' ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                // remain in this state
+                state = KW_LINE_EQ ;
+            } else if ( IsADigit(sc.ch) || (sc.ch == '-') || (sc.ch == '.' && IsADigit(sc.chNext)) ) {
+                sc.SetState(SCE_ABAQUS_NUMBER) ;
+                state = KW_LINE_VAL ;
+            } else if ( IsAKeywordChar(sc.ch) ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = KW_LINE_VAL ;
+            } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
+                sc.SetState(SCE_ABAQUS_STRING) ;
+                state = KW_LINE_VAL ;
+            } else {
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case KW_LINE_VAL :
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) {
+                // nothing changes
+                state = KW_LINE_VAL ;
+            } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') ||
+                    ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) &&
+                    (sc.state == SCE_ABAQUS_NUMBER)) {
+                // remain in number mode
+                state = KW_LINE_VAL ;
+            } else if (sc.state == SCE_ABAQUS_STRING) {
+                // accept everything until a closing quote
+                if ( sc.ch == '\'' || sc.ch == '\"' ) {
+                    sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                    state = KW_LINE_VAL ;
+                }
+            } else if ( sc.ch == ',' ) {
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = KW_LINE_COMMA ;
+            } else {
+                // anything else is an error
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case DAT_LINE_VAL :
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) {
+                // nothing changes
+                state = DAT_LINE_VAL ;
+            } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') ||
+                    ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) &&
+                    (sc.state == SCE_ABAQUS_NUMBER)) {
+                // remain in number mode
+                state = DAT_LINE_VAL ;
+            } else if (sc.state == SCE_ABAQUS_STRING) {
+                // accept everything until a closing quote
+                if ( sc.ch == '\'' || sc.ch == '\"' ) {
+                    sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                    state = DAT_LINE_VAL ;
+                }
+            } else if ( sc.ch == ',' ) {
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = DAT_LINE_COMMA ;
+            } else {
+                // anything else is an error
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case DAT_LINE_COMMA :
+            // a comma on a data line was seen
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            } else if ( sc.ch == ' ' ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = DAT_LINE_COMMA ;
+            } else if (sc.ch == ',')  {
+                sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                state = DAT_LINE_COMMA ;
+            } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) {
+                sc.SetState(SCE_ABAQUS_NUMBER) ;
+                state = DAT_LINE_VAL ;
+            } else if ( IsAKeywordChar(sc.ch) ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = DAT_LINE_VAL ;
+            } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
+                sc.SetState(SCE_ABAQUS_STRING) ;
+                state = DAT_LINE_VAL ;
+            } else {
+                sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                state = ST_ERROR ;
+            }
+            break ;
+        case COMMENT_LINE :
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            }
+            break ;
+        case ST_ERROR :
+            if ( sc.atLineEnd ) {
+                sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                state = LINE_END ;
+            }
+            break ;
+        case LINE_END :
+            if ( sc.atLineEnd || sc.ch == ' ' ) {
+                // nothing changes
+                state = LINE_END ;
+            } else if ( sc.ch == '*' ) {
+                if ( sc.chNext == '*' ) {
+                    state = COMMENT_LINE ;
+                    sc.SetState(SCE_ABAQUS_COMMENT) ;
+                } else {
+                    state = KW_LINE_KW ;
+                    sc.SetState(SCE_ABAQUS_STARCOMMAND) ;
+                }
+            } else {
+                // it must be a data line, things are as if we are in DAT_LINE_COMMA
+                if ( sc.ch == ',' ) {
+                    sc.SetState(SCE_ABAQUS_OPERATOR) ;
+                    state = DAT_LINE_COMMA ;
+                } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) {
+                    sc.SetState(SCE_ABAQUS_NUMBER) ;
+                    state = DAT_LINE_VAL ;
+                } else if ( IsAKeywordChar(sc.ch) ) {
+                    sc.SetState(SCE_ABAQUS_DEFAULT) ;
+                    state = DAT_LINE_VAL ;
+                } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) {
+                    sc.SetState(SCE_ABAQUS_STRING) ;
+                    state = DAT_LINE_VAL ;
+                } else {
+                    sc.SetState(SCE_ABAQUS_PROCESSOR) ;
+                    state = ST_ERROR ;
+                }
+            }
+            break ;
+		  }
+   }
+   sc.Complete();
+}
+
+//------------------------------------------------------------------------------
+// This copyied and modified from LexBasic.cxx
+//------------------------------------------------------------------------------
+
+/* Bits:
+ * 1  - whitespace
+ * 2  - operator
+ * 4  - identifier
+ * 8  - decimal digit
+ * 16 - hex digit
+ * 32 - bin digit
+ */
+static int character_classification[128] =
+{
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  1,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    1,  2,  0,  2,  2,  2,  2,  2,  2,  2,  6,  2,  2,  2,  10, 6,
+    60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2,  2,  2,  2,  2,  2,
+    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  4,
+    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  0
+};
+
+static bool IsSpace(int c) {
+	return c < 128 && (character_classification[c] & 1);
+}
+
+static bool IsIdentifier(int c) {
+	return c < 128 && (character_classification[c] & 4);
+}
+
+static int LowerCase(int c)
+{
+	if (c >= 'A' && c <= 'Z')
+		return 'a' + c - 'A';
+	return c;
+}
+
+static int LineEnd(int line, Accessor &styler)
+{
+    const int docLines = styler.GetLine(styler.Length() - 1);  // Available last line
+    int eol_pos ;
+    // if the line is the last line, the eol_pos is styler.Length()
+    // eol will contain a new line, or a virtual new line
+    if ( docLines == line )
+        eol_pos = styler.Length() ;
+    else
+        eol_pos = styler.LineStart(line + 1) - 1;
+    return eol_pos ;
+}
+
+static int LineStart(int line, Accessor &styler)
+{
+    return styler.LineStart(line) ;
+}
+
+// LineType
+//
+// bits determines the line type
+// 1  : data line
+// 2  : only whitespace
+// 3  : data line with only whitespace
+// 4  : keyword line
+// 5  : block open keyword line
+// 6  : block close keyword line
+// 7  : keyword line in error
+// 8  : comment line
+static int LineType(int line, Accessor &styler) {
+    int pos = LineStart(line, styler) ;
+    int eol_pos = LineEnd(line, styler) ;
+
+    int c ;
+    char ch = ' ';
+
+    int i = pos ;
+    while ( i < eol_pos ) {
+        c = styler.SafeGetCharAt(i);
+        ch = static_cast<char>(LowerCase(c));
+        // We can say something as soon as no whitespace
+        // was encountered
+        if ( !IsSpace(c) )
+            break ;
+        i++ ;
+    }
+
+    if ( i >= eol_pos ) {
+        // This is a whitespace line, currently
+        // classifies as data line
+        return 3 ;
+    }
+
+    if ( ch != '*' ) {
+        // This is a data line
+        return 1 ;
+    }
+
+    if ( i == eol_pos - 1 ) {
+        // Only a single *, error but make keyword line
+        return 4+3 ;
+    }
+
+    // This means we can have a second character
+    // if that is also a * this means a comment
+    // otherwise it is a keyword.
+    c = styler.SafeGetCharAt(i+1);
+    ch = static_cast<char>(LowerCase(c));
+    if ( ch == '*' ) {
+        return 8 ;
+    }
+
+    // At this point we know this is a keyword line
+    // the character at position i is a *
+    // it is not a comment line
+    char word[256] ;
+    int  wlen = 0;
+
+    word[wlen] = '*' ;
+	wlen++ ;
+
+    i++ ;
+    while ( (i < eol_pos) && (wlen < 255) ) {
+        c = styler.SafeGetCharAt(i);
+        ch = static_cast<char>(LowerCase(c));
+
+        if ( (!IsSpace(c)) && (!IsIdentifier(c)) )
+            break ;
+
+        if ( IsIdentifier(c) ) {
+            word[wlen] = ch ;
+			wlen++ ;
+		}
+
+        i++ ;
+    }
+
+    word[wlen] = 0 ;
+
+    // Make a comparison
+	if ( !strcmp(word, "*step") ||
+         !strcmp(word, "*part") ||
+         !strcmp(word, "*instance") ||
+         !strcmp(word, "*assembly")) {
+       return 4+1 ;
+    }
+
+	if ( !strcmp(word, "*endstep") ||
+         !strcmp(word, "*endpart") ||
+         !strcmp(word, "*endinstance") ||
+         !strcmp(word, "*endassembly")) {
+       return 4+2 ;
+    }
+
+    return 4 ;
+}
+
+static void SafeSetLevel(int line, int level, Accessor &styler)
+{
+    if ( line < 0 )
+        return ;
+
+    int mask = ((~SC_FOLDLEVELHEADERFLAG) | (~SC_FOLDLEVELWHITEFLAG));
+
+    if ( (level & mask) < 0 )
+        return ;
+
+    if ( styler.LevelAt(line) != level )
+        styler.SetLevel(line, level) ;
+}
+
+static void FoldABAQUSDoc(unsigned int startPos, int length, int,
+WordList *[], Accessor &styler) {
+    int startLine = styler.GetLine(startPos) ;
+    int endLine   = styler.GetLine(startPos+length-1) ;
+
+    // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+    // We want to deal with all the cases
+    // To know the correct indentlevel, we need to look back to the
+    // previous command line indentation level
+	// order of formatting keyline datalines commentlines
+    int beginData    = -1 ;
+    int beginComment = -1 ;
+    int prvKeyLine   = startLine ;
+    int prvKeyLineTp =  0 ;
+
+    // Scan until we find the previous keyword line
+    // this will give us the level reference that we need
+    while ( prvKeyLine > 0 ) {
+        prvKeyLine-- ;
+        prvKeyLineTp = LineType(prvKeyLine, styler) ;
+        if ( prvKeyLineTp & 4 )
+            break ;
+    }
+
+    // Determine the base line level of all lines following
+    // the previous keyword
+    // new keyword lines are placed on this level
+    //if ( prvKeyLineTp & 4 ) {
+    int level = styler.LevelAt(prvKeyLine) & ~SC_FOLDLEVELHEADERFLAG ;
+    //}
+
+    // uncomment line below if weird behaviour continues
+    prvKeyLine = -1 ;
+
+    // Now start scanning over the lines.
+    for ( int line = startLine; line <= endLine; line++ ) {
+        int lineType = LineType(line, styler) ;
+
+        // Check for comment line
+        if ( lineType == 8 ) {
+            if ( beginComment < 0 ) {
+                beginComment = line ;
+			}
+        }
+
+        // Check for data line
+        if ( (lineType == 1) || (lineType == 3) ) {
+            if ( beginData < 0 ) {
+                if ( beginComment >= 0 ) {
+                    beginData = beginComment ;
+                } else {
+                    beginData = line ;
+                }
+            }
+			beginComment = -1 ;
+		}
+
+        // Check for keywordline.
+        // As soon as a keyword line is encountered, we can set the
+        // levels of everything from the previous keyword line to this one
+        if ( lineType & 4 ) {
+            // this is a keyword, we can now place the previous keyword
+            // all its data lines and the remainder
+
+            // Write comments and data line
+            if ( beginComment < 0 ) {
+                beginComment = line ;
+			}
+
+            if ( beginData < 0 ) {
+                beginData = beginComment ;
+				if ( prvKeyLineTp != 5 )
+					SafeSetLevel(prvKeyLine, level, styler) ;
+				else
+					SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
+            } else {
+                SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
+            }
+
+            int datLevel = level + 1 ;
+			if ( !(prvKeyLineTp & 4) ) {
+				datLevel = level ;
+			}
+
+            for ( int ll = beginData; ll < beginComment; ll++ )
+                SafeSetLevel(ll, datLevel, styler) ;
+
+            // The keyword we just found is going to be written at another level
+            // if we have a type 5 and type 6
+            if ( prvKeyLineTp == 5 ) {
+                level += 1 ;
+			}
+
+            if ( prvKeyLineTp == 6 ) {
+                level -= 1 ;
+				if ( level < 0 ) {
+					level = 0 ;
+				}
+            }
+
+            for ( int lll = beginComment; lll < line; lll++ )
+                SafeSetLevel(lll, level, styler) ;
+
+            // wrap and reset
+            beginComment = -1 ;
+            beginData    = -1 ;
+            prvKeyLine   = line ;
+            prvKeyLineTp = lineType ;
+        }
+
+    }
+
+    if ( beginComment < 0 ) {
+        beginComment = endLine + 1 ;
+    } else {
+        // We need to find out whether this comment block is followed by
+        // a data line or a keyword line
+        const int docLines = styler.GetLine(styler.Length() - 1);
+
+        for ( int line = endLine + 1; line <= docLines; line++ ) {
+            int lineType = LineType(line, styler) ;
+
+            if ( lineType != 8 ) {
+				if ( !(lineType & 4) )  {
+					beginComment = endLine + 1 ;
+				}
+                break ;
+			}
+        }
+    }
+
+    if ( beginData < 0 ) {
+        beginData = beginComment ;
+		if ( prvKeyLineTp != 5 )
+			SafeSetLevel(prvKeyLine, level, styler) ;
+		else
+			SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
+    } else {
+        SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ;
+    }
+
+    int datLevel = level + 1 ;
+	if ( !(prvKeyLineTp & 4) ) {
+		datLevel = level ;
+	}
+
+    for ( int ll = beginData; ll < beginComment; ll++ )
+        SafeSetLevel(ll, datLevel, styler) ;
+
+	if ( prvKeyLineTp == 5 ) {
+		level += 1 ;
+	}
+
+	if ( prvKeyLineTp == 6 ) {
+		level -= 1 ;
+	}
+	for ( int m = beginComment; m <= endLine; m++ )
+        SafeSetLevel(m, level, styler) ;
+}
+
+static const char * const abaqusWordListDesc[] = {
+    "processors",
+    "commands",
+    "slashommands",
+    "starcommands",
+    "arguments",
+    "functions",
+    0
+};
+
+LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc);


Modified: scintilla/makefile.win32
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -63,6 +63,7 @@ MARSHALLER=scintilla-marshal.o
 	$(CC) $(CXXFLAGS) -c $<
 
 LEXOBJS=\
+LexAbaqus.o \
 LexAda.o \
 LexAsm.o \
 LexBash.o \


Modified: scintilla/scintilla_changes.patch
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -36,7 +36,7 @@ index 2f75247..a34f834 100644
  //++Autogenerated -- run src/LexGen.py to regenerate
  //**\(\tLINK_LEXER(\*);\n\)
 -	LINK_LEXER(lmA68k);
--	LINK_LEXER(lmAbaqus);
+ 	LINK_LEXER(lmAbaqus);
  	LINK_LEXER(lmAda);
 -	LINK_LEXER(lmAns1);
 -	LINK_LEXER(lmAPDL);


Modified: scintilla/src/Catalogue.cxx
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -81,6 +81,7 @@ int Scintilla_LinkLexers() {
 
 //++Autogenerated -- run src/LexGen.py to regenerate
 //**\(\tLINK_LEXER(\*);\n\)
+	LINK_LEXER(lmAbaqus);
 	LINK_LEXER(lmAda);
 	LINK_LEXER(lmAsm);
 	LINK_LEXER(lmBash);


Modified: src/filetypes.c
6 files changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -504,6 +504,12 @@ static void init_builtin_filetypes(void)
 	filetype_make_title(ft, TITLE_SOURCE_FILE);
 	ft->group = GEANY_FILETYPE_GROUP_MARKUP;
 
+#define ABAQUS
+	ft = filetypes[GEANY_FILETYPES_ABAQUS];
+	ft->lang = 44;
+	ft->name = g_strdup("Abaqus");
+	filetype_make_title(ft, TITLE_SOURCE_FILE);
+	ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
 }
 
 


Modified: src/filetypes.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -91,6 +91,7 @@
 	GEANY_FILETYPES_COBOL,
 	GEANY_FILETYPES_OBJECTIVEC,
 	GEANY_FILETYPES_ASCIIDOC,
+	GEANY_FILETYPES_ABAQUS,
 	/* ^ append items here */
 	GEANY_MAX_BUILT_IN_FILETYPES	/* Don't use this, use filetypes_array->len instead */
 }


Modified: src/highlighting.c
9 files changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -1039,6 +1039,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co
 
 	switch (lexer_id)
 	{
+		init_styleset_case(ABAQUS);
 		init_styleset_case(ADA);
 		init_styleset_case(ASM);
 		init_styleset_case(BASIC);
@@ -1118,6 +1119,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
 
 	switch (lexer_id)
 	{
+		styleset_case(ABAQUS);
 		styleset_case(ADA);
 		styleset_case(ASM);
 		styleset_case(BASIC);
@@ -1563,6 +1565,9 @@ gboolean highlighting_is_string_style(gint lexer, gint style)
 				style == SCE_ADA_STRING ||
 				style == SCE_ADA_CHARACTEREOL ||
 				style == SCE_ADA_STRINGEOL);
+
+		case SCLEX_ABAQUS:
+			return (style == SCE_ABAQUS_STRING);
 	}
 	return FALSE;
 }
@@ -1700,6 +1705,10 @@ gboolean highlighting_is_comment_style(gint lexer, gint style)
 			return (style == SCE_ADA_COMMENTLINE ||
 				style == SCE_NSIS_COMMENTBOX);
 
+		case SCLEX_ABAQUS:
+			return (style == SCE_ABAQUS_COMMENT ||
+				 style == SCE_ABAQUS_COMMENTBLOCK);
+
 		case SCLEX_ASM:
 			return (style == SCE_ASM_COMMENT ||
 				style == SCE_ASM_COMMENTBLOCK ||


Modified: src/highlightingmappings.h
30 files changed, 30 insertions(+), 0 deletions(-)
===================================================================
@@ -69,6 +69,36 @@
 #define HL_N_ENTRIES(array) ((array != NULL) ? G_N_ELEMENTS(array) : 0)
 
 
+/* Abaqus */
+#define highlighting_lexer_ABAQUS			SCLEX_ABAQUS
+static const HLStyle highlighting_styles_ABAQUS[] =
+{
+	{ SCE_ABAQUS_DEFAULT,		"default",		FALSE },
+	{ SCE_ABAQUS_COMMENT,		"comment",		FALSE },
+	{ SCE_ABAQUS_COMMENTBLOCK,	"commentblock",		FALSE },
+	{ SCE_ABAQUS_NUMBER,		"number",		FALSE },
+	{ SCE_ABAQUS_STRING,		"string",		FALSE },
+	{ SCE_ABAQUS_OPERATOR,		"operator",		FALSE },
+	{ SCE_ABAQUS_WORD,		"word",			FALSE },
+	{ SCE_ABAQUS_PROCESSOR,		"processors",		FALSE },
+	{ SCE_ABAQUS_COMMAND,		"commands",		FALSE },
+	{ SCE_ABAQUS_SLASHCOMMAND,	"slashcommands",		FALSE },
+	{ SCE_ABAQUS_STARCOMMAND,	"starcommands",		FALSE },
+	{ SCE_ABAQUS_ARGUMENT,		"arguments",		FALSE },
+	{ SCE_ABAQUS_FUNCTION,		"functions",		FALSE }
+};
+static const HLKeyword highlighting_keywords_ABAQUS[] =
+{
+	{ 0, "processors", FALSE },
+	{ 1, "commands", FALSE },
+	{ 2, "slashommands", FALSE },
+	{ 3, "starcommands", FALSE },
+	{ 4, "arguments", FALSE },
+	{ 5, "functions", FALSE }
+};
+#define highlighting_properties_ABAQUS		EMPTY_PROPERTIES
+
+
 /* Ada */
 #define highlighting_lexer_ADA			SCLEX_ADA
 static const HLStyle highlighting_styles_ADA[] =


Modified: src/symbols.c
9 files changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -746,6 +746,15 @@ static void add_top_level_items(GeanyDocument *doc)
 				NULL);
 			break;
 		}
+		case GEANY_FILETYPES_ABAQUS:
+		{
+			tag_list_add_groups(tag_store,
+				&(tv_iters.tag_class), _("Parts"), NULL,
+				&(tv_iters.tag_member), _("Assembly"), NULL,
+				&(tv_iters.tag_namespace), _("Steps"), NULL,
+				NULL);
+			break;
+		}
 		case GEANY_FILETYPES_R:
 		{
 			tag_list_add_groups(tag_store,


Modified: tagmanager/ctags/Makefile.am
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -11,6 +11,7 @@ EXTRA_DIST = \
 noinst_LIBRARIES = libctags.a
 
 parsers = \
+	abaqus.c \
 	abc.c \
 	actionscript.c \
 	asciidoc.c \


Modified: tagmanager/ctags/abaqus.c
126 files changed, 126 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,126 @@
+/*
+ *   This source code is released for free distribution under the terms of the
+ *   GNU General Public License.
+ *
+ *   This module contains functions for generating tags for source files
+ *   for inp files (Abaqus).
+ */
+
+/*
+*   INCLUDE FILES
+*/
+#include "general.h"	/* must always come first */
+
+#include <ctype.h>
+#include <string.h>
+
+#include "parse.h"
+#include "read.h"
+#include "vstring.h"
+
+/*
+*   DATA DEFINITIONS
+*/
+typedef enum {
+	K_PART,
+	K_ASSEMBLY,
+	K_STEP
+} AbaqusKind;
+
+static kindOption AbaqusKinds[] = {
+     { TRUE, 'c', "class",      "Parts" },
+     { TRUE, 'm', "member",      "Assembly" },
+     { TRUE, 'n', "namespace",      "Steps" }
+};
+
+/*
+*   FUNCTION DEFINITIONS
+*/
+
+static int getWord(const char *ref, const char **ptr)
+{
+	const char *p = *ptr;
+
+	while ((*ref != '\0') && (*p != '\0') && (tolower(*ref) == tolower(*p))) ref++, p++;
+
+	if (*ref) return FALSE;
+
+	*ptr = p;
+	return TRUE;
+}
+
+
+static void createTag(AbaqusKind kind, const char *buf)
+{
+	vString *name;
+
+	if (*buf == '\0') return;
+
+	buf = strstr(buf, "=");
+	if (buf == NULL) return;
+
+	buf += 1;
+
+	if (*buf == '\0') return;
+
+	name = vStringNew();
+
+	do
+	{
+		vStringPut(name, (int) *buf);
+		++buf;
+	} while ((*buf != '\0') && (*buf != ','));
+	vStringTerminate(name);
+	makeSimpleTag(name, AbaqusKinds, kind);
+	vStringDelete(name);
+}
+
+
+static void findAbaqusTags(void)
+{
+	const char *line;
+
+	while ((line = (const char*)fileReadLine()) != NULL)
+	{
+		const char *cp = line;
+
+		for (; *cp != '\0'; cp++)
+		{
+			if (*cp == '*')
+			{
+				cp++;
+
+				/* Parts*/
+				if (getWord("part", &cp))
+				{
+					createTag(K_PART, cp);
+					continue;
+				}
+				/* Assembly */
+				if (getWord("assembly", &cp))
+				{
+					createTag(K_ASSEMBLY, cp);
+					continue;
+				}
+				/* Steps */
+				if (getWord("step", &cp))
+				{
+					createTag(K_STEP, cp);
+					continue;
+				}
+			}
+		}
+	}
+}
+
+
+extern parserDefinition* AbaqusParser (void)
+{
+	static const char *const extensions [] = { "inp", NULL };
+	parserDefinition * def = parserNew ("Abaqus");
+	def->kinds      = AbaqusKinds;
+	def->kindCount  = KIND_COUNT (AbaqusKinds);
+	def->extensions = extensions;
+	def->parser     = findAbaqusTags;
+	return def;
+}


Modified: tagmanager/ctags/makefile.win32
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -44,7 +44,7 @@ all: $(COMPLIB)
 clean:
 	-$(RM) deps.mak *.o $(COMPLIB)
 
-$(COMPLIB): abc.o args.o c.o cobol.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o verilog.o lua.o js.o \
+$(COMPLIB): abaqus.o abc.o args.o c.o cobol.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o verilog.o lua.o js.o \
 actionscript.o nsis.o objc.o \
 haskell.o haxe.o html.o python.o lregex.o asciidoc.o rest.o sh.o ctags.o entry.o get.o keyword.o nestlevel.o \
 options.o \


Modified: tagmanager/ctags/parsers.h
4 files changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -58,7 +58,8 @@
     RParser, \
     CobolParser, \
     ObjcParser, \
-    AsciidocParser
+    AsciidocParser, \
+    AbaqusParser
 /*
 langType of each parser
  0	CParser
@@ -105,6 +106,7 @@
 41	CobolParser
 42	ObjcParser
 43  AsciidocParser
+44	AbaqusParser
 */
 #endif	/* _PARSERS_H */
 


Modified: wscript
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -61,6 +61,7 @@ out = '_build_'
 mio_sources = set(['tagmanager/mio/mio.c'])
 
 ctags_sources = set([
+    'tagmanager/ctags/abaqus.c',
     'tagmanager/ctags/args.c',
     'tagmanager/ctags/abc.c',
     'tagmanager/ctags/actionscript.c',



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list