aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-lex.c')
-rw-r--r--gcc/c-family/c-lex.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index 9c86ba7..125407b 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -1263,3 +1263,29 @@ lex_charconst (const cpp_token *token)
return value;
}
+
+/* Helper function for c_parser_peek_conflict_marker
+ and cp_lexer_peek_conflict_marker.
+ Given a possible conflict marker token of kind TOK1_KIND
+ consisting of a pair of characters, get the token kind for the
+ standalone final character. */
+
+enum cpp_ttype
+conflict_marker_get_final_tok_kind (enum cpp_ttype tok1_kind)
+{
+ switch (tok1_kind)
+ {
+ default: gcc_unreachable ();
+ case CPP_LSHIFT:
+ /* "<<" and '<' */
+ return CPP_LESS;
+
+ case CPP_EQ_EQ:
+ /* "==" and '=' */
+ return CPP_EQ;
+
+ case CPP_RSHIFT:
+ /* ">>" and '>' */
+ return CPP_GREATER;
+ }
+}