summaryrefslogtreecommitdiff
path: root/source/slang/lexer.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-10-10 13:56:25 -0400
committerGitHub <noreply@github.com>2018-10-10 13:56:25 -0400
commit879ec1b385d290a4375682ec613a9e7a1967fc7d (patch)
tree0d5f32d83d45458db54cce281c0c6331a677cdff /source/slang/lexer.h
parent60a91d63afab47a172690974c8b566af74072932 (diff)
Feature/source loc refactor (#668)
* * Remove the need for IRHighLevelDecoration in Emit * Use the IRLayoutDecoration for GeometryShaderPrimitiveTypeModifier * Initial look at at variable byte encoding, and simple unit test. * Fixing problems with comparison due to naming differences with slang/fxc. * * More tests and perf improvements for byte encoding. * Mechanism to detect processor and processor features in main slang header. * Split out cpu based defines into slang-cpu-defines.h so do not polute slang.h * Support for variable byte encoding on serialization. * Removed unused flag. * Fix warning. * Fix calcMsByte32 for 0 values without using intrinsic. * Fix a mistake in calculating maximum instruction size. * Introduced the idea of SourceUnit. * Small improvements around naming. Add more functionality - including getting the HumaneLoc. * Add support for #line default * Compiling with new SourceLoc handling. * Fix off by one on #line directives. * Can use 32bits for SourceLoc. Fix serialize to use that. * Small fixes and comment on usage. * Premake run. * Fix signed warning. * Fix typo on StringSlicePool::has found in review.
Diffstat (limited to 'source/slang/lexer.h')
-rw-r--r--source/slang/lexer.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/source/slang/lexer.h b/source/slang/lexer.h
index 1f2954d27..46d2aa227 100644
--- a/source/slang/lexer.h
+++ b/source/slang/lexer.h
@@ -73,7 +73,7 @@ namespace Slang
struct Lexer
{
void initialize(
- SourceFile* sourceFile,
+ SourceUnit* sourceUnit,
DiagnosticSink* sink,
NamePool* namePool);
@@ -83,15 +83,7 @@ namespace Slang
TokenList lexAllTokens();
- // Begin overriding the reported locations of tokens,
- // based on a `#line` directives
- void startOverridingSourceLocations(SourceLoc loc);
-
- // Stop overriding source locations, and go back
- // to reporting source locations in the original file
- void stopOverridingSourceLocations();
-
- SourceFile* sourceFile;
+ SourceUnit* sourceUnit;
DiagnosticSink* sink;
NamePool* namePool;
@@ -100,13 +92,16 @@ namespace Slang
char const* begin;
char const* end;
+ /// The starting sourceLoc (same as first location of SourceUnit)
+ SourceLoc startLoc;
+
// The starting source location for the code as written,
// which cannot be overridden.
- SourceLoc spellingStartLoc;
+ //SourceLoc spellingStartLoc;
// The nominal starting location for the file, taking
// any active `#line` directive into account.
- SourceLoc presumedStartLoc;
+ //SourceLoc presumedStartLoc;
TokenFlags tokenFlags;
LexerFlags lexerFlags;