Logo Search packages:      
Sourcecode: yapps2 version File versions  Download package

def yapps::runtime::Scanner::scan (   self,
  type,
  kw 
)

Returns the matched text, and moves to the next token

Definition at line 338 of file runtime.py.

00338                                 :
            """Returns the matched text, and moves to the next token"""
            context = kw.get("context",None)

            if self.last_token is None:
                  tok = self.token([type],context)
            else:
                  if self.last_types and type not in self.last_types:
                        raise NotImplementedError("Unimplemented: restriction set changed")

                  tok = self.last_token
                  self.last_token = None
            if tok.type != type:
                  if not self.last_types: self.last_types=[]
                  raise SyntaxError(tok.pos, 'Trying to find '+type+': '+ ', '.join(self.last_types)+", got "+tok.type, context=context)
            return tok.value

class Parser(object):


Generated by  Doxygen 1.6.0   Back to index