about summary refs log tree commit diff stats
path: root/pkgs/by-name/tr/tree-sitter-yts
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/tr/tree-sitter-yts')
-rw-r--r--pkgs/by-name/tr/tree-sitter-yts/corpus/flags_dash.txt29
-rw-r--r--pkgs/by-name/tr/tree-sitter-yts/grammar.js12
2 files changed, 35 insertions, 6 deletions
diff --git a/pkgs/by-name/tr/tree-sitter-yts/corpus/flags_dash.txt b/pkgs/by-name/tr/tree-sitter-yts/corpus/flags_dash.txt
new file mode 100644
index 00000000..b9a5e7cc
--- /dev/null
+++ b/pkgs/by-name/tr/tree-sitter-yts/corpus/flags_dash.txt
@@ -0,0 +1,29 @@
+================================================================================
+Correctly detect flags
+================================================================================
+
+watch --subtitle-langs="" --speed 1 6z21 "Name" "2024-01-17" "A" "0m 0s" "url"
+
+--------------------------------------------------------------------------------
+
+(source_file
+  (line
+    (command)
+    (flag)
+    (flag)
+    (id)
+    (title
+      (quote)
+      (quote))
+    (date
+      (quote)
+      (quote))
+    (author
+      (quote)
+      (quote))
+    (duration
+      (quote)
+      (quote))
+    (url
+      (quote)
+      (quote))))
diff --git a/pkgs/by-name/tr/tree-sitter-yts/grammar.js b/pkgs/by-name/tr/tree-sitter-yts/grammar.js
index 27972419..8a9d61fe 100644
--- a/pkgs/by-name/tr/tree-sitter-yts/grammar.js
+++ b/pkgs/by-name/tr/tree-sitter-yts/grammar.js
@@ -16,12 +16,12 @@ module.exports = grammar({
               /-\w='[^']*'/,
               /-\w="[^"]*"/,
 
-              /--\w+ [^\s]+/,
-              /--\w+ '[^']*'/,
-              /--\w+ "[^"]*"/,
-              /--\w+=[^\s]+/,
-              /--\w+='[^']*'/,
-              /--\w+="[^"]*"/,
+              /--\w[\w-]+ [^\s]+/,
+              /--\w[\w-]+ '[^']*'/,
+              /--\w[\w-]+ "[^"]*"/,
+              /--\w[\w-]+=[^\s]+/,
+              /--\w[\w-]+='[^']*'/,
+              /--\w[\w-]+="[^"]*"/,
               ),
     id: ($) => /[a-z0-9]+/,
     title: ($) => seq($._q, /[^"]+/, $._q),