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

Adding ANTLR grammar debugging capabilities #8

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ jobs:
- name: Install dependencies for the language server
run: npm ci
working-directory: ./Dagor-Shader-Language-Server
- name: Generate ANTLR lexer
- name: Generate condition ANTLR lexer
run: npx antlr4ts -o "../../src/_generated" "ConditionLexer.g4"
working-directory: ./Dagor-Shader-Language-Server/grammar/antlr
- name: Generate ANTLR parser
- name: Generate condition ANTLR parser
run: npx antlr4ts -o "../../src/_generated" -no-listener -visitor "ConditionParser.g4"
working-directory: ./Dagor-Shader-Language-Server/grammar/antlr
- name: Generate DSHL ANTLR lexer
run: npx antlr4ts -o "../../src/_generated" "DshlLexer.g4"
working-directory: ./Dagor-Shader-Language-Server/grammar/antlr
- name: Generate DSHL ANTLR parser
run: npx antlr4ts -o "../../src/_generated" -no-listener -visitor "DshlParser.g4"
working-directory: ./Dagor-Shader-Language-Server/grammar/antlr
- name: Build
run: npm run build
- name: Build the tests
Expand Down
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
"type": "npm"
},
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Debug DSHL ANTLR grammar",
"type": "antlr-debug",
"request": "launch",
"input": "testFixture/include_test_game/prog/shaders/test.dshl",
"grammar": "Dagor-Shader-Language-Server/grammar/antlr/DshlParser.g4",
"startRule": "dshl",
"printParseTree": true,
"visualParseTree": true
}
],
"compounds": [
Expand Down
2 changes: 1 addition & 1 deletion Dagor-Shader-Language-Server
Submodule Dagor-Shader-Language-Server updated 42 files
+8 −2 .github/workflows/build.yml
+130 −0 grammar/antlr/DshlLexer.g4
+389 −0 grammar/antlr/DshlParser.g4
+29 −9 grammar/dshl.tmLanguage.json
+34 −39 grammar/hlsl.tmLanguage.json
+2 −1 package.json
+157 −2 src/core/document-info.ts
+4 −0 src/core/document-manager.ts
+313 −2 src/core/snapshot.ts
+225 −17 src/helper/dshl-info.ts
+9 −0 src/helper/helper.ts
+26 −0 src/helper/scope.ts
+5 −1 src/helper/server-helper.ts
+21 −0 src/interface/block/block-declaration.ts
+8 −0 src/interface/block/block-usage.ts
+1 −0 src/interface/define-context.ts
+6 −0 src/interface/function/function-argument.ts
+18 −0 src/interface/function/function-declaration.ts
+8 −0 src/interface/function/function-info.ts
+8 −0 src/interface/function/function-parameter.ts
+12 −0 src/interface/function/function-usage.ts
+2 −2 src/interface/include/include-context.ts
+10 −0 src/interface/interval-declaration.ts
+2 −0 src/interface/macro/macro-context.ts
+15 −0 src/interface/shader/shader-declaration.ts
+8 −0 src/interface/shader/shader-usage.ts
+10 −0 src/interface/snippets.ts
+20 −0 src/interface/variable/variable-declaration.ts
+8 −0 src/interface/variable/variable-usage.ts
+3 −1 src/processor/condition-visitor.ts
+25 −22 src/processor/dshl-preprocessor.ts
+439 −0 src/processor/dshl-visitor.ts
+70 −9 src/processor/hlsl-preprocessor.ts
+44 −5 src/provider/completion-provider.ts
+128 −0 src/provider/document-highlight-provider.ts
+94 −11 src/provider/document-symbol-provider.ts
+10 −1 src/provider/folding-ranges-provider.ts
+117 −0 src/provider/hover-provider.ts
+16 −0 src/provider/inlay-hint-provider.ts
+82 −0 src/provider/link-provider-base.ts
+36 −15 src/provider/signature-help-provider.ts
+13 −1 src/server.ts
Empty file added testFixture/test.dshl
Empty file.