From 1e6323e5bb04f49df9d00e82e5db3e8f301dbfc4 Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 12 May 2014 11:29:32 -0400 Subject: Fix unnecessary rules for FORTRAN types --- src/fortrancode.l | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/fortrancode.l b/src/fortrancode.l index 02a827e..a658030 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -688,8 +688,7 @@ NUM_TYPE (complex|integer|logical|real) LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.) KIND {ARGS} CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS})) -TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|PROCEDURE) -TYPE_PREFIX ((TYPE|CLASS|PROCEDURE){BS}"(") +TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED) @@ -718,7 +717,6 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I %x Use %x UseOnly %x Import -%x TypeDecl %x Declaration %x DeclContLine %x Parameterlist @@ -828,7 +826,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I g_insideBody=FALSE; } /*-------- fortran module -----------------------------------------*/ -("block"{BS}"data"|"program"|"module"|"type"|"interface")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { // +("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { // startScope(); startFontClass("keyword"); codifyLines(yytext); @@ -837,6 +835,14 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I BEGIN(ClassName); if (!qstricmp(yytext,"module")) currentModule="module"; } +("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { // + startScope(); + startFontClass("keyword"); + codifyLines(yytext); + endFontClass(); + yy_push_state(YY_START); + BEGIN(ClassName); + } {ID} { if (currentModule == "module") { @@ -905,24 +911,6 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I endFontClass(); } /*-------- variable declaration ----------------------------------*/ -^{BS}{TYPE_PREFIX}/{ID} { - yy_push_state(YY_START); - BEGIN(TypeDecl); - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - } -{ID} { // link type - g_insideBody=TRUE; - generateLink(*g_code,yytext); - g_insideBody=FALSE; - } -")" { - BEGIN(Declaration); - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - } {TYPE_SPEC}/[,:( ] { yy_push_state(YY_START); BEGIN(Declaration); -- cgit v0.12