Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line directive has optional filename argument. #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TIMONz1535
Copy link

  • Filename string argument in the line directive is optional https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-pre-line
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant