Esempio n. 1
0
 def match_token_seq(self, node, token_seq):
     token_seq = token_seq[::-1]
     gen = find_token_gen(node)
     while token_seq:
         s = token_seq.pop()
         try:
             t = gen.next()
         except StopIteration:
             return False
         if t[1] != s:
             return False
     return True
Esempio n. 2
0
 def match_token_seq(self, node, token_seq):
     token_seq = token_seq[::-1]
     gen = find_token_gen(node)
     while token_seq:
         s = token_seq.pop()
         try:
             t = gen.next()
         except StopIteration:
             return False
         if t[1] != s:
             return False
     return True
Esempio n. 3
0
 def get_line_info_begin(self, node):
     try:
         node_begin = node[1][2]
     except IndexError:
         token = find_token_gen(node)
         nl = 0
         for T in token:
             if len(T)>2:
                 node_begin = T[2]-nl
                 break
             else:
                 nl+=T[1].count("\n")
     return node_begin
Esempio n. 4
0
 def get_line_info_begin(self, node):
     try:
         node_begin = node[1][2]
     except IndexError:
         token = find_token_gen(node)
         nl = 0
         for T in token:
             if len(T) > 2:
                 node_begin = T[2] - nl
                 break
             else:
                 nl += T[1].count("\n")
     return node_begin
Esempio n. 5
0
 def get_line_info(self, node):
     token_gen = find_token_gen(node)
     tok = token_gen.next()
     return (tok[2], tok[3][0])
Esempio n. 6
0
 def get_line_info(self, node):
     token_gen = find_token_gen(node)
     tok = token_gen.next()
     return (tok[2], tok[3][0])