Last active
May 29, 2016 16:52
-
-
Save mingodad/e9ccc835021f9004ef9d82d178c0f460 to your computer and use it in GitHub Desktop.
GCCGO __FILE__ and __LINE__ builtin constants
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pick up an identifier. | |
Token | |
Lex::gather_identifier() | |
{ | |
... | |
if (has_non_ascii_char) | |
return Token::make_identifier_token(buf, is_exported, location); | |
else | |
{ | |
Keyword code = keywords.keyword_to_code(pstart, p - pstart); | |
if (code == KEYWORD_INVALID) | |
{ | |
buf.assign(pstart, p - pstart); | |
if(buf.size() > 1 && buf[0] == '_') | |
{ | |
if(buf == "__LINE__") | |
{ | |
mpz_t val; | |
mpz_init_set_ui(val, this->lineno_); | |
Token ret = Token::make_integer_token(val, location); | |
mpz_clear(val); | |
return ret; | |
} | |
else if(buf == "__FILE__") | |
{ | |
buf = this->input_file_name_; | |
return Token::make_string_token(buf, location); | |
} | |
} | |
return Token::make_identifier_token(buf, | |
is_exported, location); | |
} | |
else | |
{ | |
switch (code) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment