C99 6.10.1 Conditional inclusion
if-stmt is # if constant-expression new-line
or ifdef identifier new-line
or ifndef identifier new-line
Definition at line 150 of file C99Preprocessor.py.
def fparser.two.C99Preprocessor.Cpp_If_Stmt.match |
( |
|
string | ) |
|
|
static |
Implements the matching for an if preprocessor directive
(or its variations ifdef, ifndef). For ifdef and ifndef
statements it matches the macro identifier using
:py:class:`fparser.two.C99Preprocesser.Cpp_Macro_Identifier`
otherwise it uses :py:class:`fparser.two.C99Preprocessor.Cpp_Pp_Tokens`
to accept any non-empty string as rhs.
:param str string: the string to match with as an if statement.
:return: a tuple of size 2 containing the statement's keyword \
and the right hand side, or `None` if there is no match.
:rtype: \
(`str`, py:class:`fparser.two.C99Preprocessor.Cpp_Macro_Identifier`)\
or (`str`, py:class:`fparser.two.C99Preprocessor.Cpp_Pp_Tokens`) \
or `NoneType`
Definition at line 171 of file C99Preprocessor.py.
172 """Implements the matching for an if preprocessor directive 173 (or its variations ifdef, ifndef). For ifdef and ifndef 174 statements it matches the macro identifier using 175 :py:class:`fparser.two.C99Preprocesser.Cpp_Macro_Identifier` 176 otherwise it uses :py:class:`fparser.two.C99Preprocessor.Cpp_Pp_Tokens` 177 to accept any non-empty string as rhs. 179 :param str string: the string to match with as an if statement. 181 :return: a tuple of size 2 containing the statement's keyword \ 182 and the right hand side, or `None` if there is no match. 184 (`str`, py:class:`fparser.two.C99Preprocessor.Cpp_Macro_Identifier`)\ 185 or (`str`, py:class:`fparser.two.C99Preprocessor.Cpp_Pp_Tokens`) \ 191 result = WORDClsBase.match(
192 Cpp_If_Stmt._if_pattern,
198 return result
or WORDClsBase.match(
199 Cpp_If_Stmt._def_pattern,
200 Cpp_Macro_Identifier,