mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
Support digraphs and alternate operator names in CPPParser
This commit is contained in:
parent
9c3553b3fc
commit
202008c470
@ -824,6 +824,8 @@ internal_get_next_token() {
|
||||
}
|
||||
if (next_c == '<') return CPPToken(LSHIFT, first_line, first_col, first_file);
|
||||
if (next_c == '=') return CPPToken(LECOMPARE, first_line, first_col, first_file);
|
||||
if (next_c == ':') return CPPToken('[', first_line, first_col, first_file);
|
||||
if (next_c == '%') return CPPToken('{', first_line, first_col, first_file);
|
||||
break;
|
||||
|
||||
case '>':
|
||||
@ -867,6 +869,7 @@ internal_get_next_token() {
|
||||
|
||||
case ':':
|
||||
if (next_c == ':') return CPPToken(SCOPE, first_line, first_col, first_file);
|
||||
if (next_c == '>') return CPPToken(']', first_line, first_col, first_file);
|
||||
break;
|
||||
|
||||
case '*':
|
||||
@ -879,6 +882,7 @@ internal_get_next_token() {
|
||||
|
||||
case '%':
|
||||
if (next_c == '=') return CPPToken(MODEQUAL, first_line, first_col, first_file);
|
||||
if (next_c == '>') return CPPToken('}', first_line, first_col, first_file);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1411,7 +1415,7 @@ handle_include_directive(const string &args, int first_line,
|
||||
found_file = true;
|
||||
source = CPPFile::S_local;
|
||||
}
|
||||
|
||||
|
||||
// Search the same directory as the includer.
|
||||
if (!angle_quotes && !found_file) {
|
||||
Filename match(get_file()._filename.get_dirname(), filename);
|
||||
@ -1439,7 +1443,7 @@ handle_include_directive(const string &args, int first_line,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!found_file) {
|
||||
warning("Cannot find " + filename.get_fullpath(),
|
||||
first_line, first_col, first_file);
|
||||
@ -2058,6 +2062,19 @@ check_keyword(const string &name) {
|
||||
if (name == "volatile") return KW_VOLATILE;
|
||||
if (name == "while") return KW_WHILE;
|
||||
|
||||
// These are alternative ways to refer to built-in operators.
|
||||
if (name == "and") return ANDAND;
|
||||
if (name == "and_eq") return ANDEQUAL;
|
||||
if (name == "bitand") return '&';
|
||||
if (name == "bitor") return '|';
|
||||
if (name == "compl") return '~';
|
||||
if (name == "not") return '!';
|
||||
if (name == "not_eq") return NECOMPARE;
|
||||
if (name == "or") return OROR;
|
||||
if (name == "or_eq") return OREQUAL;
|
||||
if (name == "xor") return '^';
|
||||
if (name == "xor_eq") return XOREQUAL;
|
||||
|
||||
if (!cpp_longlong_keyword.empty() && name == cpp_longlong_keyword) {
|
||||
return KW_LONGLONG;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user