Beispiel #1
0
def tok_to_builtin_type(tok: scanner.Token) -> ast.BuiltinType:
  assert tok.is_keyword_in(scanner.TYPE_KEYWORDS)
  bt = getattr(ast.BuiltinType, tok.value.value.upper())
  assert isinstance(bt, ast.BuiltinType), repr(bt)
  return bt
Beispiel #2
0
 def __init__(self, span: Span, tok: Token):
   super().__init__(span)
   assert isinstance(tok, Token), tok
   assert tok.is_keyword_in(TYPE_KEYWORDS), tok
   self.tok = tok