def _maybe_attributes(self):
"""Possibly match some attributes.
The syntax of attributes is described here:
https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
"""
return pyparsing.Group(
pyparsing.ZeroOrMore(
_ATTRIBUTE
+ _DOUBLE_OPEN_PARENTHESIS
+ pyparsing.delimitedList(
pyparsing.Group(
self._identifier()("name")
+ pyparsing.Optional(
_OPEN_PARENTHESIS
+ parsers.anything_beetween("()")("args")
+ _CLOSE_PARENTHESIS
)
)
)
+ _DOUBLE_CLOSE_PARENTHESIS
).setParseAction(self._make_attribute)
)("attributes")
评论列表
文章目录