Exemple #1
0
 def __init__(self, lexer):
     self.lexer = lexer
     self.index = 0
     self.head = None
     self.error_token = None
     self.ahead = []
     self.behind = []
     self.bt_marks = []
     self.debug = debug.check('parser')
Exemple #2
0
    def advance(self):
        assert self.uninitialized or self.head is not None, u"can't advance past the end!"

        self.index += 1
        if self.head == u'\n':
            self.line += 1
            self.col = r_uint(0)
        else:
            self.col += 1

        if self.recording:
            self.tape.append(self.head)

        self.head = self.reader.next()

        if debug.check('lexer'):
            print u'advance<%s>' % self.head
Exemple #3
0
    def advance(self):
        assert self.uninitialized or self.head is not None, u"can't advance past the end!"

        self.index += 1
        if self.head == u'\n':
            self.line += 1
            self.col = r_uint(0)
        else:
            self.col += 1

        if self.recording:
            self.tape.append(self.head)

        self.head = self.reader.next()

        if debug.check('lexer'):
            print u'advance<%s>' % self.head