BUG: Fix for bug#5809. Applied patch supplied in the bug report. Updated pre-generated lexer and parser sources. This updates the makedepf90 version to 2.8.8. The parser actions have been updated to ignore "use" in comments properly.
This commit is contained in:
parent
00c33e7e8f
commit
f8caab4613
|
@ -47,6 +47,7 @@ struct cmDependsFortranFile
|
||||||
YY_BUFFER_STATE Buffer;
|
YY_BUFFER_STATE Buffer;
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmDependsFortranParser_s
|
struct cmDependsFortranParser_s
|
||||||
{
|
{
|
||||||
cmDependsFortranParser_s(cmDependsFortran* self);
|
cmDependsFortranParser_s(cmDependsFortran* self);
|
||||||
|
@ -65,7 +66,12 @@ struct cmDependsFortranParser_s
|
||||||
std::string TokenString;
|
std::string TokenString;
|
||||||
|
|
||||||
// Flag for whether lexer is reading from inside an interface.
|
// Flag for whether lexer is reading from inside an interface.
|
||||||
int InInterface;
|
bool InInterface;
|
||||||
|
|
||||||
|
int OldStartcond;
|
||||||
|
bool InPPFalseBranch;
|
||||||
|
std::vector<bool> SkipToEnd;
|
||||||
|
int StepI;
|
||||||
|
|
||||||
// Set of provided and required modules.
|
// Set of provided and required modules.
|
||||||
std::set<cmStdString> Provides;
|
std::set<cmStdString> Provides;
|
||||||
|
@ -347,7 +353,7 @@ cmDependsFortranParser_s::~cmDependsFortranParser_s()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
|
bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
|
||||||
const char* fname)
|
const char* fname)
|
||||||
{
|
{
|
||||||
// Open the new file and push it onto the stack. Save the old
|
// Open the new file and push it onto the stack. Save the old
|
||||||
|
@ -371,7 +377,7 @@ int cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int cmDependsFortranParser_FilePop(cmDependsFortranParser* parser)
|
bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser)
|
||||||
{
|
{
|
||||||
// Pop one file off the stack and close it. Switch the lexer back
|
// Pop one file off the stack and close it. Switch the lexer back
|
||||||
// to the next one on the stack.
|
// to the next one on the stack.
|
||||||
|
@ -426,17 +432,30 @@ void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
|
||||||
int in)
|
bool in)
|
||||||
{
|
{
|
||||||
parser->InInterface = in;
|
parser->InInterface = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser)
|
bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser)
|
||||||
{
|
{
|
||||||
return parser->InInterface;
|
return parser->InInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser,
|
||||||
|
int arg)
|
||||||
|
{
|
||||||
|
parser->OldStartcond = arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser)
|
||||||
|
{
|
||||||
|
return parser->OldStartcond;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*)
|
void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +468,7 @@ void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*)
|
||||||
void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser,
|
||||||
const char* name)
|
const char* name)
|
||||||
{
|
{
|
||||||
parser->Requires.insert(name);
|
parser->Requires.insert(cmSystemTools::LowerCase(name) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -482,7 +501,7 @@ void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser,
|
||||||
void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser,
|
||||||
const char* name)
|
const char* name)
|
||||||
{
|
{
|
||||||
parser->Provides.insert(name);
|
parser->Provides.insert(cmSystemTools::LowerCase(name) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,7 @@
|
||||||
#define FLEX_SCANNER
|
#define FLEX_SCANNER
|
||||||
#define YY_FLEX_MAJOR_VERSION 2
|
#define YY_FLEX_MAJOR_VERSION 2
|
||||||
#define YY_FLEX_MINOR_VERSION 5
|
#define YY_FLEX_MINOR_VERSION 5
|
||||||
#define YY_FLEX_SUBMINOR_VERSION 31
|
#define YY_FLEX_SUBMINOR_VERSION 33
|
||||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||||
#define FLEX_BETA
|
#define FLEX_BETA
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,7 +47,15 @@
|
||||||
|
|
||||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||||
|
|
||||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
#if __STDC_VERSION__ >= 199901L
|
||||||
|
|
||||||
|
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||||
|
* if you want the limit (max/min) macros for int types.
|
||||||
|
*/
|
||||||
|
#ifndef __STDC_LIMIT_MACROS
|
||||||
|
#define __STDC_LIMIT_MACROS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
typedef int8_t flex_int8_t;
|
typedef int8_t flex_int8_t;
|
||||||
typedef uint8_t flex_uint8_t;
|
typedef uint8_t flex_uint8_t;
|
||||||
|
@ -201,24 +209,16 @@ struct yy_buffer_state
|
||||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||||
|
|
||||||
void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner );
|
void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner );
|
||||||
void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,
|
void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
|
||||||
YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,
|
void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
|
||||||
void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,
|
void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
|
||||||
void cmDependsFortran_yy_flush_buffer (YY_BUFFER_STATE b ,
|
|
||||||
yyscan_t yyscanner );
|
|
||||||
void cmDependsFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,
|
|
||||||
yyscan_t yyscanner );
|
|
||||||
void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner );
|
void cmDependsFortran_yypop_buffer_state (yyscan_t yyscanner );
|
||||||
|
|
||||||
YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,
|
YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
|
||||||
YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,
|
YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
|
||||||
YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,
|
|
||||||
yyscan_t yyscanner );
|
|
||||||
|
|
||||||
void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner );
|
void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner );
|
||||||
void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
|
void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
|
||||||
|
@ -255,8 +255,7 @@ void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner );
|
||||||
|
|
||||||
YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner );
|
YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner );
|
||||||
|
|
||||||
void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,
|
void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
|
||||||
yyscan_t yyscanner );
|
|
||||||
|
|
||||||
FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner );
|
FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner );
|
||||||
|
|
||||||
|
@ -319,15 +318,13 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner);
|
||||||
#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner)
|
#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner)
|
||||||
#endif /* !YY_DECL */
|
#endif /* !YY_DECL */
|
||||||
|
|
||||||
/* yy_get_previous_state - get the state just before the EOB char was reached
|
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||||
*/
|
|
||||||
|
|
||||||
#undef YY_NEW_FILE
|
#undef YY_NEW_FILE
|
||||||
#undef YY_FLUSH_BUFFER
|
#undef YY_FLUSH_BUFFER
|
||||||
#undef yy_set_bol
|
#undef yy_set_bol
|
||||||
#undef yy_new_buffer
|
#undef yy_new_buffer
|
||||||
#undef yy_set_interactive
|
#undef yy_set_interactive
|
||||||
#undef yytext_ptr
|
|
||||||
#undef YY_DO_BEFORE_ACTION
|
#undef YY_DO_BEFORE_ACTION
|
||||||
|
|
||||||
#ifdef YY_DECL_IS_OURS
|
#ifdef YY_DECL_IS_OURS
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
Portions of this source have been derived from makefdep90 version 2.6.2,
|
Portions of this source have been derived from makefdep90 version 2.8.8,
|
||||||
|
|
||||||
Copyright (C) 2000,2001 Erik Edelmann <eedelman@beam.helsinki.fi>.
|
Copyright (C) 2000,2001 Erik Edelmann <eedelman@beam.helsinki.fi>.
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ Modify cmDependsFortranLexer.h:
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
%option reentrant
|
%option reentrant
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
%pointer
|
%pointer
|
||||||
|
@ -75,16 +76,19 @@ Modify cmDependsFortranLexer.h:
|
||||||
|
|
||||||
\" {
|
\" {
|
||||||
cmDependsFortranParser_StringStart(yyextra);
|
cmDependsFortranParser_StringStart(yyextra);
|
||||||
|
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
|
||||||
BEGIN(str_dq);
|
BEGIN(str_dq);
|
||||||
}
|
}
|
||||||
|
|
||||||
' {
|
' {
|
||||||
cmDependsFortranParser_StringStart(yyextra);
|
cmDependsFortranParser_StringStart(yyextra);
|
||||||
|
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
|
||||||
BEGIN(str_sq);
|
BEGIN(str_sq);
|
||||||
}
|
}
|
||||||
|
|
||||||
<str_dq>\" |
|
<str_dq>\" |
|
||||||
<str_sq>' {
|
<str_sq>' {
|
||||||
|
BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) );
|
||||||
yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra));
|
yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra));
|
||||||
return STRING;
|
return STRING;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +96,15 @@ Modify cmDependsFortranLexer.h:
|
||||||
<str_dq,str_sq>&[ \t]*\n |
|
<str_dq,str_sq>&[ \t]*\n |
|
||||||
<str_dq,str_sq>&[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */
|
<str_dq,str_sq>&[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */
|
||||||
|
|
||||||
<fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] /*Ignore (cont. strings, fixed fmt) */
|
<fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] {
|
||||||
|
if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
|
||||||
|
; /* Ignore (cont. strings, fixed fmt) */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unput(yytext[strlen(yytext)-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
<str_dq,str_sq>\n {
|
<str_dq,str_sq>\n {
|
||||||
unput ('\n');
|
unput ('\n');
|
||||||
|
@ -110,23 +122,6 @@ Modify cmDependsFortranLexer.h:
|
||||||
#[ \t]*include { return CPP_INCLUDE; }
|
#[ \t]*include { return CPP_INCLUDE; }
|
||||||
\$[ \t]*include { return F90PPR_INCLUDE; }
|
\$[ \t]*include { return F90PPR_INCLUDE; }
|
||||||
\?\?[ \t]*include { return COCO_INCLUDE; }
|
\?\?[ \t]*include { return COCO_INCLUDE; }
|
||||||
INCLUDE { return F_INCLUDE; }
|
|
||||||
USE { return USE; }
|
|
||||||
|
|
||||||
END" "*INTERFACE {
|
|
||||||
cmDependsFortranParser_SetInInterface(yyextra, 0);
|
|
||||||
}
|
|
||||||
INTERFACE {
|
|
||||||
cmDependsFortranParser_SetInInterface(yyextra, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
END" "*MODULE /* Ignore */
|
|
||||||
MODULE {
|
|
||||||
if(!cmDependsFortranParser_GetInInterface(yyextra))
|
|
||||||
{
|
|
||||||
return MODULE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[ \t]*define { return CPP_DEFINE; }
|
#[ \t]*define { return CPP_DEFINE; }
|
||||||
\$[ \t]*DEFINE { return F90PPR_DEFINE; }
|
\$[ \t]*DEFINE { return F90PPR_DEFINE; }
|
||||||
|
@ -148,23 +143,34 @@ $[ \t]*elif { return F90PPR_ELIF; }
|
||||||
$[ \t]*else { return F90PPR_ELSE; }
|
$[ \t]*else { return F90PPR_ELSE; }
|
||||||
$[ \t]*endif { return F90PPR_ENDIF; }
|
$[ \t]*endif { return F90PPR_ENDIF; }
|
||||||
|
|
||||||
&[ \t]*\n |
|
/* Line continuations, possible involving comments. */
|
||||||
&[ \t]*\n[ \t]*& /* Ignore */
|
&([ \t\n]*|!.*)*
|
||||||
|
&([ \t\n]*|!.*)*&
|
||||||
|
|
||||||
|
<fixed_fmt>\n[ ]{5}[^ ] { return GARBAGE; }
|
||||||
|
|
||||||
[^ \t\n\r;,!'""']+ { yylvalp->string = strdup(yytext); return WORD; }
|
=|=> { return ASSIGNMENT_OP; }
|
||||||
|
|
||||||
|
[a-zA-Z_][a-zA-Z_0-9]* {
|
||||||
|
yylvalp->string = strdup(yytext);
|
||||||
|
return WORD;
|
||||||
|
}
|
||||||
|
|
||||||
|
[^ \t\n\r;,!'"a-zA-Z=&]+ { return GARBAGE; }
|
||||||
|
|
||||||
|
;|\n { return EOSTMT; }
|
||||||
|
|
||||||
;|\n { return EOSTMT; }
|
|
||||||
|
|
||||||
[ \t\r,] /* Ignore */
|
[ \t\r,] /* Ignore */
|
||||||
|
\\[ \t]*\n /* Ignore line-endings preceeded by \ */
|
||||||
|
|
||||||
. { return *yytext; }
|
. { return *yytext; }
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
if(!cmDependsFortranParser_FilePop(yyextra))
|
if(!cmDependsFortranParser_FilePop(yyextra) )
|
||||||
{
|
{
|
||||||
return YY_NULL;
|
return YY_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,20 +23,33 @@
|
||||||
typedef struct cmDependsFortranParser_s cmDependsFortranParser;
|
typedef struct cmDependsFortranParser_s cmDependsFortranParser;
|
||||||
|
|
||||||
/* Functions to enter/exit #include'd files in order. */
|
/* Functions to enter/exit #include'd files in order. */
|
||||||
int cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
|
bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
|
||||||
const char* fname);
|
const char* fname);
|
||||||
int cmDependsFortranParser_FilePop(cmDependsFortranParser* parser);
|
bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser);
|
||||||
|
|
||||||
/* Callbacks for lexer. */
|
/* Callbacks for lexer. */
|
||||||
int cmDependsFortranParser_Input(cmDependsFortranParser* parser,
|
int cmDependsFortranParser_Input(cmDependsFortranParser* parser,
|
||||||
char* buffer, size_t bufferSize);
|
char* buffer, size_t bufferSize);
|
||||||
|
|
||||||
|
|
||||||
void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser);
|
void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser);
|
||||||
const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser);
|
const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser);
|
||||||
void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser,
|
||||||
char c);
|
char c);
|
||||||
|
|
||||||
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
|
||||||
int in);
|
bool is_in);
|
||||||
int cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser);
|
bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser);
|
||||||
|
|
||||||
|
|
||||||
|
void cmDependsFortranParser_SetInPPFalseBranch(cmDependsFortranParser* parser,
|
||||||
|
bool is_in);
|
||||||
|
bool cmDependsFortranParser_GetInPPFalseBranch(cmDependsFortranParser* parser);
|
||||||
|
|
||||||
|
|
||||||
|
void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser,
|
||||||
|
int arg);
|
||||||
|
int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser);
|
||||||
|
|
||||||
/* Callbacks for parser. */
|
/* Callbacks for parser. */
|
||||||
void cmDependsFortranParser_Error(cmDependsFortranParser* parser,
|
void cmDependsFortranParser_Error(cmDependsFortranParser* parser,
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Generate a reentrant parser object. */
|
/* Generate a reentrant parser object. */
|
||||||
%pure_parser
|
%pure-parser
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
char* string;
|
char* string;
|
||||||
|
@ -84,90 +84,128 @@ static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/* Tokens */
|
/* Tokens */
|
||||||
%token USE F_INCLUDE MODULE EOSTMT
|
%token EOSTMT ASSIGNMENT_OP GARBAGE
|
||||||
%token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE
|
%token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE
|
||||||
%token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF
|
%token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF
|
||||||
%token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF
|
%token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF
|
||||||
%token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF
|
%token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF
|
||||||
%token UNTERMINATED_STRING
|
%token <string> CPP_TOENDL
|
||||||
%token <string> CPP_TOENDL STRING WORD
|
%token <number> UNTERMINATED_STRING
|
||||||
|
%token <string> STRING WORD
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/* grammar */
|
/* grammar */
|
||||||
%%
|
%%
|
||||||
|
|
||||||
code: /* empty */ | code stmt ;
|
code: /* empty */ | code stmt;
|
||||||
|
|
||||||
stmt:
|
stmt: keyword_stmt | assignment_stmt;
|
||||||
USE WORD other eostmt
|
|
||||||
|
assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */
|
||||||
|
|
||||||
|
keyword_stmt:
|
||||||
|
WORD EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
if (strcasecmp($1, "interface") == 0)
|
||||||
cmDependsFortranParser_RuleUse(parser, $2);
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_SetInInterface(parser, true);
|
||||||
|
}
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
| WORD WORD other EOSTMT
|
||||||
|
{
|
||||||
|
if (strcasecmp($1, "use") == 0)
|
||||||
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_RuleUse(parser, $2);
|
||||||
|
free($2);
|
||||||
|
}
|
||||||
|
else if (strcasecmp($1, "module") == 0)
|
||||||
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_RuleModule(parser, $2);
|
||||||
|
free($2);
|
||||||
|
}
|
||||||
|
else if (strcasecmp($1, "interface") == 0)
|
||||||
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_SetInInterface(parser, true);
|
||||||
|
free($2);
|
||||||
|
}
|
||||||
|
else if (strcasecmp($2, "interface") == 0 && strcasecmp($1, "end") == 0)
|
||||||
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_SetInInterface(parser, false);
|
||||||
|
free($2);
|
||||||
|
}
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
| WORD STRING other EOSTMT
|
||||||
|
{
|
||||||
|
if (strcasecmp($1, "include") == 0)
|
||||||
|
{
|
||||||
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
|
cmDependsFortranParser_RuleInclude(parser, $2);
|
||||||
|
}
|
||||||
|
free($1);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| include STRING other eostmt
|
| CPP_INCLUDE WORD other EOSTMT /* Ignore */
|
||||||
{
|
| define WORD other EOSTMT
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
|
||||||
cmDependsFortranParser_RuleInclude(parser, $2);
|
|
||||||
free($2);
|
|
||||||
}
|
|
||||||
| CPP_INCLUDE WORD other eostmt /* Ignore */
|
|
||||||
| MODULE WORD eostmt
|
|
||||||
{
|
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
|
||||||
cmDependsFortranParser_RuleModule(parser, $2);
|
|
||||||
free($2);
|
|
||||||
}
|
|
||||||
| define WORD other eostmt
|
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleDefine(parser, $2);
|
cmDependsFortranParser_RuleDefine(parser, $2);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| undef WORD other eostmt
|
| undef WORD other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleUndef(parser, $2);
|
cmDependsFortranParser_RuleUndef(parser, $2);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| ifdef WORD other eostmt
|
| ifdef WORD other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleIfdef(parser, $2);
|
cmDependsFortranParser_RuleIfdef(parser, $2);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| ifndef WORD other eostmt
|
| ifndef WORD other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleIfndef(parser, $2);
|
cmDependsFortranParser_RuleIfndef(parser, $2);
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
| if other eostmt
|
| if other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleIf(parser);
|
cmDependsFortranParser_RuleIf(parser);
|
||||||
}
|
}
|
||||||
| elif other eostmt
|
| elif other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleElif(parser);
|
cmDependsFortranParser_RuleElif(parser);
|
||||||
}
|
}
|
||||||
| else other eostmt
|
| else other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleElse(parser);
|
cmDependsFortranParser_RuleElse(parser);
|
||||||
}
|
}
|
||||||
| endif other eostmt
|
| endif other EOSTMT
|
||||||
{
|
{
|
||||||
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
|
||||||
cmDependsFortranParser_RuleEndif(parser);
|
cmDependsFortranParser_RuleEndif(parser);
|
||||||
}
|
}
|
||||||
| other eostmt /* Ignore */
|
| WORD GARBAGE other EOSTMT /* Ignore */
|
||||||
|
| GARBAGE other EOSTMT
|
||||||
|
| EOSTMT
|
||||||
|
| error
|
||||||
;
|
;
|
||||||
|
|
||||||
eostmt: /* empty */ | EOSTMT ;
|
|
||||||
include: F_INCLUDE | CPP_INCLUDE | F90PPR_INCLUDE | COCO_INCLUDE ;
|
|
||||||
define: CPP_DEFINE | F90PPR_DEFINE ;
|
include: CPP_INCLUDE | F90PPR_INCLUDE | COCO_INCLUDE ;
|
||||||
|
define: CPP_DEFINE | F90PPR_DEFINE;
|
||||||
undef: CPP_UNDEF | F90PPR_UNDEF ;
|
undef: CPP_UNDEF | F90PPR_UNDEF ;
|
||||||
ifdef: CPP_IFDEF | F90PPR_IFDEF ;
|
ifdef: CPP_IFDEF | F90PPR_IFDEF ;
|
||||||
ifndef: CPP_IFNDEF | F90PPR_IFNDEF ;
|
ifndef: CPP_IFNDEF | F90PPR_IFNDEF ;
|
||||||
|
@ -180,6 +218,8 @@ other: /* empty */ | other misc_code ;
|
||||||
misc_code:
|
misc_code:
|
||||||
WORD { free ($1); }
|
WORD { free ($1); }
|
||||||
| STRING { free ($1); }
|
| STRING { free ($1); }
|
||||||
|
| GARBAGE
|
||||||
|
| ASSIGNMENT_OP
|
||||||
| UNTERMINATED_STRING
|
| UNTERMINATED_STRING
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/* A Bison parser, made by GNU Bison 1.875d. */
|
/* A Bison parser, made by GNU Bison 2.3. */
|
||||||
|
|
||||||
/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
|
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||||
1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
|
||||||
|
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,13 +17,21 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
/* As a special exception, when this file is copied by Bison into a
|
/* As a special exception, you may create a larger work that contains
|
||||||
Bison output file, you may use that output file without restriction.
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
This special exception was added by the Free Software Foundation
|
under terms of your choice, so long as that work isn't itself a
|
||||||
in version 1.24 of Bison. */
|
parser generator using the skeleton or a modified version thereof
|
||||||
|
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||||
|
the parser skeleton itself, you may (at your option) remove this
|
||||||
|
special exception, which will cause the skeleton and the resulting
|
||||||
|
Bison output files to be licensed under the GNU General Public
|
||||||
|
License without this special exception.
|
||||||
|
|
||||||
|
This special exception was added by the Free Software Foundation in
|
||||||
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
|
@ -29,79 +39,75 @@
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum yytokentype {
|
||||||
USE = 258,
|
EOSTMT = 258,
|
||||||
F_INCLUDE = 259,
|
ASSIGNMENT_OP = 259,
|
||||||
MODULE = 260,
|
GARBAGE = 260,
|
||||||
EOSTMT = 261,
|
CPP_INCLUDE = 261,
|
||||||
CPP_INCLUDE = 262,
|
F90PPR_INCLUDE = 262,
|
||||||
F90PPR_INCLUDE = 263,
|
COCO_INCLUDE = 263,
|
||||||
COCO_INCLUDE = 264,
|
F90PPR_DEFINE = 264,
|
||||||
F90PPR_DEFINE = 265,
|
CPP_DEFINE = 265,
|
||||||
CPP_DEFINE = 266,
|
F90PPR_UNDEF = 266,
|
||||||
F90PPR_UNDEF = 267,
|
CPP_UNDEF = 267,
|
||||||
CPP_UNDEF = 268,
|
CPP_IFDEF = 268,
|
||||||
CPP_IFDEF = 269,
|
CPP_IFNDEF = 269,
|
||||||
CPP_IFNDEF = 270,
|
CPP_IF = 270,
|
||||||
CPP_IF = 271,
|
CPP_ELSE = 271,
|
||||||
CPP_ELSE = 272,
|
CPP_ELIF = 272,
|
||||||
CPP_ELIF = 273,
|
CPP_ENDIF = 273,
|
||||||
CPP_ENDIF = 274,
|
F90PPR_IFDEF = 274,
|
||||||
F90PPR_IFDEF = 275,
|
F90PPR_IFNDEF = 275,
|
||||||
F90PPR_IFNDEF = 276,
|
F90PPR_IF = 276,
|
||||||
F90PPR_IF = 277,
|
F90PPR_ELSE = 277,
|
||||||
F90PPR_ELSE = 278,
|
F90PPR_ELIF = 278,
|
||||||
F90PPR_ELIF = 279,
|
F90PPR_ENDIF = 279,
|
||||||
F90PPR_ENDIF = 280,
|
CPP_TOENDL = 280,
|
||||||
UNTERMINATED_STRING = 281,
|
UNTERMINATED_STRING = 281,
|
||||||
CPP_TOENDL = 282,
|
STRING = 282,
|
||||||
STRING = 283,
|
WORD = 283
|
||||||
WORD = 284
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#define USE 258
|
/* Tokens. */
|
||||||
#define F_INCLUDE 259
|
#define EOSTMT 258
|
||||||
#define MODULE 260
|
#define ASSIGNMENT_OP 259
|
||||||
#define EOSTMT 261
|
#define GARBAGE 260
|
||||||
#define CPP_INCLUDE 262
|
#define CPP_INCLUDE 261
|
||||||
#define F90PPR_INCLUDE 263
|
#define F90PPR_INCLUDE 262
|
||||||
#define COCO_INCLUDE 264
|
#define COCO_INCLUDE 263
|
||||||
#define F90PPR_DEFINE 265
|
#define F90PPR_DEFINE 264
|
||||||
#define CPP_DEFINE 266
|
#define CPP_DEFINE 265
|
||||||
#define F90PPR_UNDEF 267
|
#define F90PPR_UNDEF 266
|
||||||
#define CPP_UNDEF 268
|
#define CPP_UNDEF 267
|
||||||
#define CPP_IFDEF 269
|
#define CPP_IFDEF 268
|
||||||
#define CPP_IFNDEF 270
|
#define CPP_IFNDEF 269
|
||||||
#define CPP_IF 271
|
#define CPP_IF 270
|
||||||
#define CPP_ELSE 272
|
#define CPP_ELSE 271
|
||||||
#define CPP_ELIF 273
|
#define CPP_ELIF 272
|
||||||
#define CPP_ENDIF 274
|
#define CPP_ENDIF 273
|
||||||
#define F90PPR_IFDEF 275
|
#define F90PPR_IFDEF 274
|
||||||
#define F90PPR_IFNDEF 276
|
#define F90PPR_IFNDEF 275
|
||||||
#define F90PPR_IF 277
|
#define F90PPR_IF 276
|
||||||
#define F90PPR_ELSE 278
|
#define F90PPR_ELSE 277
|
||||||
#define F90PPR_ELIF 279
|
#define F90PPR_ELIF 278
|
||||||
#define F90PPR_ENDIF 280
|
#define F90PPR_ENDIF 279
|
||||||
|
#define CPP_TOENDL 280
|
||||||
#define UNTERMINATED_STRING 281
|
#define UNTERMINATED_STRING 281
|
||||||
#define CPP_TOENDL 282
|
#define STRING 282
|
||||||
#define STRING 283
|
#define WORD 283
|
||||||
#define WORD 284
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
#line 75 "cmDependsFortranParser.y"
|
typedef union YYSTYPE
|
||||||
typedef union YYSTYPE {
|
#line 81 "cmDependsFortranParser.y"
|
||||||
|
{
|
||||||
char* string;
|
char* string;
|
||||||
} YYSTYPE;
|
}
|
||||||
/* Line 1285 of yacc.c. */
|
/* Line 1489 of yacc.c. */
|
||||||
#line 99 "cmDependsFortranParserTokens.h"
|
#line 109 "cmDependsFortranParserTokens.h"
|
||||||
|
YYSTYPE;
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue