35#define isident(c) (isalnum(c) || (c) == '_')
36#define isBlank(c) (bool) (c == ' ' || c == '\t')
37#define isType(token,t) (bool) ((token)->type == (t))
38#define isKeyword(token,k) (bool) ((token)->keyword == (k))
39#define isSecondaryKeyword(token,k) (bool) ((token)->secondary == NULL ? \
40 false : (token)->secondary->keyword == (k))
212 {
true,
'b',
"blockData",
"block data"},
213 {
true,
'c',
"common",
"common blocks"},
214 {
true,
'e',
"entry",
"entry points"},
215 {
true,
'f',
"function",
"functions"},
216 {
true,
'i',
"interface",
"interface contents, generic names, and operators"},
217 {
true,
'k',
"component",
"type and structure components"},
218 {
true,
'l',
"label",
"labels"},
219 {
false,
'L',
"local",
"local, common block, and namelist variables"},
220 {
true,
'm',
"module",
"modules"},
221 {
true,
'n',
"namelist",
"namelists"},
222 {
true,
'p',
"program",
"programs"},
223 {
true,
's',
"subroutine",
"subroutines"},
224 {
true,
't',
"type",
"derived types and structures"},
225 {
true,
'v',
"variable",
"program (global) and module variables"},
226 {
true,
'E',
"enum",
"enumerations"},
227 {
true,
'N',
"enumerator",
"enumeration values"},
341 enum { incrementalIncrease = 10 };
393#define ancestorCount() (Ancestors.count)
410 for (i = 0 ; i <
Ancestors.count && !result ; ++i)
430 token->secondary =
NULL;
442 token->secondary =
NULL;
462 token->secondary =
NULL;
524 while (c != EOF && c !=
'\n');
559 if (column == 0 && strchr (
"*Cc!#$Dd", c) !=
NULL)
566 else if (column == 5)
574 if (c ==
' ' || c ==
'0')
593 else if (isdigit (c))
611 bool newline =
false;
617#ifdef STRICT_FIXED_FORM
710 bool advanceLine =
false;
717 if (! inComment && c ==
'&')
721 while (isspace (c) && c !=
'\n');
735 else if (
NewLine && (c ==
'!' || c ==
'#'))
741 if (c ==
'!' || (
NewLine && c ==
'#'))
789 else if (! isdigit (c))
791 while (c != EOF && isdigit (c))
801 while (c != EOF && isalpha (c));
824 if (tolower (c) ==
'e')
843 while (c != delimiter && c !=
'\n' && c != EOF)
848 if (c ==
'\n' || c == EOF)
850 verbose (
"%s: unterminated character string at line %lu\n",
885 for (length = 0 ; isdigit (c) && length < 5 ; ++length)
895 if (length > 0 && token !=
NULL)
938 token->secondary->
keyword = kw;
953 token->secondary =
NULL;
965 case ' ':
goto getNextChar;
966 case '\t':
goto getNextChar;
982 const char *
const operatorChars =
"*/+=<>";
986 }
while (strchr (operatorChars, c) !=
NULL);
997 while (c !=
'\n' && c != EOF);
1050 else if (isdigit (c))
1065 if (token->secondary ==
NULL)
1108 else if (
isType (token, topen))
1110 else if (
isType (token, tclose))
1113 }
while (level > 0);
1264 bool result =
false;
1343 switch (parent->tag)
1874 bool result =
false;
1988 default: result =
false;
break;
2000 bool result =
false;
2121 bool result =
false;
2289 verbose (
"%s: not fixed source form; retry as free source form\n",
2317 static const char *
const extensions [] = {
2318 "f90",
"f95",
"f03",
2319#ifndef CASE_INSENSITIVE_FILENAMES
2320 "F90",
"F95",
"F03",
2337 static const char *
const extensions [] = {
2338 "f",
"for",
"ftn",
"f77",
2339#ifndef CASE_INSENSITIVE_FILENAMES
2340 "F",
"FOR",
"FTN",
"F77",
int makeTagEntry(const tagEntryInfo *const tag)
void initTagEntry(tagEntryInfo *const e, const char *const name, int kindIndex)
enum eException exception_t
static void parseMap(tokenInfo *const token)
static void parseEntityDeclList(tokenInfo *const token)
static void readIdentifier(tokenInfo *const token, const int c)
static bool insideInterface(void)
static void parseProgramUnit(tokenInfo *const token)
static kindDefinition FortranKinds[TAG_COUNT]
static void makeFortranTag(tokenInfo *const token, tagType tag)
static void parseDerivedTypeDef(tokenInfo *const token)
struct sTokenInfo tokenInfo
static int getFixedFormChar(void)
static int getFreeFormChar(bool inComment)
static void ungetChar(const int c)
static const keywordTable FortranKeywordTable[]
static tokenInfo * newToken(void)
static tokenInfo * newTokenFrom(tokenInfo *const token)
static int skipToNextLine(void)
static tokenInfo * newAnonTokenFrom(tokenInfo *const token, const char *type)
static void parseSubprogram(tokenInfo *const token, const tagType tag)
static void parseFieldDefinition(tokenInfo *const token)
parserDefinition * F77Parser(void)
static vString * parseInteger(int c)
#define isSecondaryKeyword(token, k)
static const tokenInfo * ancestorScope(void)
static keywordId analyzeToken(vString *const name, langType language)
static void parseTypeSpec(tokenInfo *const token)
static void parseStructureStmt(tokenInfo *const token)
static bool parseSpecificationPart(tokenInfo *const token)
static void parseComponentDefStmt(tokenInfo *const token)
static bool isFileScope(const tagType type)
static void checkForLabel(void)
static bool parseExecutionPart(tokenInfo *const token)
static bool skipStatementIfKeyword(tokenInfo *const token, keywordId keyword)
static unsigned int Column
static void skipPast(tokenInfo *const token, tokenType type)
static void parseCommonNamelistStmt(tokenInfo *const token, tagType type)
static struct @23 Ancestors
static void readSubToken(tokenInfo *const token)
static unsigned int contextual_fake_count
static void initializeF77(const langType language)
static void deleteToken(tokenInfo *const token)
static bool parseStmtFunctionStmt(tokenInfo *const token)
static bool isIgnoredDeclaration(tokenInfo *const token)
static void parseInterfaceBlock(tokenInfo *const token)
enum eTokenType tokenType
static bool includeTag(const tagType type)
static void parseBlockData(tokenInfo *const token)
static bool isTypeSpec(tokenInfo *const token)
static void ancestorPop(void)
static lineType getLineType(void)
static bool isSubprogramPrefix(tokenInfo *const token)
static rescanReason findFortranTags(const unsigned int passCount)
static void parseString(vString *const string, const int delimiter)
static void parseKindSelector(tokenInfo *const token)
static void skipOverParens(tokenInfo *const token)
static void parseUnionStmt(tokenInfo *const token)
static bool parseImplicitPartStmt(tokenInfo *const token)
static void parseModule(tokenInfo *const token)
static void parseIdentifier(vString *const string, const int firstChar)
parserDefinition * FortranParser(void)
static void skipToToken(tokenInfo *const token, tokenType type)
static void parseEntityDecl(tokenInfo *const token)
static void ancestorPush(tokenInfo *const token)
static int skipLine(void)
#define isKeyword(token, k)
static tokenInfo * Parent
static void parseQualifierSpecList(tokenInfo *const token)
static void makeLabelTag(vString *const label)
enum eFortranLineType lineType
static langType Lang_fortran
static void parseSubroutineSubprogram(tokenInfo *const token)
static bool FreeSourceForm
static void skipOverPair(tokenInfo *const token, tokenType topen, tokenType tclose)
static const tokenInfo * ancestorTop(void)
static void ancestorClear(void)
static void parseEntryStmt(tokenInfo *const token)
static void initializeFortran(const langType language)
static void parseInternalSubprogramPart(tokenInfo *const token)
static void skipToNextStatement(tokenInfo *const token)
static void parseFunctionSubprogram(tokenInfo *const token)
static void parseMainProgram(tokenInfo *const token)
static void parseEnumBlock(tokenInfo *const token)
enum eException exception_t
static void skipOverSquares(tokenInfo *const token)
static bool parseSpecificationStmt(tokenInfo *const token)
static bool parseDeclarationConstruct(tokenInfo *const token)
static bool ParsingString
static tagType variableTagType(void)
static vString * parseNumeric(int c)
static void readToken(tokenInfo *const token)
static void parseTypeDeclarationStmt(tokenInfo *const token)
int lookupKeyword(const char *const string, langType language)
bool canUseLineNumberAsLocator(void)
void verbose(const char *const format,...)
parserDefinition * parserNew(const char *name)
unsigned long getInputLineNumber(void)
int getcFromInputFile(void)
MIOPos getInputFilePosition(void)
const char * getInputFileName(void)
void ungetcToInputFile(int c)
void eFree(void *const ptr)
#define xRealloc(p, n, Type)
parserInitialize initialize
const char *const * extensions
const keywordTable * keywordTable
kindDefinition * kindTable
unsigned int keywordCount
struct sTagEntryInfo::@3 extensionFields
unsigned int lineNumberEntry
unsigned int truncateLineAfterTag
struct sTokenInfo * secondary
vString * vStringNew(void)
vString * vStringNewCopy(const vString *const string)
void vStringDelete(vString *const string)
void vStringCatS(vString *const string, const char *const s)
vString * vStringNewInit(const char *const s)
void vStringCopyToLower(vString *const dest, const vString *const src)
void vStringCat(vString *const string, const vString *const s)
void vStringCopy(vString *const string, const vString *const s)
#define vStringClear(string)
#define vStringLength(vs)
static void vStringPut(vString *const string, const int c)
bool isXtagEnabled(xtagType type)