Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 81a4f02

Browse files
authored
Merge pull request #214 from github/set-java-tssg-global-vars
Set global variables for Java tssg
2 parents 7b1c2a8 + 20aed8b commit 81a4f02

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

languages/tree-sitter-stack-graphs-java/rust/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ pub const STACK_GRAPHS_BUILTINS_CONFIG: &str = include_str!("../src/builtins.cfg
1010
/// The stack graphs builtins source for this language
1111
pub const STACK_GRAPHS_BUILTINS_SOURCE: &str = include_str!("../src/builtins.java");
1212

13+
/// The name of the file path global variable
14+
pub const FILE_PATH_VAR: &str = "FILE_PATH";
15+
/// The name of the project name global variable
16+
pub const PROJECT_NAME_VAR: &str = "PROJECT_NAME";
17+
1318
pub fn language_configuration(cancellation_flag: &dyn CancellationFlag) -> LanguageConfiguration {
1419
LanguageConfiguration::from_tsg_str(
1520
tree_sitter_java::language(),

languages/tree-sitter-stack-graphs-java/src/stack-graphs.tsg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
;;;;;;;;;;;;;;;;;;;
22
;; Global Variables
33

4-
global FILE_PATH
5-
global ROOT_NODE
4+
global FILE_PATH ; project relative path of this file
5+
global PROJECT_NAME = "" ; project name, used to isolate different projects in the same stack graph
6+
67
global JUMP_TO_SCOPE_NODE
8+
global ROOT_NODE
79

810
;;;;;;;;;;;;;;;;;;;;;;;
911
;; Attribute Shorthands

0 commit comments

Comments
 (0)