diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-19 10:23:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-19 10:23:16 -0700 |
| commit | bb9ca29160f5d95f3860504262693ea650d96be5 (patch) | |
| tree | 04f502283ed818f661e368b3d8d1ba5ce875d1d2 /source/slang/parser.cpp | |
| parent | cafed774d99f95bce6f182599913f3417dc68a3a (diff) | |
| parent | 634522da69b14b38c15b14d6b717b1289812e9bb (diff) | |
Merge pull request #29 from tfoleyNV/auto-import
Allow for automatic importing of Slang code
Diffstat (limited to 'source/slang/parser.cpp')
| -rw-r--r-- | source/slang/parser.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index b8997b1d7..fb66fbbcf 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -802,6 +802,18 @@ namespace Slang return decl; } + static RefPtr<Decl> parseAutoImportDecl( + Parser* parser) + { + Token importToken = parser->ReadToken(TokenType::AutoImport); + + auto decl = new ImportDecl(); + decl->nameToken = importToken; + decl->scope = parser->currentScope; + + return decl; + } + static Token ParseDeclName( Parser* parser) { @@ -2159,6 +2171,8 @@ parser->ReadToken(TokenType::Comma); decl = parseModifierDecl(parser); else if(parser->LookAheadToken("__import")) decl = parseImportDecl(parser); + else if(parser->LookAheadToken(TokenType::AutoImport)) + decl = parseAutoImportDecl(parser); else if (AdvanceIf(parser, TokenType::Semicolon)) { decl = new EmptyDecl(); |
