diff options
author | Zack Weinberg <zackw@stanford.edu> | 2001-03-07 01:32:01 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2001-03-07 01:32:01 +0000 |
commit | cc937581390c3aebf39e5f36b61f6b6098b8a236 (patch) | |
tree | 6fd6ae80f761d7e077d853c2bbffc740946a5e0d /gcc/cpplex.c | |
parent | 8b44d68f7b41308b3ea5b66642352c6fc8946093 (diff) | |
download | gcc-cc937581390c3aebf39e5f36b61f6b6098b8a236.tar.gz |
c-parse.in (yylexname): New function, split out of _yylex.
* c-parse.in (yylexname): New function, split out of _yylex.
(objc_rid_sans_at): New table.
(init_reswords): Initialize it.
(_yylex): Give labels clearer names. Handle CPP_ATSIGN by
retrieving the next token and checking it for significance as
an ObjC keyword or string constant.
* cpplex.c (_cpp_lex_token): Just return CPP_ATSIGN for '@'.
* cpplib.h (TTYPE_TABLE): Add CPP_ATSIGN, drop CPP_OSTRING.
* c-lex.c, c-parse.in, cppmacro.c, cpplex.c, cp/spew.c: Remove
references to CPP_OSTRING.
From-SVN: r40279
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 37a0c61e3a3..d1b90764a43 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -1241,29 +1241,8 @@ _cpp_lex_token (pfile, result) case '}': result->type = CPP_CLOSE_BRACE; break; case ';': result->type = CPP_SEMICOLON; break; - case '@': - if (CPP_OPTION (pfile, objc)) - { - /* In Objective C, '@' may begin keywords or strings, like - @keyword or @"string". It would be nice to call - get_effective_char here and test the result. However, we - would then need to pass 2 characters to parse_identifier, - making it ugly and slowing down its main loop. Instead, - we assume we have an identifier, and recover if not. */ - result->type = CPP_NAME; - result->val.node = parse_identifier (pfile, c); - if (result->val.node->length != 1) - break; - - /* OK, so it wasn't an identifier. Maybe a string? */ - if (buffer->read_ahead == '"') - { - c = '"'; - ACCEPT_CHAR (CPP_OSTRING); - goto make_string; - } - } - goto random_char; + /* @ is a punctuator in Objective C. */ + case '@': result->type = CPP_ATSIGN; break; random_char: default: @@ -1341,7 +1320,6 @@ cpp_spell_token (pfile, token, buffer) { case CPP_STRING: left = '"'; right = '"'; tag = '\0'; break; case CPP_WSTRING: left = '"'; right = '"'; tag = 'L'; break; - case CPP_OSTRING: left = '"'; right = '"'; tag = '@'; break; case CPP_CHAR: left = '\''; right = '\''; tag = '\0'; break; case CPP_WCHAR: left = '\''; right = '\''; tag = 'L'; break; case CPP_HEADER_NAME: left = '<'; right = '>'; tag = '\0'; break; @@ -1432,7 +1410,6 @@ cpp_output_token (token, fp) { case CPP_STRING: left = '"'; right = '"'; tag = '\0'; break; case CPP_WSTRING: left = '"'; right = '"'; tag = 'L'; break; - case CPP_OSTRING: left = '"'; right = '"'; tag = '@'; break; case CPP_CHAR: left = '\''; right = '\''; tag = '\0'; break; case CPP_WCHAR: left = '\''; right = '\''; tag = 'L'; break; case CPP_HEADER_NAME: left = '<'; right = '>'; tag = '\0'; break; @@ -1580,13 +1557,6 @@ cpp_can_paste (pfile, token1, token2, digraph) return CPP_NUMBER; break; - case CPP_OTHER: - if (CPP_OPTION (pfile, objc) && token1->val.c == '@') - { - if (b == CPP_NAME) return CPP_NAME; - if (b == CPP_STRING) return CPP_OSTRING; - } - default: break; } |