If this happens then in ParseLineDirective I create the missing token EndOfDirectiveToken. I'm not sure if its ok, but it works.
HlslLexer.LexDirectiveToken must reset his value _value = null; before parsing, like HlslLexer.LexSyntaxToken. Because some directives have no value and it extrapolates the previous one to next - bad.
Removing afterLineNumber argument from ParseEndOfDirective. It looks like a special error for the line directive, it referred to MissingPreprocessorFile but was never used.
Added a test for #line without filename, it also checking if the end of directive is parsed correctly.
Fix test checking for LineDirectiveTrivia kind. No more special cases for 0, -1, -2 line number. It just should be >= 0. Yes, correlates with the latest DXC release!
#line 10 "file.hlsl" // valid
#line 20 // valid too
ParseLineDirective
I create the missing tokenEndOfDirectiveToken
. I'm not sure if its ok, but it works.HlslLexer.LexDirectiveToken
must reset his value_value = null;
before parsing, likeHlslLexer.LexSyntaxToken
. Because some directives have no value and it extrapolates the previous one to next - bad.afterLineNumber
argument fromParseEndOfDirective
. It looks like a special error for the line directive, it referred toMissingPreprocessorFile
but was never used.#line
without filename, it also checking if the end of directive is parsed correctly.LineDirectiveTrivia
kind. No more special cases for 0, -1, -2 line number. It just should be >= 0. Yes, correlates with the latest DXC release!