summaryrefslogtreecommitdiff
path: root/queries
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-22 01:44:22 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-22 01:44:22 +0100
commitc7239b2906abb48110e3d41a18e94810af8ab915 (patch)
treea8c9af6694fd429d45fbdd8373d24ff8bf22db2b /queries
parent3abc76cce48f3ae66e28ec99af648dc5fdf8bf4a (diff)
downloadcrep-c7239b2906abb48110e3d41a18e94810af8ab915.tar.gz
Add JavaScript grammar
Diffstat (limited to 'queries')
-rw-r--r--queries/javascript.h28
-rw-r--r--queries/javascript.scm12
2 files changed, 40 insertions, 0 deletions
diff --git a/queries/javascript.h b/queries/javascript.h
new file mode 100644
index 0000000..81152e3
--- /dev/null
+++ b/queries/javascript.h
@@ -0,0 +1,28 @@
+unsigned char query_javascript[] = {
+ 0x28, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65,
+ 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20,
+ 0x22, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x40,
+ 0x66, 0x74, 0x79, 0x70, 0x65, 0x0a, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65,
+ 0x3a, 0x20, 0x28, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65,
+ 0x72, 0x29, 0x20, 0x40, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20,
+ 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x3a, 0x20,
+ 0x28, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x29, 0x20, 0x40, 0x66, 0x70, 0x61,
+ 0x72, 0x61, 0x6d, 0x73, 0x29, 0x0a, 0x0a, 0x28, 0x6d, 0x65, 0x74, 0x68,
+ 0x6f, 0x64, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x0a, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x5b, 0x28,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x65,
+ 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x29, 0x20, 0x28, 0x69, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x29, 0x5d, 0x20, 0x40,
+ 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x0a, 0x20, 0x20, 0x70, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x3a, 0x20, 0x28, 0x66, 0x6f, 0x72,
+ 0x6d, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x73, 0x29, 0x20, 0x40, 0x66, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
+ 0x29, 0x0a, 0x0a, 0x28, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x64, 0x65,
+ 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20,
+ 0x22, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x22, 0x20, 0x40, 0x66, 0x74, 0x79,
+ 0x70, 0x65, 0x0a, 0x20, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x20, 0x28,
+ 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x29, 0x20,
+ 0x40, 0x66, 0x6e, 0x61, 0x6d, 0x65, 0x29, 0x0a
+};
+unsigned int query_javascript_len = 296;
diff --git a/queries/javascript.scm b/queries/javascript.scm
new file mode 100644
index 0000000..fb0b755
--- /dev/null
+++ b/queries/javascript.scm
@@ -0,0 +1,12 @@
+(function_declaration
+ "function" @ftype
+ name: (identifier) @fname
+ parameters: (formal_parameters) @fparams)
+
+(method_definition
+ name: [(property_identifier) (identifier)] @fname
+ parameters: (formal_parameters) @fparams)
+
+(class_declaration
+ "class" @ftype
+ name: (identifier) @fname)