Example #1
0
 def _typeof_expression(self):
     keyword = (
         pyparsing.Keyword('typeof')
         | pyparsing.Keyword('__typeof__')
     )
     return pyparsing.Combine(
         keyword
         + pyparsing.Literal('(')
         + parsers.anything_beetween('()')
         + pyparsing.Literal(')')
     )
Example #2
0
    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")
Example #3
0
    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")
Example #4
0
 def _typeof_expression(self):
     keyword = (pyparsing.Keyword('typeof')
                | pyparsing.Keyword('__typeof__'))
     return pyparsing.Combine(keyword + pyparsing.Literal('(') +
                              parsers.anything_beetween('()') +
                              pyparsing.Literal(')'))