summaryrefslogtreecommitdiffstats
path: root/source/slang/parser.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-06-19 11:09:23 -0700
committerGitHub <noreply@github.com>2017-06-19 11:09:23 -0700
commit838e8331da24744948539c12d2a8edcd9c594ee5 (patch)
treeaf1fffcf4cc3ad7368fb9ae2c1b23b34890dbca8 /source/slang/parser.cpp
parentbb9ca29160f5d95f3860504262693ea650d96be5 (diff)
parent91d796da81aade1669abb90b72d4013e5480fb2d (diff)
Merge pull request #30 from tfoleyNV/slang-checking-fix
Make sure that semantic checks always apply to Slang files
Diffstat (limited to 'source/slang/parser.cpp')
-rw-r--r--source/slang/parser.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index fb66fbbcf..75398a40d 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -2,6 +2,7 @@
#include <assert.h>
+#include "compiler.h"
#include "lookup.h"
namespace Slang
@@ -31,7 +32,9 @@ namespace Slang
class Parser
{
public:
- CompileOptions& options;
+ CompileOptions const& options;
+ TranslationUnitOptions const& translationUnitOptions;
+
int anonymousCounter = 0;
RefPtr<Scope> outerScope;
@@ -64,12 +67,14 @@ namespace Slang
currentScope = currentScope->parent;
}
Parser(
- CompileOptions& options,
+ CompileOptions const& options,
+ TranslationUnitOptions const& translationUnitOptions,
TokenSpan const& _tokens,
DiagnosticSink * sink,
String _fileName,
RefPtr<Scope> const& outerScope)
: options(options)
+ , translationUnitOptions(translationUnitOptions)
, tokenReader(_tokens)
, sink(sink)
, fileName(_fileName)
@@ -2495,7 +2500,7 @@ parser->ReadToken(TokenType::Comma);
RefPtr<StatementSyntaxNode> Parser::ParseBlockStatement()
{
- if( options.flags & SLANG_COMPILE_FLAG_NO_CHECKING )
+ if( translationUnitOptions.compileFlags & SLANG_COMPILE_FLAG_NO_CHECKING )
{
// We have been asked to parse the input, but not attempt to understand it.
@@ -3150,16 +3155,17 @@ parser->ReadToken(TokenType::Comma);
return rs;
}
- // Parse a source file into an existing translation unit
+ // Parse a source file into an existing translation unit
void parseSourceFile(
- ProgramSyntaxNode* translationUnitSyntax,
- CompileOptions& options,
- TokenSpan const& tokens,
- DiagnosticSink* sink,
- String const& fileName,
- RefPtr<Scope> const&outerScope)
- {
- Parser parser(options, tokens, sink, fileName, outerScope);
+ ProgramSyntaxNode* translationUnitSyntax,
+ CompileOptions const& options,
+ TranslationUnitOptions const& translationUnitOptions,
+ TokenSpan const& tokens,
+ DiagnosticSink* sink,
+ String const& fileName,
+ RefPtr<Scope> const& outerScope)
+ {
+ Parser parser(options, translationUnitOptions, tokens, sink, fileName, outerScope);
return parser.parseSourceFile(translationUnitSyntax);
}
}