summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-08-12 14:43:25 -0700
committerTim Foley <tfoley@nvidia.com>2017-08-12 14:50:01 -0700
commitf1bda6ada269716dd28653222a10d2c11dd052c5 (patch)
tree63fdd927ca39462176d506ea7bb99a5b8b8bfa87 /source/slang/check.cpp
parent495f88167527945e680e091d49b5705f5f1af1f9 (diff)
Data-driven parsing of modifiers
Just like the previous change did for declaration keywords, this change uses the lexical environment to drive the lookup and dispatch of modifier parsing. This allows us to easily add modifiers to Slang, even when they might conflict with identifiers used in user code (because the modifier names are no longer special keywords, but ordinary identifiers). There was already some support for ideas like this with `__modifier` declarations (`ModifierDecl`) used to introduce some GLSL-specific keywords (so that they wouldn't pollute the namespace of HLSL files). The new approach changes these to be actual `syntax` declarations (`SyntaxDecl`) with the same representation as those used to introduce declaration keywords. Because many modifiers just introduce a single keyword that maps to a simple AST node (no further tokens/data), I modified the handling of syntax declarations so that they can take a user-data parameter, and this allows the common case ("just create an AST node of this type...") to be handled with minimal complications. This also adds in a general-purpose string-based lookup path for AST node classes, that should support programmatic creation in more cases. Statements are now the main case of keywords that need to be made table driven.
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 9f7a13230..bb0b1b794 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -1202,11 +1202,6 @@ namespace Slang
// These are only used in the stdlib, so no checking is needed
}
- void visitModifierDecl(ModifierDecl*)
- {
- // These are only used in the stdlib, so no checking is needed
- }
-
void visitGenericTypeParamDecl(GenericTypeParamDecl*)
{
// These are only used in the stdlib, so no checking is needed for now