Пример #1
0
    def parse(self, code, line_no):
        '''To parse the given code'''

        # remove all comments
        code = code + '\n'
        code = re.sub(r'#.*?\n', '\n', code)

        # if a blank code
        if code.strip() == '':
            return []

        # create the parser
        p = ZestyParser(code)

        # update the starting line number of the code
        p.start_line_no = line_no

        # parse the tuning specifications
        try:
            args = p.scan(p_program)
        except ParseError as e:
            err('orio.module.spmv.parser:  %s' % e)

        # return the arguments
        return args
Пример #2
0
    def parse(self, code, line_no):
        '''To parse the given code'''

        # remove all comments
        code = code + '\n'
        code = re.sub(r'#.*?\n', '\n', code)

        # if a blank code
        if code.strip() == '':
            return []

        # create the parser
        p = ZestyParser(code)

        # update the starting line number of the code
        p.start_line_no = line_no

        # parse the tuning specifications
        try:
            args = p.scan(p_program)
        except ParseError, e:
            err('orio.module.spmv.parser:  %s' % e)
Пример #3
0
    def parse(self, code, line_no):
        '''To parse the given code'''

        # remove all comments
        code = code + '\n'
        code = re.sub(r'#.*?\n', '\n', code)

        # if a blank code
        if code.strip() == '':
            return []

        # create the parser
        p = ZestyParser(code)

        # update the starting line number of the code
        p.start_line_no = line_no

        # parse the tuning specifications
        try:
            assigns = p.scan(p_program)
        except ParseError, e:
            print 'error: %s' % e
            sys.exit(1)