How to use the pycparserext.ext_c_parser._AsmAndAttributesMixin function in pycparserext

To help you get started, we’ve selected a few pycparserext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inducer / pycparserext / pycparserext / ext_c_parser.py View on Github external
"""
        p[0] = p[1]

    def p_attribute_const(self, p):
        """ attribute : __CONST
        """
        p[0] = c_ast.ID(name="__const", coord=self._coord(p.lineno(1)))

    def p_struct_declaration_list_1(self, p):
        """ struct_declaration_list : empty """
        p[0] = None

# }}}


class OpenCLCParser(_AsmAndAttributesMixin, CParserBase):
    from pycparserext.ext_c_lexer import OpenCLCLexer as lexer_class  # noqa

    INT_BIT_COUNTS = [8, 16, 32, 64]
    initial_type_symbols = (
            set([
                "%s%d" % (base_name, count)
                for base_name in [
                    'char', 'uchar', 'short', 'ushort', 'int', 'uint',
                    'long', 'ulong', 'float', 'double', 'half']
                for count in [2, 3, 4, 8, 16]
                ])
            | set([
                "intptr_t", "uintptr_t",
                "intmax_t", "uintmax_t",
                "size_t", "ptrdiff_t",
                "uint", "ulong", "ushort", "uchar",
github inducer / pycparserext / pycparserext / ext_c_parser.py View on Github external
func = FuncDeclExt(
            args=p[3],
            type=None,
            attributes=p[6],
            asm=p[5],
            coord=p[1].coord)

        p[0] = self._type_modify_decl(decl=p[1], modifier=func)

    # }}}
# }}}


# {{{ gnu parser

class GnuCParser(_AsmAndAttributesMixin, CParserBase):
    # TODO: __extension__

    from pycparserext.ext_c_lexer import GnuCLexer as lexer_class  # noqa

    initial_type_symbols = set(["__builtin_va_list"])

    def p_function_specifier_gnu(self, p):
        """ function_specifier  : __INLINE
                                | __INLINE__
        """
        p[0] = p[1]

    def p_type_qualifier_gnu(self, p):
        """ type_qualifier  : __CONST
                            | __RESTRICT
                            | __EXTENSION__