Unnamed repository; edit this file 'description' to name the repository.
queries: Improve erlang tags
* Capture both specs and callbacks as 'interface'
* Capture record fields as 'field'
| -rw-r--r-- | runtime/queries/erlang/tags.scm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/runtime/queries/erlang/tags.scm b/runtime/queries/erlang/tags.scm index 0aa0e33c..d9d7f0d6 100644 --- a/runtime/queries/erlang/tags.scm +++ b/runtime/queries/erlang/tags.scm @@ -23,11 +23,35 @@ (atom) @definition.struct)) (#eq? @_attr "record")) +(attribute + name: (atom) @_attr + (arguments + . + [(atom) (macro)] ; Record name + [ + ; Just the field name: + (tuple (atom)? @definition.field) + ; Field name, type OR default: + (tuple + (binary_operator + left: (atom) @definition.field + operator: ["=" "::"])) + ; Field name, type AND default: + (tuple + (binary_operator + left: + (binary_operator + left: (atom) @definition.field + operator: "=") + operator: "::")) + ]) + (#eq? @_attr "record")) + ; Function specs ((attribute name: (atom) @_attr (stab_clause name: (atom) @definition.interface)) - (#eq? @_attr "spec")) + (#any-of? @_attr "spec" "callback")) ; Types ((attribute |