aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/lex.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-01-21 21:26:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-01-21 21:26:10 +0000
commitfb3f3aa2db50e34f8e1881d7472c1acf14d95963 (patch)
tree028f071b465ab278a66ee501a5ee1ae92b8b4234 /gcc/go/gofrontend/lex.h
parent4787ac51eb9b79b3cd27f0366a86df5440eaeee6 (diff)
downloadgcc-fb3f3aa2db50e34f8e1881d7472c1acf14d95963.zip
gcc-fb3f3aa2db50e34f8e1881d7472c1acf14d95963.tar.gz
gcc-fb3f3aa2db50e34f8e1881d7472c1acf14d95963.tar.bz2
compiler: Change alias handling, change rune alias to int32.
From-SVN: r183374
Diffstat (limited to 'gcc/go/gofrontend/lex.h')
-rw-r--r--gcc/go/gofrontend/lex.h22
1 files changed, 21 insertions, 1 deletions
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;