Rename Fortran parser infrastructure to drop "Depends" prefix

The parser can be re-used outside cmDependsFortran or the cmDepends
class hierarchy so drop the "Depends" from its name:

 rename 's/DependsFortran([A-Za-z0-9_])/Fortran$1/' Source/*.*
 sed -i 's/DependsFortran\([A-Za-z0-9_]\)/Fortran\1/g' Source/*.*
 sed -i 's/FortranInternals/DependsFortranInternals/g' Source/*.*

Also manually fix Source/CMakeLists.txt source file ordering.
This commit is contained in:
Kitware Robot 2015-07-22 13:21:45 -04:00 committed by Brad King
parent 096dd3c963
commit 98b9645bce
11 changed files with 633 additions and 632 deletions

View File

@ -88,7 +88,7 @@ option(CMAKE_REGENERATE_YACCLEX
"Regenerate YACC and LEXX files" OFF)
mark_as_advanced(CMAKE_REGENERATE_YACCLEX)
if(CMAKE_REGENERATE_YACCLEX)
set(parsersLexers cmDependsFortran cmCommandArgument cmExpr)
set(parsersLexers cmFortran cmCommandArgument cmExpr)
find_program(YACC_EXECUTABLE
NAMES yacc bison
PATHS /usr/bin
@ -193,9 +193,6 @@ set(SRCS
cmDependsC.h
cmDependsFortran.cxx
cmDependsFortran.h
cmDependsFortranLexer.cxx
cmDependsFortranParser.cxx
cmDependsFortranParser.h
cmDependsJava.cxx
cmDependsJava.h
cmDependsJavaLexer.cxx
@ -243,6 +240,10 @@ set(SRCS
cmFileLockResult.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
cmFortranLexer.cxx
cmFortranLexer.h
cmFortranParser.cxx
cmFortranParser.h
cmGeneratedFileStream.cxx
cmGeneratorExpressionContext.cxx
cmGeneratorExpressionContext.h

View File

@ -16,7 +16,7 @@
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmDependsFortranParser.h" /* Interface to parser object. */
#include "cmFortranParser.h" /* Interface to parser object. */
#include <cmsys/FStream.hxx>
#include <assert.h>
#include <stack>
@ -27,7 +27,7 @@
//----------------------------------------------------------------------------
// Information about a single source file.
class cmDependsFortranSourceInfo
class cmFortranSourceInfo
{
public:
// The name of the source file.
@ -45,16 +45,16 @@ public:
// Parser methods not included in generated interface.
// Get the current buffer processed by the lexer.
YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner);
YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner);
// The parser entry point.
int cmDependsFortran_yyparse(yyscan_t);
int cmFortran_yyparse(yyscan_t);
//----------------------------------------------------------------------------
// Define parser object internal structure.
struct cmDependsFortranFile
struct cmFortranFile
{
cmDependsFortranFile(FILE* file, YY_BUFFER_STATE buffer,
cmFortranFile(FILE* file, YY_BUFFER_STATE buffer,
const std::string& dir):
File(file), Buffer(buffer), Directory(dir) {}
FILE* File;
@ -62,12 +62,12 @@ struct cmDependsFortranFile
std::string Directory;
};
struct cmDependsFortranParser_s
struct cmFortranParser_s
{
cmDependsFortranParser_s(cmDependsFortran* self,
cmFortranParser_s(cmDependsFortran* self,
std::set<std::string>& ppDefines,
cmDependsFortranSourceInfo& info);
~cmDependsFortranParser_s();
cmFortranSourceInfo& info);
~cmFortranParser_s();
// Pointer back to the main class.
cmDependsFortran* Self;
@ -76,7 +76,7 @@ struct cmDependsFortranParser_s
yyscan_t Scanner;
// Stack of open files in the translation unit.
std::stack<cmDependsFortranFile> FileStack;
std::stack<cmFortranFile> FileStack;
// Buffer for string literals.
std::string TokenString;
@ -90,7 +90,7 @@ struct cmDependsFortranParser_s
std::stack<bool> SkipToEnd;
// Information about the parsed source.
cmDependsFortranSourceInfo& Info;
cmFortranSourceInfo& Info;
};
//----------------------------------------------------------------------------
@ -105,18 +105,18 @@ public:
TargetRequiresMap TargetRequires;
// Information about each object file.
typedef std::map<std::string, cmDependsFortranSourceInfo> ObjectInfoMap;
typedef std::map<std::string, cmFortranSourceInfo> ObjectInfoMap;
ObjectInfoMap ObjectInfo;
cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj,
cmFortranSourceInfo& CreateObjectInfo(const char* obj,
const char* src)
{
std::map<std::string, cmDependsFortranSourceInfo>::iterator i =
std::map<std::string, cmFortranSourceInfo>::iterator i =
this->ObjectInfo.find(obj);
if(i == this->ObjectInfo.end())
{
std::map<std::string, cmDependsFortranSourceInfo>::value_type
entry(obj, cmDependsFortranSourceInfo());
std::map<std::string, cmFortranSourceInfo>::value_type
entry(obj, cmFortranSourceInfo());
i = this->ObjectInfo.insert(entry).first;
i->second.Source = src;
}
@ -192,7 +192,7 @@ bool cmDependsFortran::WriteDependencies(
{
const std::string& src = *it;
// Get the information object for this source.
cmDependsFortranSourceInfo& info =
cmFortranSourceInfo& info =
this->Internal->CreateObjectInfo(obj.c_str(), src.c_str());
// Make a copy of the macros defined via ADD_DEFINITIONS
@ -201,13 +201,13 @@ bool cmDependsFortran::WriteDependencies(
// Create the parser object. The constructor takes ppMacro and info per
// reference, so we may look into the resulting objects later.
cmDependsFortranParser parser(this, ppDefines, info);
cmFortranParser parser(this, ppDefines, info);
// Push on the starting file.
cmDependsFortranParser_FilePush(&parser, src.c_str());
cmFortranParser_FilePush(&parser, src.c_str());
// Parse the translation unit.
if(cmDependsFortran_yyparse(parser.Scanner) != 0)
if(cmFortran_yyparse(parser.Scanner) != 0)
{
// Failed to parse the file. Report failure to write dependencies.
okay = false;
@ -318,7 +318,7 @@ void cmDependsFortran::LocateModules()
for(ObjectInfoMap::const_iterator infoI = objInfo.begin();
infoI != objInfo.end(); ++infoI)
{
cmDependsFortranSourceInfo const& info = infoI->second;
cmFortranSourceInfo const& info = infoI->second;
// Include this module in the set provided by this target.
this->Internal->TargetProvides.insert(info.Provides.begin(),
info.Provides.end());
@ -428,7 +428,7 @@ void cmDependsFortran::ConsiderModule(const char* name,
bool
cmDependsFortran
::WriteDependenciesReal(const char *obj,
cmDependsFortranSourceInfo const& info,
cmFortranSourceInfo const& info,
const char* mod_dir, const char* stamp_dir,
std::ostream& makeDepends,
std::ostream& internalDepends)
@ -701,7 +701,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
// is later used for longer sequences it should be re-written using an
// efficient string search algorithm such as Boyer-Moore.
static
bool cmDependsFortranStreamContainsSequence(std::istream& ifs,
bool cmFortranStreamContainsSequence(std::istream& ifs,
const char* seq, int len)
{
assert(len > 0);
@ -734,7 +734,7 @@ bool cmDependsFortranStreamContainsSequence(std::istream& ifs,
//----------------------------------------------------------------------------
// Helper function to compare the remaining content in two streams.
static bool cmDependsFortranStreamsDiffer(std::istream& ifs1,
static bool cmFortranStreamsDiffer(std::istream& ifs1,
std::istream& ifs2)
{
// Compare the remaining content.
@ -837,7 +837,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
const char seq[1] = {'\n'};
const int seqlen = 1;
if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen))
{
// The module is of unexpected format. Assume it is different.
std::cerr << compilerId << " fortran module " << modFile
@ -845,7 +845,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
return true;
}
if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen))
{
// The stamp must differ if the sequence is not contained.
return true;
@ -857,7 +857,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
const char seq[2] = {'\n', '\0'};
const int seqlen = 2;
if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
if(!cmFortranStreamContainsSequence(finModFile, seq, seqlen))
{
// The module is of unexpected format. Assume it is different.
std::cerr << compilerId << " fortran module " << modFile
@ -865,7 +865,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
return true;
}
if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
if(!cmFortranStreamContainsSequence(finStampFile, seq, seqlen))
{
// The stamp must differ if the sequence is not contained.
return true;
@ -875,7 +875,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// Compare the remaining content. If no compiler id matched above,
// including the case none was given, this will compare the whole
// content.
if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile))
if(!cmFortranStreamsDiffer(finModFile, finStampFile))
{
return false;
}
@ -926,34 +926,34 @@ bool cmDependsFortran::FindIncludeFile(const char* dir,
}
//----------------------------------------------------------------------------
cmDependsFortranParser_s
::cmDependsFortranParser_s(cmDependsFortran* self,
cmFortranParser_s
::cmFortranParser_s(cmDependsFortran* self,
std::set<std::string>& ppDefines,
cmDependsFortranSourceInfo& info):
cmFortranSourceInfo& info):
Self(self), PPDefinitions(ppDefines), Info(info)
{
this->InInterface = 0;
this->InPPFalseBranch = 0;
// Initialize the lexical scanner.
cmDependsFortran_yylex_init(&this->Scanner);
cmDependsFortran_yyset_extra(this, this->Scanner);
cmFortran_yylex_init(&this->Scanner);
cmFortran_yyset_extra(this, this->Scanner);
// Create a dummy buffer that is never read but is the fallback
// buffer when the last file is popped off the stack.
YY_BUFFER_STATE buffer =
cmDependsFortran_yy_create_buffer(0, 4, this->Scanner);
cmDependsFortran_yy_switch_to_buffer(buffer, this->Scanner);
cmFortran_yy_create_buffer(0, 4, this->Scanner);
cmFortran_yy_switch_to_buffer(buffer, this->Scanner);
}
//----------------------------------------------------------------------------
cmDependsFortranParser_s::~cmDependsFortranParser_s()
cmFortranParser_s::~cmFortranParser_s()
{
cmDependsFortran_yylex_destroy(this->Scanner);
cmFortran_yylex_destroy(this->Scanner);
}
//----------------------------------------------------------------------------
bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
bool cmFortranParser_FilePush(cmFortranParser* parser,
const char* fname)
{
// Open the new file and push it onto the stack. Save the old
@ -961,12 +961,12 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb"))
{
YY_BUFFER_STATE current =
cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner);
cmFortranLexer_GetCurrentBuffer(parser->Scanner);
std::string dir = cmSystemTools::GetParentDirectory(fname);
cmDependsFortranFile f(file, current, dir);
cmFortranFile f(file, current, dir);
YY_BUFFER_STATE buffer =
cmDependsFortran_yy_create_buffer(0, 16384, parser->Scanner);
cmDependsFortran_yy_switch_to_buffer(buffer, parser->Scanner);
cmFortran_yy_create_buffer(0, 16384, parser->Scanner);
cmFortran_yy_switch_to_buffer(buffer, parser->Scanner);
parser->FileStack.push(f);
return 1;
}
@ -977,7 +977,7 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser)
bool cmFortranParser_FilePop(cmFortranParser* parser)
{
// Pop one file off the stack and close it. Switch the lexer back
// to the next one on the stack.
@ -987,18 +987,18 @@ bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser)
}
else
{
cmDependsFortranFile f = parser->FileStack.top(); parser->FileStack.pop();
cmFortranFile f = parser->FileStack.top(); parser->FileStack.pop();
fclose(f.File);
YY_BUFFER_STATE current =
cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner);
cmDependsFortran_yy_delete_buffer(current, parser->Scanner);
cmDependsFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner);
cmFortranLexer_GetCurrentBuffer(parser->Scanner);
cmFortran_yy_delete_buffer(current, parser->Scanner);
cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner);
return 1;
}
}
//----------------------------------------------------------------------------
int cmDependsFortranParser_Input(cmDependsFortranParser* parser,
int cmFortranParser_Input(cmFortranParser* parser,
char* buffer, size_t bufferSize)
{
// Read from the file on top of the stack. If the stack is empty,
@ -1012,26 +1012,26 @@ int cmDependsFortranParser_Input(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser)
void cmFortranParser_StringStart(cmFortranParser* parser)
{
parser->TokenString = "";
}
//----------------------------------------------------------------------------
const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser)
const char* cmFortranParser_StringEnd(cmFortranParser* parser)
{
return parser->TokenString.c_str();
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser,
void cmFortranParser_StringAppend(cmFortranParser* parser,
char c)
{
parser->TokenString += c;
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
void cmFortranParser_SetInInterface(cmFortranParser* parser,
bool in)
{
if(parser->InPPFalseBranch)
@ -1043,26 +1043,26 @@ void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
bool cmDependsFortranParser_GetInInterface(cmDependsFortranParser* parser)
bool cmFortranParser_GetInInterface(cmFortranParser* parser)
{
return parser->InInterface;
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_SetOldStartcond(cmDependsFortranParser* parser,
void cmFortranParser_SetOldStartcond(cmFortranParser* parser,
int arg)
{
parser->OldStartcond = arg;
}
//----------------------------------------------------------------------------
int cmDependsFortranParser_GetOldStartcond(cmDependsFortranParser* parser)
int cmFortranParser_GetOldStartcond(cmFortranParser* parser)
{
return parser->OldStartcond;
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*)
void cmFortranParser_Error(cmFortranParser*, const char*)
{
// If there is a parser error just ignore it. The source will not
// compile and the user will edit it. Then dependencies will have
@ -1070,7 +1070,7 @@ void cmDependsFortranParser_Error(cmDependsFortranParser*, const char*)
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser,
void cmFortranParser_RuleUse(cmFortranParser* parser,
const char* name)
{
if(!parser->InPPFalseBranch)
@ -1080,7 +1080,7 @@ void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser,
void cmFortranParser_RuleInclude(cmFortranParser* parser,
const char* name)
{
if(parser->InPPFalseBranch)
@ -1106,12 +1106,12 @@ void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser,
parser->Info.Includes.insert(fullName);
// Parse it immediately to translate the source inline.
cmDependsFortranParser_FilePush(parser, fullName.c_str());
cmFortranParser_FilePush(parser, fullName.c_str());
}
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser,
void cmFortranParser_RuleModule(cmFortranParser* parser,
const char* name)
{
if(!parser->InPPFalseBranch && !parser->InInterface)
@ -1121,7 +1121,7 @@ void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser,
void cmFortranParser_RuleDefine(cmFortranParser* parser,
const char* macro)
{
if(!parser->InPPFalseBranch)
@ -1131,7 +1131,7 @@ void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser,
void cmFortranParser_RuleUndef(cmFortranParser* parser,
const char* macro)
{
if(!parser->InPPFalseBranch)
@ -1146,7 +1146,7 @@ void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser,
void cmFortranParser_RuleIfdef(cmFortranParser* parser,
const char* macro)
{
// A new PP branch has been opened
@ -1167,7 +1167,7 @@ void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser,
void cmFortranParser_RuleIfndef(cmFortranParser* parser,
const char* macro)
{
// A new PP branch has been opened
@ -1189,7 +1189,7 @@ void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser,
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser)
void cmFortranParser_RuleIf(cmFortranParser* parser)
{
/* Note: The current parser is _not_ able to get statements like
* #if 0
@ -1223,10 +1223,10 @@ void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser)
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser)
void cmFortranParser_RuleElif(cmFortranParser* parser)
{
/* Note: There are parser limitations. See the note at
* cmDependsFortranParser_RuleIf(..)
* cmFortranParser_RuleIf(..)
*/
// Always taken unless an #ifdef or #ifndef-branch has been taken
@ -1240,7 +1240,7 @@ void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser)
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser)
void cmFortranParser_RuleElse(cmFortranParser* parser)
{
// if the parent branch is false do nothing!
if(parser->InPPFalseBranch > 1)
@ -1262,7 +1262,7 @@ void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser)
}
//----------------------------------------------------------------------------
void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser)
void cmFortranParser_RuleEndif(cmFortranParser* parser)
{
if(!parser->SkipToEnd.empty())
{

View File

@ -9,13 +9,13 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmDependsFortran_h
#define cmDependsFortran_h
#ifndef cmFortran_h
#define cmFortran_h
#include "cmDepends.h"
class cmDependsFortranInternals;
class cmDependsFortranSourceInfo;
class cmFortranSourceInfo;
/** \class cmDependsFortran
* \brief Dependency scanner for Fortran object files.
@ -71,7 +71,7 @@ protected:
// Actually write the depenencies to the streams.
bool WriteDependenciesReal(const char *obj,
cmDependsFortranSourceInfo const& info,
cmFortranSourceInfo const& info,
const char* mod_dir, const char* stamp_dir,
std::ostream& makeDepends,
std::ostream& internalDepends);

View File

@ -1,96 +0,0 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmDependsFortranParser_h
#define cmDependsFortranParser_h
#include <stddef.h> /* size_t */
/* Forward declare parser object type. */
typedef struct cmDependsFortranParser_s cmDependsFortranParser;
/* Functions to enter/exit #include'd files in order. */
bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
const char* fname);
bool cmDependsFortranParser_FilePop(cmDependsFortranParser* parser);
/* Callbacks for lexer. */
int cmDependsFortranParser_Input(cmDependsFortranParser* parser,
char* buffer, size_t bufferSize);
void cmDependsFortranParser_StringStart(cmDependsFortranParser* parser);
const char* cmDependsFortranParser_StringEnd(cmDependsFortranParser* parser);
void cmDependsFortranParser_StringAppend(cmDependsFortranParser* parser,
char c);
void cmDependsFortranParser_SetInInterface(cmDependsFortranParser* parser,
bool is_in);
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. */
void cmDependsFortranParser_Error(cmDependsFortranParser* parser,
const char* message);
void cmDependsFortranParser_RuleUse(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleInclude(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleModule(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleDefine(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleUndef(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleIfdef(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleIfndef(cmDependsFortranParser* parser,
const char* name);
void cmDependsFortranParser_RuleIf(cmDependsFortranParser* parser);
void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser);
void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser);
void cmDependsFortranParser_RuleEndif(cmDependsFortranParser* parser);
/* Define the parser stack element type. */
typedef union cmDependsFortran_yystype_u cmDependsFortran_yystype;
union cmDependsFortran_yystype_u
{
char* string;
};
/* Setup the proper yylex interface. */
#define YY_EXTRA_TYPE cmDependsFortranParser*
#define YY_DECL \
int cmDependsFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
#define YYSTYPE cmDependsFortran_yystype
#define YYSTYPE_IS_DECLARED 1
#if !defined(cmDependsFortranLexer_cxx)
# include "cmDependsFortranLexer.h"
#endif
#if !defined(cmDependsFortranLexer_cxx)
#if !defined(cmDependsFortranParser_cxx)
# undef YY_EXTRA_TYPE
# undef YY_DECL
# undef YYSTYPE
# undef YYSTYPE_IS_DECLARED
#endif
#endif
#endif

View File

@ -9,9 +9,9 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmDependsFortran_yyHEADER_H
#define cmDependsFortran_yyHEADER_H 1
#define cmDependsFortran_yyIN_HEADER 1
#ifndef cmFortran_yyHEADER_H
#define cmFortran_yyHEADER_H 1
#define cmFortran_yyIN_HEADER 1
#define YY_INT_ALIGNED short int
@ -211,25 +211,25 @@ struct yy_buffer_state
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
void cmDependsFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner );
void cmDependsFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
void cmDependsFortran_yy_delete_buffer (YY_BUFFER_STATE b ,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 cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner );
void cmFortran_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
void cmFortran_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
void cmFortran_yypop_buffer_state (yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
YY_BUFFER_STATE cmDependsFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
void *cmDependsFortran_yyalloc (yy_size_t ,yyscan_t yyscanner );
void *cmDependsFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner );
void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner );
void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
void cmFortran_yyfree (void * ,yyscan_t yyscanner );
/* Begin user sect3 */
#define cmDependsFortran_yywrap(n) 1
#define cmFortran_yywrap(n) 1
#define YY_SKIP_YYWRAP
#define yytext_ptr yytext_r
@ -247,38 +247,38 @@ void cmDependsFortran_yyfree (void * ,yyscan_t yyscanner );
#define YY_EXTRA_TYPE void *
#endif
int cmDependsFortran_yylex_init (yyscan_t* scanner);
int cmFortran_yylex_init (yyscan_t* scanner);
int cmDependsFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
int cmFortran_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int cmDependsFortran_yylex_destroy (yyscan_t yyscanner );
int cmFortran_yylex_destroy (yyscan_t yyscanner );
int cmDependsFortran_yyget_debug (yyscan_t yyscanner );
int cmFortran_yyget_debug (yyscan_t yyscanner );
void cmDependsFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner );
void cmFortran_yyset_debug (int debug_flag ,yyscan_t yyscanner );
YY_EXTRA_TYPE cmDependsFortran_yyget_extra (yyscan_t yyscanner );
YY_EXTRA_TYPE cmFortran_yyget_extra (yyscan_t yyscanner );
void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
FILE *cmDependsFortran_yyget_in (yyscan_t yyscanner );
FILE *cmFortran_yyget_in (yyscan_t yyscanner );
void cmDependsFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner );
void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner );
FILE *cmDependsFortran_yyget_out (yyscan_t yyscanner );
FILE *cmFortran_yyget_out (yyscan_t yyscanner );
void cmDependsFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner );
void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner );
int cmDependsFortran_yyget_leng (yyscan_t yyscanner );
int cmFortran_yyget_leng (yyscan_t yyscanner );
char *cmDependsFortran_yyget_text (yyscan_t yyscanner );
char *cmFortran_yyget_text (yyscan_t yyscanner );
int cmDependsFortran_yyget_lineno (yyscan_t yyscanner );
int cmFortran_yyget_lineno (yyscan_t yyscanner );
void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner );
void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -286,9 +286,9 @@ void cmDependsFortran_yyset_lineno (int line_number ,yyscan_t yyscanner );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int cmDependsFortran_yywrap (yyscan_t yyscanner );
extern "C" int cmFortran_yywrap (yyscan_t yyscanner );
#else
extern int cmDependsFortran_yywrap (yyscan_t yyscanner );
extern int cmFortran_yywrap (yyscan_t yyscanner );
#endif
#endif
@ -325,9 +325,9 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
extern int cmDependsFortran_yylex (yyscan_t yyscanner);
extern int cmFortran_yylex (yyscan_t yyscanner);
#define YY_DECL int cmDependsFortran_yylex (yyscan_t yyscanner)
#define YY_DECL int cmFortran_yylex (yyscan_t yyscanner)
#endif /* !YY_DECL */
/* yy_get_previous_state - get the state just before the EOB char was reached */
@ -344,5 +344,5 @@ extern int cmDependsFortran_yylex (yyscan_t yyscanner);
#undef YY_DECL
#endif
#undef cmDependsFortran_yyIN_HEADER
#endif /* cmDependsFortran_yyHEADER_H */
#undef cmFortran_yyIN_HEADER
#endif /* cmFortran_yyHEADER_H */

View File

@ -26,18 +26,18 @@ This file must be translated to C and modified to build everywhere.
Run flex like this:
flex -i --prefix=cmDependsFortran_yy --header-file=cmDependsFortranLexer.h -ocmDependsFortranLexer.cxx cmDependsFortranLexer.in.l
flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l
Modify cmDependsFortranLexer.cxx:
Modify cmFortranLexer.cxx:
- remove TABs
- remove use of the 'register' storage class specifier
- remove "yyscanner" argument from these methods:
yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree
- remove "yyscanner = NULL" from end of cmDependsFortran_yylex_destroy
yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree
- remove "yyscanner = NULL" from end of cmFortran_yylex_destroy
- remove all YY_BREAK lines occurring right after return statements
- change while ( 1 ) to for(;;)
Modify cmDependsFortranLexer.h:
Modify cmFortranLexer.h:
- remove TABs
- remove the yy_init_globals function
- remove the block that includes unistd.h
@ -47,16 +47,16 @@ Modify cmDependsFortranLexer.h:
#include "cmStandardLexer.h"
#define cmDependsFortranLexer_cxx
#include "cmDependsFortranParser.h" /* Interface to parser object. */
#define cmFortranLexer_cxx
#include "cmFortranParser.h" /* Interface to parser object. */
/* Replace the lexer input function. */
#undef YY_INPUT
#define YY_INPUT(buf, result, max_size) \
{ result = cmDependsFortranParser_Input(yyextra, buf, max_size); }
{ result = cmFortranParser_Input(yyextra, buf, max_size); }
/* Include the set of tokens from the parser. */
#include "cmDependsFortranParserTokens.h"
#include "cmFortranParserTokens.h"
/*--------------------------------------------------------------------------*/
%}
@ -72,21 +72,21 @@ Modify cmDependsFortranLexer.h:
%%
\" {
cmDependsFortranParser_StringStart(yyextra);
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
cmFortranParser_StringStart(yyextra);
cmFortranParser_SetOldStartcond(yyextra, YY_START);
BEGIN(str_dq);
}
' {
cmDependsFortranParser_StringStart(yyextra);
cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
cmFortranParser_StringStart(yyextra);
cmFortranParser_SetOldStartcond(yyextra, YY_START);
BEGIN(str_sq);
}
<str_dq>\" |
<str_sq>' {
BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) );
yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra));
BEGIN(cmFortranParser_GetOldStartcond(yyextra) );
yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra));
return STRING;
}
@ -94,7 +94,7 @@ Modify cmDependsFortranLexer.h:
<str_dq,str_sq>&[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */
<fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] {
if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
; /* Ignore (cont. strings, fixed fmt) */
else
{
@ -110,7 +110,7 @@ Modify cmDependsFortranLexer.h:
}
<str_sq,str_dq>. {
cmDependsFortranParser_StringAppend(yyextra, yytext[0]);
cmFortranParser_StringAppend(yyextra, yytext[0]);
}
!.*\n { return EOSTMT; } /* Treat comments like */
@ -173,7 +173,7 @@ $[ \t]*endif { return F90PPR_ENDIF; }
. { return *yytext; }
<<EOF>> {
if(!cmDependsFortranParser_FilePop(yyextra) )
if(!cmFortranParser_FilePop(yyextra) )
{
return YY_NULL;
}
@ -182,7 +182,7 @@ $[ \t]*endif { return F90PPR_ENDIF; }
%%
/*--------------------------------------------------------------------------*/
YY_BUFFER_STATE cmDependsFortranLexer_GetCurrentBuffer(yyscan_t yyscanner)
YY_BUFFER_STATE cmFortranLexer_GetCurrentBuffer(yyscan_t yyscanner)
{
/* Hack into the internal flex-generated scanner to get the buffer. */
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;

View File

@ -62,19 +62,19 @@
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse cmDependsFortran_yyparse
#define yylex cmDependsFortran_yylex
#define yyerror cmDependsFortran_yyerror
#define yylval cmDependsFortran_yylval
#define yychar cmDependsFortran_yychar
#define yydebug cmDependsFortran_yydebug
#define yynerrs cmDependsFortran_yynerrs
#define yyparse cmFortran_yyparse
#define yylex cmFortran_yylex
#define yyerror cmFortran_yyerror
#define yylval cmFortran_yylval
#define yychar cmFortran_yychar
#define yydebug cmFortran_yydebug
#define yynerrs cmFortran_yynerrs
/* Copy the first part of user declarations. */
/* Line 268 of yacc.c */
#line 1 "cmDependsFortranParser.y"
#line 1 "cmFortranParser.y"
/*============================================================================
CMake - Cross Platform Makefile Generator
@ -103,20 +103,20 @@ This file must be translated to C and modified to build everywhere.
Run bison like this:
bison --yacc --name-prefix=cmDependsFortran_yy
--defines=cmDependsFortranParserTokens.h
-ocmDependsFortranParser.cxx
cmDependsFortranParser.y
bison --yacc --name-prefix=cmFortran_yy
--defines=cmFortranParserTokens.h
-ocmFortranParser.cxx
cmFortranParser.y
Modify cmDependsFortranParser.cxx:
Modify cmFortranParser.cxx:
- remove TABs
- Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
*/
/*-------------------------------------------------------------------------*/
#define cmDependsFortranParser_cxx
#include "cmDependsFortranParser.h" /* Interface to parser object. */
#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */
#define cmFortranParser_cxx
#include "cmFortranParser.h" /* Interface to parser object. */
#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */
#include <cmsys/String.h>
@ -124,20 +124,20 @@ Modify cmDependsFortranParser.cxx:
#define YYPARSE_PARAM yyscanner
#define YYLEX_PARAM yyscanner
#define YYERROR_VERBOSE 1
#define cmDependsFortran_yyerror(x) \
cmDependsFortranError(yyscanner, x)
#define cmFortran_yyerror(x) \
cmFortranError(yyscanner, x)
/* Forward declare the lexer entry point. */
YY_DECL;
/* Helper function to forward error callback. */
static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
static void cmFortranError(yyscan_t yyscanner, const char* message)
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_Error(parser, message);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_Error(parser, message);
}
static bool cmDependsFortranParserIsKeyword(const char* word,
static bool cmFortranParserIsKeyword(const char* word,
const char* keyword)
{
return cmsysString_strcasecmp(word, keyword) == 0;
@ -155,7 +155,7 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
/* Line 268 of yacc.c */
#line 165 "cmDependsFortranParser.cxx"
#line 165 "cmFortranParser.cxx"
/* Enabling traces. */
#ifndef YYDEBUG
@ -252,14 +252,14 @@ typedef union YYSTYPE
{
/* Line 293 of yacc.c */
#line 89 "cmDependsFortranParser.y"
#line 89 "cmFortranParser.y"
char* string;
/* Line 293 of yacc.c */
#line 269 "cmDependsFortranParser.cxx"
#line 269 "cmFortranParser.cxx"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -271,7 +271,7 @@ typedef union YYSTYPE
/* Line 343 of yacc.c */
#line 281 "cmDependsFortranParser.cxx"
#line 281 "cmFortranParser.cxx"
#ifdef short
# undef short
@ -1610,7 +1610,7 @@ yyreduce:
case 6:
/* Line 1806 of yacc.c */
#line 116 "cmDependsFortranParser.y"
#line 116 "cmFortranParser.y"
{
free((yyvsp[(1) - (4)].string));
}
@ -1619,13 +1619,13 @@ yyreduce:
case 7:
/* Line 1806 of yacc.c */
#line 122 "cmDependsFortranParser.y"
#line 122 "cmFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface"))
if (cmFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
free((yyvsp[(1) - (2)].string));
}
@ -1634,32 +1634,32 @@ yyreduce:
case 8:
/* Line 1806 of yacc.c */
#line 132 "cmDependsFortranParser.y"
#line 132 "cmFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use"))
if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string));
}
else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module"))
else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string));
}
else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface"))
else if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") &&
cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end"))
else if (cmFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") &&
cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, false);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
free((yyvsp[(1) - (4)].string));
free((yyvsp[(2) - (4)].string));
@ -1669,13 +1669,13 @@ yyreduce:
case 9:
/* Line 1806 of yacc.c */
#line 162 "cmDependsFortranParser.y"
#line 162 "cmFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use"))
if (cmFortranParserIsKeyword((yyvsp[(1) - (5)].string), "use"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[(3) - (5)].string));
}
free((yyvsp[(1) - (5)].string));
free((yyvsp[(3) - (5)].string));
@ -1685,14 +1685,14 @@ yyreduce:
case 10:
/* Line 1806 of yacc.c */
#line 173 "cmDependsFortranParser.y"
#line 173 "cmFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") &&
cmDependsFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") )
if (cmFortranParserIsKeyword((yyvsp[(1) - (7)].string), "use") &&
cmFortranParserIsKeyword((yyvsp[(3) - (7)].string), "non_intrinsic") )
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[(5) - (7)].string));
}
free((yyvsp[(1) - (7)].string));
free((yyvsp[(3) - (7)].string));
@ -1703,13 +1703,13 @@ yyreduce:
case 11:
/* Line 1806 of yacc.c */
#line 186 "cmDependsFortranParser.y"
#line 186 "cmFortranParser.y"
{
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
if (cmFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
}
free((yyvsp[(1) - (4)].string));
free((yyvsp[(2) - (4)].string));
@ -1719,11 +1719,11 @@ yyreduce:
case 12:
/* Line 1806 of yacc.c */
#line 197 "cmDependsFortranParser.y"
#line 197 "cmFortranParser.y"
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[(1) - (3)].string));
free((yyvsp[(1) - (3)].string));
}
break;
@ -1731,11 +1731,11 @@ yyreduce:
case 13:
/* Line 1806 of yacc.c */
#line 204 "cmDependsFortranParser.y"
#line 204 "cmFortranParser.y"
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
}
break;
@ -1743,10 +1743,10 @@ yyreduce:
case 14:
/* Line 1806 of yacc.c */
#line 211 "cmDependsFortranParser.y"
#line 211 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
}
break;
@ -1754,10 +1754,10 @@ yyreduce:
case 15:
/* Line 1806 of yacc.c */
#line 217 "cmDependsFortranParser.y"
#line 217 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
}
break;
@ -1765,10 +1765,10 @@ yyreduce:
case 16:
/* Line 1806 of yacc.c */
#line 223 "cmDependsFortranParser.y"
#line 223 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
}
break;
@ -1776,10 +1776,10 @@ yyreduce:
case 17:
/* Line 1806 of yacc.c */
#line 229 "cmDependsFortranParser.y"
#line 229 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string));
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
}
break;
@ -1787,47 +1787,47 @@ yyreduce:
case 18:
/* Line 1806 of yacc.c */
#line 235 "cmDependsFortranParser.y"
#line 235 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIf(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIf(parser);
}
break;
case 19:
/* Line 1806 of yacc.c */
#line 240 "cmDependsFortranParser.y"
#line 240 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElif(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElif(parser);
}
break;
case 20:
/* Line 1806 of yacc.c */
#line 245 "cmDependsFortranParser.y"
#line 245 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElse(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElse(parser);
}
break;
case 21:
/* Line 1806 of yacc.c */
#line 250 "cmDependsFortranParser.y"
#line 250 "cmFortranParser.y"
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleEndif(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser);
}
break;
case 22:
/* Line 1806 of yacc.c */
#line 255 "cmDependsFortranParser.y"
#line 255 "cmFortranParser.y"
{
free((yyvsp[(1) - (4)].string));
}
@ -1836,21 +1836,21 @@ yyreduce:
case 47:
/* Line 1806 of yacc.c */
#line 277 "cmDependsFortranParser.y"
#line 277 "cmFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); }
break;
case 48:
/* Line 1806 of yacc.c */
#line 278 "cmDependsFortranParser.y"
#line 278 "cmFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); }
break;
/* Line 1806 of yacc.c */
#line 1860 "cmDependsFortranParser.cxx"
#line 1860 "cmFortranParser.cxx"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -2083,6 +2083,6 @@ yyreturn:
/* Line 2067 of yacc.c */
#line 286 "cmDependsFortranParser.y"
#line 286 "cmFortranParser.y"
/* End of grammar */

96
Source/cmFortranParser.h Normal file
View File

@ -0,0 +1,96 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmFortranParser_h
#define cmFortranParser_h
#include <stddef.h> /* size_t */
/* Forward declare parser object type. */
typedef struct cmFortranParser_s cmFortranParser;
/* Functions to enter/exit #include'd files in order. */
bool cmFortranParser_FilePush(cmFortranParser* parser,
const char* fname);
bool cmFortranParser_FilePop(cmFortranParser* parser);
/* Callbacks for lexer. */
int cmFortranParser_Input(cmFortranParser* parser,
char* buffer, size_t bufferSize);
void cmFortranParser_StringStart(cmFortranParser* parser);
const char* cmFortranParser_StringEnd(cmFortranParser* parser);
void cmFortranParser_StringAppend(cmFortranParser* parser,
char c);
void cmFortranParser_SetInInterface(cmFortranParser* parser,
bool is_in);
bool cmFortranParser_GetInInterface(cmFortranParser* parser);
void cmFortranParser_SetInPPFalseBranch(cmFortranParser* parser,
bool is_in);
bool cmFortranParser_GetInPPFalseBranch(cmFortranParser* parser);
void cmFortranParser_SetOldStartcond(cmFortranParser* parser,
int arg);
int cmFortranParser_GetOldStartcond(cmFortranParser* parser);
/* Callbacks for parser. */
void cmFortranParser_Error(cmFortranParser* parser,
const char* message);
void cmFortranParser_RuleUse(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleInclude(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleModule(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleDefine(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleUndef(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleIfdef(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleIfndef(cmFortranParser* parser,
const char* name);
void cmFortranParser_RuleIf(cmFortranParser* parser);
void cmFortranParser_RuleElif(cmFortranParser* parser);
void cmFortranParser_RuleElse(cmFortranParser* parser);
void cmFortranParser_RuleEndif(cmFortranParser* parser);
/* Define the parser stack element type. */
typedef union cmFortran_yystype_u cmFortran_yystype;
union cmFortran_yystype_u
{
char* string;
};
/* Setup the proper yylex interface. */
#define YY_EXTRA_TYPE cmFortranParser*
#define YY_DECL \
int cmFortran_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
#define YYSTYPE cmFortran_yystype
#define YYSTYPE_IS_DECLARED 1
#if !defined(cmFortranLexer_cxx)
# include "cmFortranLexer.h"
#endif
#if !defined(cmFortranLexer_cxx)
#if !defined(cmFortranParser_cxx)
# undef YY_EXTRA_TYPE
# undef YY_DECL
# undef YYSTYPE
# undef YYSTYPE_IS_DECLARED
#endif
#endif
#endif

View File

@ -26,21 +26,21 @@ This file must be translated to C and modified to build everywhere.
Run bison like this:
bison --yacc --name-prefix=cmDependsFortran_yy
--defines=cmDependsFortranParserTokens.h
-ocmDependsFortranParser.cxx
cmDependsFortranParser.y
bison --yacc --name-prefix=cmFortran_yy
--defines=cmFortranParserTokens.h
-ocmFortranParser.cxx
cmFortranParser.y
Modify cmDependsFortranParser.cxx:
Modify cmFortranParser.cxx:
- remove TABs
- remove use of the 'register' storage class specifier
- Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
*/
/*-------------------------------------------------------------------------*/
#define cmDependsFortranParser_cxx
#include "cmDependsFortranParser.h" /* Interface to parser object. */
#include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */
#define cmFortranParser_cxx
#include "cmFortranParser.h" /* Interface to parser object. */
#include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */
#include <cmsys/String.h>
@ -48,20 +48,20 @@ Modify cmDependsFortranParser.cxx:
#define YYPARSE_PARAM yyscanner
#define YYLEX_PARAM yyscanner
#define YYERROR_VERBOSE 1
#define cmDependsFortran_yyerror(x) \
cmDependsFortranError(yyscanner, x)
#define cmFortran_yyerror(x) \
cmFortranError(yyscanner, x)
/* Forward declare the lexer entry point. */
YY_DECL;
/* Helper function to forward error callback. */
static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
static void cmFortranError(yyscan_t yyscanner, const char* message)
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_Error(parser, message);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_Error(parser, message);
}
static bool cmDependsFortranParserIsKeyword(const char* word,
static bool cmFortranParserIsKeyword(const char* word,
const char* keyword)
{
return cmsysString_strcasecmp(word, keyword) == 0;
@ -115,63 +115,63 @@ assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */
keyword_stmt:
WORD EOSTMT
{
if (cmDependsFortranParserIsKeyword($1, "interface"))
if (cmFortranParserIsKeyword($1, "interface"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
free($1);
}
| WORD WORD other EOSTMT
{
if (cmDependsFortranParserIsKeyword($1, "use"))
if (cmFortranParserIsKeyword($1, "use"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, $2);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, $2);
}
else if (cmDependsFortranParserIsKeyword($1, "module"))
else if (cmFortranParserIsKeyword($1, "module"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleModule(parser, $2);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleModule(parser, $2);
}
else if (cmDependsFortranParserIsKeyword($1, "interface"))
else if (cmFortranParserIsKeyword($1, "interface"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
}
else if (cmDependsFortranParserIsKeyword($2, "interface") &&
cmDependsFortranParserIsKeyword($1, "end"))
else if (cmFortranParserIsKeyword($2, "interface") &&
cmFortranParserIsKeyword($1, "end"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, false);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
free($1);
free($2);
}
| WORD DCOLON WORD other EOSTMT
{
if (cmDependsFortranParserIsKeyword($1, "use"))
if (cmFortranParserIsKeyword($1, "use"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, $3);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, $3);
}
free($1);
free($3);
}
| WORD COMMA WORD DCOLON WORD other EOSTMT
{
if (cmDependsFortranParserIsKeyword($1, "use") &&
cmDependsFortranParserIsKeyword($3, "non_intrinsic") )
if (cmFortranParserIsKeyword($1, "use") &&
cmFortranParserIsKeyword($3, "non_intrinsic") )
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, $5);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, $5);
}
free($1);
free($3);
@ -179,72 +179,72 @@ keyword_stmt:
}
| WORD STRING other EOSTMT /* Ignore */
{
if (cmDependsFortranParserIsKeyword($1, "include"))
if (cmFortranParserIsKeyword($1, "include"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $2);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, $2);
}
free($1);
free($2);
}
| CPP_INCLUDE_ANGLE other EOSTMT
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $1);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, $1);
free($1);
}
| include STRING other EOSTMT
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $2);
cmFortranParser* parser =
cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, $2);
free($2);
}
| define WORD other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleDefine(parser, $2);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleDefine(parser, $2);
free($2);
}
| undef WORD other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUndef(parser, $2);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUndef(parser, $2);
free($2);
}
| ifdef WORD other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfdef(parser, $2);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfdef(parser, $2);
free($2);
}
| ifndef WORD other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfndef(parser, $2);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfndef(parser, $2);
free($2);
}
| if other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIf(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIf(parser);
}
| elif other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElif(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElif(parser);
}
| else other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElse(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElse(parser);
}
| endif other EOSTMT
{
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleEndif(parser);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser);
}
| WORD GARBAGE other EOSTMT /* Ignore */
{

View File

@ -107,14 +107,14 @@ typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 89 "cmDependsFortranParser.y"
#line 89 "cmFortranParser.y"
char* string;
/* Line 2068 of yacc.c */
#line 118 "cmDependsFortranParserTokens.h"
#line 118 "cmFortranParserTokens.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */