Beispiel #1
0
Token
Parser::match(Token_kind k)
{
  if (lookahead() == k)
    return ts_.get();

  String msg = format("expected '{}' but got '{}'",
                      get_spelling(k),
                      token_spelling(ts_));
  error(ts_.location(), msg);
  throw Parse_error("match");
}
Beispiel #2
0
static void
print_variable(Printer& p, T const* d, char const* kind)
{
  print(p, "@{}", d->name());
  print(p, " = ");
  if (d->linkage() != unspecified_linkage) {
    print(p, get_spelling(d->linkage()));
    print_space(p);
  }
  print(p, kind);
  print_space(p);
  print(p, d->type());
  print_space(p);
  print(p, d->initializer());
}
Beispiel #3
0
void 
print(Printer& p, Binary_op op)
{
  print(p, get_spelling(op));
}