Parse the builtin pseudo-enum typedefs as type names
RAY_FLAG, RAYQUERY_FLAG, COMMITTED_STATUS, CANDIDATE_TYPE, MEMORY_TYPE_FLAG and BARRIER_SEMANTIC_FLAG were declared as uint typedefs in Sema but unknown to the parser, so `const RAY_FLAG f = ...` failed with "unknown type name".
This commit is contained in:
parent
0d4837d5fb
commit
5f9543170d
|
|
@ -2000,6 +2000,9 @@ const object_types = [_][]const u8{
|
||||||
"__builtin_LinAlgMatrix", "BuiltInTrianglePositions",
|
"__builtin_LinAlgMatrix", "BuiltInTrianglePositions",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The builtin pseudo-enum typedefs of uint (`const RAY_FLAG f = ...`).
|
||||||
|
const enum_typedefs = [_][]const u8{ "RAY_FLAG", "RAYQUERY_FLAG", "COMMITTED_STATUS", "CANDIDATE_TYPE", "MEMORY_TYPE_FLAG", "BARRIER_SEMANTIC_FLAG" };
|
||||||
|
|
||||||
/// Templates among the builtin object types.
|
/// Templates among the builtin object types.
|
||||||
const template_types = [_][]const u8{
|
const template_types = [_][]const u8{
|
||||||
"vector", "matrix", "Buffer",
|
"vector", "matrix", "Buffer",
|
||||||
|
|
@ -2051,7 +2054,7 @@ fn inList(list: []const []const u8, w: []const u8) bool {
|
||||||
/// replaces linear scans of the lists above (a third of parse time).
|
/// replaces linear scans of the lists above (a third of parse time).
|
||||||
const word_map = blk: {
|
const word_map = blk: {
|
||||||
@setEvalBranchQuota(1_000_000);
|
@setEvalBranchQuota(1_000_000);
|
||||||
var words: []const []const u8 = &(reserved_words ++ contextual_words ++ scalar_types ++ object_types ++ template_types ++ template_funcs);
|
var words: []const []const u8 = &(reserved_words ++ contextual_words ++ scalar_types ++ object_types ++ enum_typedefs ++ template_types ++ template_funcs);
|
||||||
for (qualifier_words) |q| words = words ++ &[_][]const u8{q[0]};
|
for (qualifier_words) |q| words = words ++ &[_][]const u8{q[0]};
|
||||||
var kvs: [words.len]struct { []const u8, WordInfo } = undefined;
|
var kvs: [words.len]struct { []const u8, WordInfo } = undefined;
|
||||||
var n: usize = 0;
|
var n: usize = 0;
|
||||||
|
|
@ -2062,7 +2065,7 @@ const word_map = blk: {
|
||||||
.contextual = inList(&contextual_words, w),
|
.contextual = inList(&contextual_words, w),
|
||||||
.scalar = inList(&scalar_types, w),
|
.scalar = inList(&scalar_types, w),
|
||||||
.numeric_scalar = inList(&scalar_types, w) and !std.mem.endsWith(u8, w, "_packed"),
|
.numeric_scalar = inList(&scalar_types, w) and !std.mem.endsWith(u8, w, "_packed"),
|
||||||
.object = inList(&object_types, w),
|
.object = inList(&object_types, w) or inList(&enum_typedefs, w),
|
||||||
.template = inList(&template_types, w) or inList(&template_funcs, w),
|
.template = inList(&template_types, w) or inList(&template_funcs, w),
|
||||||
};
|
};
|
||||||
for (qualifier_words) |q| {
|
for (qualifier_words) |q| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue