示例#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')
示例#2
0
文件: lexer.py 项目: neunenak/tulip
    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
示例#3
0
文件: lexer.py 项目: cr1901/tulip
    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