From fb3f3aa2db50e34f8e1881d7472c1acf14d95963 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 21 Jan 2012 21:26:10 +0000 Subject: compiler: Change alias handling, change rune alias to int32. From-SVN: r183374 --- gcc/go/gofrontend/lex.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'gcc/go/gofrontend/lex.h') diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h index 6341e1e..b9b4b1f 100644 --- a/gcc/go/gofrontend/lex.h +++ b/gcc/go/gofrontend/lex.h @@ -70,6 +70,8 @@ class Token TOKEN_STRING, // Token is an operator. TOKEN_OPERATOR, + // Token is a character constant. + TOKEN_CHARACTER, // Token is an integer. TOKEN_INTEGER, // Token is a floating point number. @@ -135,6 +137,16 @@ class Token return tok; } + // Make a character constant token. + static Token + make_character_token(mpz_t val, Location location) + { + Token tok(TOKEN_CHARACTER, location); + mpz_init(tok.u_.integer_value); + mpz_swap(tok.u_.integer_value, val); + return tok; + } + // Make an integer token. static Token make_integer_token(mpz_t val, Location location) @@ -225,6 +237,14 @@ class Token return *this->u_.string_value; } + // Return the value of a character constant. + const mpz_t* + character_value() const + { + go_assert(this->classification_ == TOKEN_CHARACTER); + return &this->u_.integer_value; + } + // Return the value of an integer. const mpz_t* integer_value() const @@ -300,7 +320,7 @@ class Token } identifier_value; // The string value for TOKEN_STRING. std::string* string_value; - // The token value for TOKEN_INTEGER. + // The token value for TOKEN_CHARACTER or TOKEN_INTEGER. mpz_t integer_value; // The token value for TOKEN_FLOAT or TOKEN_IMAGINARY. mpfr_t float_value; -- cgit v1.1