module analysis signature sorts TYPE constructors INT : TYPE STRING : TYPE STREAM : TYPE imports statixruntime statix/api pp injections/- libspoofax/term/origin desugar rules // Analysis // single-file analysis editor-analyze = stx-editor-analyze(pre-analyze, post-analyze|"statics", "programOk") // see docs/implementation.md for details on how to switch to multi-file analysis // multi-file analysis // editor-analyze = stx-editor-analyze(pre-analyze, post-analyze|"statics", "projectOk", "fileOk") pre-analyze = desugar-fostr ; origin-track-forced(explicate-injections-fostr-Start) post-analyze = origin-track-forced(implicate-injections-fostr-Start) rules // Editor Services editor-resolve = stx-editor-resolve editor-hover = stx-editor-hover rules // Debugging // Prints the abstract syntax ATerm of a selection. debug-show-aterm: (sel, _, _, path, projp) -> (filename, result) with filename := path ; result := sel // Prints the desugared abstract syntax ATerm of a selection. debug-desugar-fostr: (sel, _, _, path, projp) -> (filename, result) with filename := path ; result := sel // Prints the pre-analyzed abstract syntax ATerm of a selection. debug-show-pre-analyzed: (sel, _, _, path, projp) -> (filename, result) with filename := path ; result := sel // Prints the analyzed annotated abstract syntax ATerm of a selection. debug-show-analyzed: (sel, _, _, path, projp) -> (filename, result) with filename := path ; result := sel // Extract the type assigned to a node by Statix get-type: node -> type where // Assigns variable a to be the result of the Statix analysis of the entire program (or throws an error) a := node]])>; // Gets the type of the given node (or throws an error) type := node]])> node fail-msg(|msg) = err-msg(|$[get-type: [msg]]); fail // Prints the analyzed type of a selection. debug-show-type: (sel, _, _, path, projp) -> (filename, result) with filename := path ; result := sel