Add label summary times to ctest default output. Also, remove parallel time output...
[cmake.git] / Source / cmDependsFortranParser.y
blob51b155f4d556ef301e6b2e5558085829b5fc19ab
1 %{
2 /*=========================================================================
4 Program: CMake - Cross-Platform Makefile Generator
5 Module: $RCSfile: cmDependsFortranParser.y,v $
6 Language: C++
7 Date: $Date: 2009-06-12 14:46:25 $
8 Version: $Revision: 1.22 $
10 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
11 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
18 /*-------------------------------------------------------------------------
19 Portions of this source have been derived from makedepf90 version 2.8.8,
21 Copyright (C) 2000--2006 Erik Edelmann <erik.edelmann@iki.fi>
23 The code was originally distributed under the GPL but permission
24 from the copyright holder has been obtained to distribute this
25 derived work under the CMake license.
26 -------------------------------------------------------------------------*/
30 This file must be translated to C and modified to build everywhere.
32 Run bison like this:
34 bison --yacc --name-prefix=cmDependsFortran_yy
35 --defines=cmDependsFortranParserTokens.h
36 -ocmDependsFortranParser.cxx
37 cmDependsFortranParser.y
39 Modify cmDependsFortranParser.cxx:
40 - remove TABs
41 - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
44 /*-------------------------------------------------------------------------*/
45 #define cmDependsFortranParser_cxx
46 #include "cmDependsFortranParser.h" /* Interface to parser object. */
47 #include "cmDependsFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */
49 #include <cmsys/String.h>
51 /* Configure the parser to use a lexer object. */
52 #define YYPARSE_PARAM yyscanner
53 #define YYLEX_PARAM yyscanner
54 #define YYERROR_VERBOSE 1
55 #define cmDependsFortran_yyerror(x) \
56 cmDependsFortranError(yyscanner, x)
58 /* Forward declare the lexer entry point. */
59 YY_DECL;
61 /* Helper function to forward error callback. */
62 static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
64 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
65 cmDependsFortranParser_Error(parser, message);
68 static bool cmDependsFortranParserIsKeyword(const char* word,
69 const char* keyword)
71 return cmsysString_strcasecmp(word, keyword) == 0;
74 /* Disable some warnings in the generated code. */
75 #ifdef __BORLANDC__
76 # pragma warn -8004 /* Variable assigned a value that is not used. */
77 # pragma warn -8008 /* condition always returns true */
78 # pragma warn -8060 /* possibly incorrect assignment */
79 # pragma warn -8066 /* unreachable code */
80 #endif
81 #ifdef _MSC_VER
82 # pragma warning (disable: 4102) /* Unused goto label. */
83 # pragma warning (disable: 4065) /* Switch contains default but no case. */
84 # pragma warning (disable: 4701) /* Local variable may not be initialized. */
85 # pragma warning (disable: 4702) /* Unreachable code. */
86 # pragma warning (disable: 4127) /* Conditional expression is constant. */
87 # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
88 #endif
91 /* Generate a reentrant parser object. */
92 %pure-parser
94 %union {
95 char* string;
98 /*-------------------------------------------------------------------------*/
99 /* Tokens */
100 %token EOSTMT ASSIGNMENT_OP GARBAGE
101 %token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE
102 %token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF
103 %token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF
104 %token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF
105 %token F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF
106 %token COMMA DCOLON
107 %token <string> CPP_TOENDL
108 %token <number> UNTERMINATED_STRING
109 %token <string> STRING WORD
111 /*-------------------------------------------------------------------------*/
112 /* grammar */
115 code: /* empty */ | code stmt;
117 stmt: keyword_stmt | assignment_stmt;
119 assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */
121 free($1);
124 keyword_stmt:
125 WORD EOSTMT
127 if (cmDependsFortranParserIsKeyword($1, "interface"))
129 cmDependsFortranParser* parser =
130 cmDependsFortran_yyget_extra(yyscanner);
131 cmDependsFortranParser_SetInInterface(parser, true);
133 free($1);
135 | WORD WORD other EOSTMT
137 if (cmDependsFortranParserIsKeyword($1, "use"))
139 cmDependsFortranParser* parser =
140 cmDependsFortran_yyget_extra(yyscanner);
141 cmDependsFortranParser_RuleUse(parser, $2);
143 else if (cmDependsFortranParserIsKeyword($1, "module"))
145 cmDependsFortranParser* parser =
146 cmDependsFortran_yyget_extra(yyscanner);
147 cmDependsFortranParser_RuleModule(parser, $2);
149 else if (cmDependsFortranParserIsKeyword($1, "interface"))
151 cmDependsFortranParser* parser =
152 cmDependsFortran_yyget_extra(yyscanner);
153 cmDependsFortranParser_SetInInterface(parser, true);
155 else if (cmDependsFortranParserIsKeyword($2, "interface") &&
156 cmDependsFortranParserIsKeyword($1, "end"))
158 cmDependsFortranParser* parser =
159 cmDependsFortran_yyget_extra(yyscanner);
160 cmDependsFortranParser_SetInInterface(parser, false);
162 free($1);
163 free($2);
165 | WORD DCOLON WORD other EOSTMT
167 if (cmDependsFortranParserIsKeyword($1, "use"))
169 cmDependsFortranParser* parser =
170 cmDependsFortran_yyget_extra(yyscanner);
171 cmDependsFortranParser_RuleUse(parser, $3);
173 free($1);
174 free($3);
176 | WORD COMMA WORD DCOLON WORD other EOSTMT
178 if (cmDependsFortranParserIsKeyword($1, "use") &&
179 cmDependsFortranParserIsKeyword($3, "non_intrinsic") )
181 cmDependsFortranParser* parser =
182 cmDependsFortran_yyget_extra(yyscanner);
183 cmDependsFortranParser_RuleUse(parser, $5);
185 free($1);
186 free($3);
187 free($5);
189 | WORD STRING other EOSTMT /* Ignore */
191 if (cmDependsFortranParserIsKeyword($1, "include"))
193 cmDependsFortranParser* parser =
194 cmDependsFortran_yyget_extra(yyscanner);
195 cmDependsFortranParser_RuleInclude(parser, $2);
197 free($1);
198 free($2);
200 | include STRING other EOSTMT
202 cmDependsFortranParser* parser =
203 cmDependsFortran_yyget_extra(yyscanner);
204 cmDependsFortranParser_RuleInclude(parser, $2);
205 free($2);
207 | define WORD other EOSTMT
209 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
210 cmDependsFortranParser_RuleDefine(parser, $2);
211 free($2);
213 | undef WORD other EOSTMT
215 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
216 cmDependsFortranParser_RuleUndef(parser, $2);
217 free($2);
219 | ifdef WORD other EOSTMT
221 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
222 cmDependsFortranParser_RuleIfdef(parser, $2);
223 free($2);
225 | ifndef WORD other EOSTMT
227 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
228 cmDependsFortranParser_RuleIfndef(parser, $2);
229 free($2);
231 | if other EOSTMT
233 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
234 cmDependsFortranParser_RuleIf(parser);
236 | elif other EOSTMT
238 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
239 cmDependsFortranParser_RuleElif(parser);
241 | else other EOSTMT
243 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
244 cmDependsFortranParser_RuleElse(parser);
246 | endif other EOSTMT
248 cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
249 cmDependsFortranParser_RuleEndif(parser);
251 | WORD GARBAGE other EOSTMT /* Ignore */
253 free($1);
255 | GARBAGE other EOSTMT
256 | EOSTMT
257 | error
262 include: CPP_INCLUDE | F90PPR_INCLUDE | COCO_INCLUDE ;
263 define: CPP_DEFINE | F90PPR_DEFINE;
264 undef: CPP_UNDEF | F90PPR_UNDEF ;
265 ifdef: CPP_IFDEF | F90PPR_IFDEF ;
266 ifndef: CPP_IFNDEF | F90PPR_IFNDEF ;
267 if: CPP_IF | F90PPR_IF ;
268 elif: CPP_ELIF | F90PPR_ELIF ;
269 else: CPP_ELSE | F90PPR_ELSE ;
270 endif: CPP_ENDIF | F90PPR_ENDIF ;
271 other: /* empty */ | other misc_code ;
273 misc_code:
274 WORD { free ($1); }
275 | STRING { free ($1); }
276 | GARBAGE
277 | ASSIGNMENT_OP
278 | DCOLON
279 | COMMA
280 | UNTERMINATED_STRING
284 /* End of grammar */