aboutsummaryrefslogtreecommitdiffstats
path: root/tree-sitter-yts
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-04 20:45:29 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-04 20:45:29 +0100
commit676cc2b5619ecd517df42b07dbc2c22449a47179 (patch)
tree622546b5b6df3cc05171a1b016365ffd612abcd6 /tree-sitter-yts
parentstyle(yt/main): Use consistent use qualifications (diff)
downloadyt-676cc2b5619ecd517df42b07dbc2c22449a47179.zip
refactor(tree-sitter-yts): Move in tree
Diffstat (limited to 'tree-sitter-yts')
-rw-r--r--tree-sitter-yts/.editorconfig14
-rw-r--r--tree-sitter-yts/.gitignore1
-rw-r--r--tree-sitter-yts/Cargo.toml21
-rw-r--r--tree-sitter-yts/binding.gyp19
-rw-r--r--tree-sitter-yts/bindings/node/binding.cc33
-rw-r--r--tree-sitter-yts/bindings/node/index.js19
-rw-r--r--tree-sitter-yts/bindings/rust/build.rs40
-rw-r--r--tree-sitter-yts/bindings/rust/lib.rs52
-rw-r--r--tree-sitter-yts/corpus/comments.txt51
-rw-r--r--tree-sitter-yts/corpus/comments_correct.txt27
-rw-r--r--tree-sitter-yts/corpus/duration.txt84
-rw-r--r--tree-sitter-yts/corpus/flags.txt71
-rw-r--r--tree-sitter-yts/corpus/flags_dash.txt29
-rw-r--r--tree-sitter-yts/corpus/url.txt84
-rw-r--r--tree-sitter-yts/grammar.js42
-rw-r--r--tree-sitter-yts/highlight_sample.yts7
-rw-r--r--tree-sitter-yts/package.json31
-rw-r--r--tree-sitter-yts/package.nix59
-rw-r--r--tree-sitter-yts/queries/highlights.scm12
-rw-r--r--tree-sitter-yts/src/grammar.json286
-rw-r--r--tree-sitter-yts/src/node-types.json201
-rw-r--r--tree-sitter-yts/src/parser.c1505
-rw-r--r--tree-sitter-yts/src/tree_sitter/parser.h241
23 files changed, 2929 insertions, 0 deletions
diff --git a/tree-sitter-yts/.editorconfig b/tree-sitter-yts/.editorconfig
new file mode 100644
index 0000000..a29f1a6
--- /dev/null
+++ b/tree-sitter-yts/.editorconfig
@@ -0,0 +1,14 @@
+# for testing purposes, the corpus may have trailing whitespace
+# and may have mixed EOL.
+# Still want a final newline though, as that makes no semantic difference.
+[corpus/*]
+trim_trailing_whitespace = false
+end_of_line = unset
+
+[**.{js,json,cc,css}]
+indent_style = space
+indent_size = 2
+
+# tree-sitter generate emits json with no trailing newline
+[src/node-types.json]
+insert_final_newline = false
diff --git a/tree-sitter-yts/.gitignore b/tree-sitter-yts/.gitignore
new file mode 100644
index 0000000..07e6e47
--- /dev/null
+++ b/tree-sitter-yts/.gitignore
@@ -0,0 +1 @@
+/node_modules
diff --git a/tree-sitter-yts/Cargo.toml b/tree-sitter-yts/Cargo.toml
new file mode 100644
index 0000000..5287c42
--- /dev/null
+++ b/tree-sitter-yts/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "tree-sitter-yts"
+description = "yts grammar for the tree-sitter parsing library"
+version = "0.0.1"
+keywords = ["incremental", "parsing", "yts"]
+categories = ["parsing", "text-editors"]
+repository = "https://github.com/tree-sitter/tree-sitter-yts"
+edition = "2018"
+license = "MIT"
+
+build = "bindings/rust/build.rs"
+include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
+
+[lib]
+path = "bindings/rust/lib.rs"
+
+[dependencies]
+tree-sitter = "~0.20.10"
+
+[build-dependencies]
+cc = "1.0"
diff --git a/tree-sitter-yts/binding.gyp b/tree-sitter-yts/binding.gyp
new file mode 100644
index 0000000..b05038b
--- /dev/null
+++ b/tree-sitter-yts/binding.gyp
@@ -0,0 +1,19 @@
+{
+ "targets": [
+ {
+ "target_name": "tree_sitter_yts_binding",
+ "include_dirs": [
+ "<!(node -e \"require('nan')\")",
+ "src"
+ ],
+ "sources": [
+ "bindings/node/binding.cc",
+ "src/parser.c",
+ # If your language uses an external scanner, add it here.
+ ],
+ "cflags_c": [
+ "-std=c99",
+ ]
+ }
+ ]
+}
diff --git a/tree-sitter-yts/bindings/node/binding.cc b/tree-sitter-yts/bindings/node/binding.cc
new file mode 100644
index 0000000..a042be5
--- /dev/null
+++ b/tree-sitter-yts/bindings/node/binding.cc
@@ -0,0 +1,33 @@
+#include "nan.h"
+#include "tree_sitter/parser.h"
+#include <node.h>
+
+using namespace v8;
+
+extern "C" TSLanguage *tree_sitter_yts ();
+
+namespace
+{
+
+NAN_METHOD (New) {}
+
+void
+Init (Local<Object> exports, Local<Object> module)
+{
+ Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate> (New);
+ tpl->SetClassName (Nan::New ("Language").ToLocalChecked ());
+ tpl->InstanceTemplate ()->SetInternalFieldCount (1);
+
+ Local<Function> constructor = Nan::GetFunction (tpl).ToLocalChecked ();
+ Local<Object> instance
+ = constructor->NewInstance (Nan::GetCurrentContext ()).ToLocalChecked ();
+ Nan::SetInternalFieldPointer (instance, 0, tree_sitter_yts ());
+
+ Nan::Set (instance, Nan::New ("name").ToLocalChecked (),
+ Nan::New ("yts").ToLocalChecked ());
+ Nan::Set (module, Nan::New ("exports").ToLocalChecked (), instance);
+}
+
+NODE_MODULE (tree_sitter_yts_binding, Init)
+
+} // namespace
diff --git a/tree-sitter-yts/bindings/node/index.js b/tree-sitter-yts/bindings/node/index.js
new file mode 100644
index 0000000..3217974
--- /dev/null
+++ b/tree-sitter-yts/bindings/node/index.js
@@ -0,0 +1,19 @@
+try {
+ module.exports = require("../../build/Release/tree_sitter_yts_binding");
+} catch (error1) {
+ if (error1.code !== "MODULE_NOT_FOUND") {
+ throw error1;
+ }
+ try {
+ module.exports = require("../../build/Debug/tree_sitter_yts_binding");
+ } catch (error2) {
+ if (error2.code !== "MODULE_NOT_FOUND") {
+ throw error2;
+ }
+ throw error1;
+ }
+}
+
+try {
+ module.exports.nodeTypeInfo = require("../../src/node-types.json");
+} catch (_) {}
diff --git a/tree-sitter-yts/bindings/rust/build.rs b/tree-sitter-yts/bindings/rust/build.rs
new file mode 100644
index 0000000..c6061f0
--- /dev/null
+++ b/tree-sitter-yts/bindings/rust/build.rs
@@ -0,0 +1,40 @@
+fn main() {
+ let src_dir = std::path::Path::new("src");
+
+ let mut c_config = cc::Build::new();
+ c_config.include(&src_dir);
+ c_config
+ .flag_if_supported("-Wno-unused-parameter")
+ .flag_if_supported("-Wno-unused-but-set-variable")
+ .flag_if_supported("-Wno-trigraphs");
+ let parser_path = src_dir.join("parser.c");
+ c_config.file(&parser_path);
+
+ // If your language uses an external scanner written in C,
+ // then include this block of code:
+
+ /*
+ let scanner_path = src_dir.join("scanner.c");
+ c_config.file(&scanner_path);
+ println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
+ */
+
+ c_config.compile("parser");
+ println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
+
+ // If your language uses an external scanner written in C++,
+ // then include this block of code:
+
+ /*
+ let mut cpp_config = cc::Build::new();
+ cpp_config.cpp(true);
+ cpp_config.include(&src_dir);
+ cpp_config
+ .flag_if_supported("-Wno-unused-parameter")
+ .flag_if_supported("-Wno-unused-but-set-variable");
+ let scanner_path = src_dir.join("scanner.cc");
+ cpp_config.file(&scanner_path);
+ cpp_config.compile("scanner");
+ println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
+ */
+}
diff --git a/tree-sitter-yts/bindings/rust/lib.rs b/tree-sitter-yts/bindings/rust/lib.rs
new file mode 100644
index 0000000..f1868b2
--- /dev/null
+++ b/tree-sitter-yts/bindings/rust/lib.rs
@@ -0,0 +1,52 @@
+//! This crate provides yts language support for the [tree-sitter][] parsing library.
+//!
+//! Typically, you will use the [language][language func] function to add this language to a
+//! tree-sitter [Parser][], and then use the parser to parse some code:
+//!
+//! ```
+//! let code = "";
+//! let mut parser = tree_sitter::Parser::new();
+//! parser.set_language(tree_sitter_yts::language()).expect("Error loading yts grammar");
+//! let tree = parser.parse(code, None).unwrap();
+//! ```
+//!
+//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
+//! [language func]: fn.language.html
+//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
+//! [tree-sitter]: https://tree-sitter.github.io/
+
+use tree_sitter::Language;
+
+extern "C" {
+ fn tree_sitter_yts() -> Language;
+}
+
+/// Get the tree-sitter [Language][] for this grammar.
+///
+/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
+pub fn language() -> Language {
+ unsafe { tree_sitter_yts() }
+}
+
+/// The content of the [`node-types.json`][] file for this grammar.
+///
+/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
+pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
+
+// Uncomment these to include any queries that this grammar contains
+
+// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
+// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
+// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
+// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn test_can_load_grammar() {
+ let mut parser = tree_sitter::Parser::new();
+ parser
+ .set_language(super::language())
+ .expect("Error loading yts language");
+ }
+}
diff --git a/tree-sitter-yts/corpus/comments.txt b/tree-sitter-yts/corpus/comments.txt
new file mode 100644
index 0000000..f194cb5
--- /dev/null
+++ b/tree-sitter-yts/corpus/comments.txt
@@ -0,0 +1,51 @@
+================================================================================
+Parse multiple lines
+================================================================================
+
+pick 6z21 "Name" "2024-01-17" "A" "0m 0s" "url"
+pick 61f1 "Name2" "2024-01-16" "A2" "0m 0s" "url"
+
+# This is a comment
+# it contains information
+
+--------------------------------------------------------------------------------
+
+(source_file
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (comment)
+ (comment))
diff --git a/tree-sitter-yts/corpus/comments_correct.txt b/tree-sitter-yts/corpus/comments_correct.txt
new file mode 100644
index 0000000..fd45e47
--- /dev/null
+++ b/tree-sitter-yts/corpus/comments_correct.txt
@@ -0,0 +1,27 @@
+================================================================================
+Disregard comments in title
+================================================================================
+
+pick 6r94 "#100 Name" "2024-01-12" "A" "133m 29s" "url"
+
+--------------------------------------------------------------------------------
+
+(source_file
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote))))
diff --git a/tree-sitter-yts/corpus/duration.txt b/tree-sitter-yts/corpus/duration.txt
new file mode 100644
index 0000000..af9ca82
--- /dev/null
+++ b/tree-sitter-yts/corpus/duration.txt
@@ -0,0 +1,84 @@
+================================================================================
+Parse multiple lines with different durations
+================================================================================
+
+pick 6f21 "Name" "2024-01-17" "A" "1h 0m" "url"
+pick 6z81 "Name2" "2024-01-16" "A2" "20m 02s" "url2"
+pick 6a84 "Name3" "2024-01-16" "A3" "20h 0m" "url3"
+pick 6b06 "Name4" "2024-01-16" "A4" "[No Duration]" "url4"
+
+--------------------------------------------------------------------------------
+
+(source_file
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote))))
diff --git a/tree-sitter-yts/corpus/flags.txt b/tree-sitter-yts/corpus/flags.txt
new file mode 100644
index 0000000..8c1d255
--- /dev/null
+++ b/tree-sitter-yts/corpus/flags.txt
@@ -0,0 +1,71 @@
+================================================================================
+Correctly detect flags
+================================================================================
+
+watch --priority="-100" --speed 1 6z21 "Name" "2024-01-17" "A" "0m 0s" "url"
+watch -s 2 -l 'en,gr,fr' 61f1 "Name2" "2024-01-16" "A2" "0m 0s" "url"
+watch -s=2 -l='en,gr,fr' 61f1 "Name2" "2024-01-16" "A2" "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)))
+ (line
+ (command)
+ (flag)
+ (flag)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (flag)
+ (flag)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote))))
diff --git a/tree-sitter-yts/corpus/flags_dash.txt b/tree-sitter-yts/corpus/flags_dash.txt
new file mode 100644
index 0000000..b9a5e7c
--- /dev/null
+++ b/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/tree-sitter-yts/corpus/url.txt b/tree-sitter-yts/corpus/url.txt
new file mode 100644
index 0000000..8236d6b
--- /dev/null
+++ b/tree-sitter-yts/corpus/url.txt
@@ -0,0 +1,84 @@
+================================================================================
+Parse multiple lines with url
+================================================================================
+
+pick c221 "Name" "2024-01-17" "A" "0h 0m" "url"
+pick b181 "Name2" "2024-01-16" "A2" "0h 0m" "url2"
+pick a184 "Name3" "2024-01-16" "A3" "0h 0m" "url3"
+pick d206 "Name4" "2024-01-16" "A4" "0h 0m" "url4"
+
+--------------------------------------------------------------------------------
+
+(source_file
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote)))
+ (line
+ (command)
+ (id)
+ (title
+ (quote)
+ (quote))
+ (date
+ (quote)
+ (quote))
+ (author
+ (quote)
+ (quote))
+ (duration
+ (quote)
+ (quote))
+ (url
+ (quote)
+ (quote))))
diff --git a/tree-sitter-yts/grammar.js b/tree-sitter-yts/grammar.js
new file mode 100644
index 0000000..8a9d61f
--- /dev/null
+++ b/tree-sitter-yts/grammar.js
@@ -0,0 +1,42 @@
+module.exports = grammar({
+ name: "yts",
+
+ rules: {
+ source_file: ($) => repeat(choice($.line, $.comment)),
+ line: ($) =>
+ seq($.command, repeat($.flag), $.id, $.title, $.date, $.author, $.duration, $.url, "\n"),
+
+ command: ($) => choice("pick", "p", "watch", "w", "drop", "d", "url", "u"),
+ flag: ($) =>
+ choice(
+ /-\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),
+ date: ($) => seq($._q, /\d{4}-\d{2}-\d{2}/, $._q),
+ author: ($) => seq($._q, /[^"]+/, $._q),
+ duration: ($) =>
+ seq(
+ $._q,
+ seq(choice("[No Duration]", /\d+m \d+s/, /\d+h \d+m/)),
+ $._q,
+ ),
+ url: ($) => seq($._q, /[^"]+/, $._q),
+ comment: ($) => /#.*/,
+ _q: ($) => $.quote,
+ quote: ($) => /"/,
+ },
+ extras: ($) => [/\s/],
+});
diff --git a/tree-sitter-yts/highlight_sample.yts b/tree-sitter-yts/highlight_sample.yts
new file mode 100644
index 0000000..7f75852
--- /dev/null
+++ b/tree-sitter-yts/highlight_sample.yts
@@ -0,0 +1,7 @@
+pick 6a21 "Name" "2024-01-17" "A" "0h 00m" "url"
+pick 6z81 "Name2" "2024-01-16" "A2" "0h 00m" "url2"
+pick 6b84 "Name3" "2024-01-16" "A3" "0h 00m" "url3"
+pick 6f06 "Name4" "2024-01-16" "A4" "299h 36m" "url4"
+watch --priority="-100" --speed 1 6z21 "Name" "2024-01-17" "A" "0m 0s" "url"
+watch -s 2 -l 'en,gr,fr' 61f1 "Name2" "2024-01-16" "A2" "0m 0s" "url"
+watch -s=2 -l='en,gr,fr' 61f1 "Name2" "2024-01-16" "A2" "0m 0s" "url"
diff --git a/tree-sitter-yts/package.json b/tree-sitter-yts/package.json
new file mode 100644
index 0000000..2511ccb
--- /dev/null
+++ b/tree-sitter-yts/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "tree-sitter-yts",
+ "version": "0.0.1",
+ "description": "yts grammar for tree-sitter",
+ "main": "bindings/node",
+ "keywords": [
+ "parsing",
+ "incremental"
+ ],
+ "dependencies": {
+ "nan": "^2.12.1"
+ },
+ "devDependencies": {
+ "tree-sitter-cli": "^0.20.8"
+ },
+ "scripts": {
+ "test": "tree-sitter test"
+ },
+ "tree-sitter": [
+ {
+ "scope": "source.yts",
+ "file-types": [
+ "yts"
+ ],
+ "highlights": [
+ "queries/highlights.scm"
+ ],
+ "injection-regex": "^(yts)$"
+ }
+ ]
+}
diff --git a/tree-sitter-yts/package.nix b/tree-sitter-yts/package.nix
new file mode 100644
index 0000000..11ab5a8
--- /dev/null
+++ b/tree-sitter-yts/package.nix
@@ -0,0 +1,59 @@
+# taken from nixpgks: pkgs/development/tools/parsing/tree-sitter/grammar.nix
+{
+ stdenv,
+ nodejs,
+ tree-sitter,
+ lib,
+}:
+# # Build a parser grammar and put the resulting shared object in `$out/parser`
+# {
+# # language name
+# language ? "yts",
+# version ? "1.0.0",
+# src ? ./.,
+# location ? null,
+# generate ? false,
+# ...
+# } @ args:
+stdenv.mkDerivation {
+ pname = "yts-grammar";
+ version = "1.0.0";
+
+ src = ./.;
+
+ nativeBuildInputs = [nodejs tree-sitter];
+
+ CFLAGS = ["-Isrc" "-O2"];
+ CXXFLAGS = ["-Isrc" "-O2"];
+
+ stripDebugList = ["parser"];
+
+ configurePhase = ''
+ tree-sitter generate
+ '';
+
+ # When both scanner.{c,cc} exist, we should not link both since they may be the same but in
+ # different languages. Just randomly prefer C++ if that happens.
+ buildPhase = ''
+ runHook preBuild
+ if [[ -e src/scanner.cc ]]; then
+ $CXX -fPIC -c src/scanner.cc -o scanner.o $CXXFLAGS
+ elif [[ -e src/scanner.c ]]; then
+ $CC -fPIC -c src/scanner.c -o scanner.o $CFLAGS
+ fi
+ $CC -fPIC -c src/parser.c -o parser.o $CFLAGS
+ rm -rf parser
+ $CXX -shared -o parser *.o
+ runHook postBuild
+ '';
+
+ installPhase = ''
+ runHook preInstall
+ mkdir $out
+ mv parser $out/
+ if [[ -d queries ]]; then
+ cp -r queries $out
+ fi
+ runHook postInstall
+ '';
+}
diff --git a/tree-sitter-yts/queries/highlights.scm b/tree-sitter-yts/queries/highlights.scm
new file mode 100644
index 0000000..49f197d
--- /dev/null
+++ b/tree-sitter-yts/queries/highlights.scm
@@ -0,0 +1,12 @@
+(command) @keyword
+(id) @constant
+(title) @text.title
+(date) @number
+(author) @operator
+(duration) @property
+(flag) @attribute
+((url) @conceal (#set! conceal ""))
+
+
+((quote) @conceal (#set! conceal ""))
+(comment) @comment @spell
diff --git a/tree-sitter-yts/src/grammar.json b/tree-sitter-yts/src/grammar.json
new file mode 100644
index 0000000..a63633b
--- /dev/null
+++ b/tree-sitter-yts/src/grammar.json
@@ -0,0 +1,286 @@
+{
+ "name": "yts",
+ "rules": {
+ "source_file": {
+ "type": "REPEAT",
+ "content": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "line"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "comment"
+ }
+ ]
+ }
+ },
+ "line": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "command"
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SYMBOL",
+ "name": "flag"
+ }
+ },
+ {
+ "type": "SYMBOL",
+ "name": "id"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "title"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "date"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "author"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "duration"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "url"
+ },
+ {
+ "type": "STRING",
+ "value": "\n"
+ }
+ ]
+ },
+ "command": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "pick"
+ },
+ {
+ "type": "STRING",
+ "value": "p"
+ },
+ {
+ "type": "STRING",
+ "value": "watch"
+ },
+ {
+ "type": "STRING",
+ "value": "w"
+ },
+ {
+ "type": "STRING",
+ "value": "drop"
+ },
+ {
+ "type": "STRING",
+ "value": "d"
+ },
+ {
+ "type": "STRING",
+ "value": "url"
+ },
+ {
+ "type": "STRING",
+ "value": "u"
+ }
+ ]
+ },
+ "flag": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "PATTERN",
+ "value": "-\\w [^\\s]+"
+ },
+ {
+ "type": "PATTERN",
+ "value": "-\\w '[^']*'"
+ },
+ {
+ "type": "PATTERN",
+ "value": "-\\w \"[^\"]*\""
+ },
+ {
+ "type": "PATTERN",
+ "value": "-\\w=[^\\s]+"
+ },
+ {
+ "type": "PATTERN",
+ "value": "-\\w='[^']*'"
+ },
+ {
+ "type": "PATTERN",
+ "value": "-\\w=\"[^\"]*\""
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+ [^\\s]+"
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+ '[^']*'"
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+ \"[^\"]*\""
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+=[^\\s]+"
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+='[^']*'"
+ },
+ {
+ "type": "PATTERN",
+ "value": "--\\w[\\w-]+=\"[^\"]*\""
+ }
+ ]
+ },
+ "id": {
+ "type": "PATTERN",
+ "value": "[a-z0-9]+"
+ },
+ "title": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ },
+ {
+ "type": "PATTERN",
+ "value": "[^\"]+"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ }
+ ]
+ },
+ "date": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ },
+ {
+ "type": "PATTERN",
+ "value": "\\d{4}-\\d{2}-\\d{2}"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ }
+ ]
+ },
+ "author": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ },
+ {
+ "type": "PATTERN",
+ "value": "[^\"]+"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ }
+ ]
+ },
+ "duration": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ },
+ {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "[No Duration]"
+ },
+ {
+ "type": "PATTERN",
+ "value": "\\d+m \\d+s"
+ },
+ {
+ "type": "PATTERN",
+ "value": "\\d+h \\d+m"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ }
+ ]
+ },
+ "url": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ },
+ {
+ "type": "PATTERN",
+ "value": "[^\"]+"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_q"
+ }
+ ]
+ },
+ "comment": {
+ "type": "PATTERN",
+ "value": "#.*"
+ },
+ "_q": {
+ "type": "SYMBOL",
+ "name": "quote"
+ },
+ "quote": {
+ "type": "PATTERN",
+ "value": "\""
+ }
+ },
+ "extras": [
+ {
+ "type": "PATTERN",
+ "value": "\\s"
+ }
+ ],
+ "conflicts": [],
+ "precedences": [],
+ "externals": [],
+ "inline": [],
+ "supertypes": []
+}
+
diff --git a/tree-sitter-yts/src/node-types.json b/tree-sitter-yts/src/node-types.json
new file mode 100644
index 0000000..c4a588e
--- /dev/null
+++ b/tree-sitter-yts/src/node-types.json
@@ -0,0 +1,201 @@
+[
+ {
+ "type": "author",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "quote",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "command",
+ "named": true,
+ "fields": {}
+ },
+ {
+ "type": "date",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "quote",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "duration",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "quote",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "flag",
+ "named": true,
+ "fields": {}
+ },
+ {
+ "type": "line",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "author",
+ "named": true
+ },
+ {
+ "type": "command",
+ "named": true
+ },
+ {
+ "type": "date",
+ "named": true
+ },
+ {
+ "type": "duration",
+ "named": true
+ },
+ {
+ "type": "flag",
+ "named": true
+ },
+ {
+ "type": "id",
+ "named": true
+ },
+ {
+ "type": "title",
+ "named": true
+ },
+ {
+ "type": "url",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "source_file",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": false,
+ "types": [
+ {
+ "type": "comment",
+ "named": true
+ },
+ {
+ "type": "line",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "title",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "quote",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "url",
+ "named": true,
+ "fields": {},
+ "children": {
+ "multiple": true,
+ "required": true,
+ "types": [
+ {
+ "type": "quote",
+ "named": true
+ }
+ ]
+ }
+ },
+ {
+ "type": "\n",
+ "named": false
+ },
+ {
+ "type": "[No Duration]",
+ "named": false
+ },
+ {
+ "type": "comment",
+ "named": true
+ },
+ {
+ "type": "d",
+ "named": false
+ },
+ {
+ "type": "drop",
+ "named": false
+ },
+ {
+ "type": "id",
+ "named": true
+ },
+ {
+ "type": "p",
+ "named": false
+ },
+ {
+ "type": "pick",
+ "named": false
+ },
+ {
+ "type": "quote",
+ "named": true
+ },
+ {
+ "type": "u",
+ "named": false
+ },
+ {
+ "type": "url",
+ "named": false
+ },
+ {
+ "type": "w",
+ "named": false
+ },
+ {
+ "type": "watch",
+ "named": false
+ }
+] \ No newline at end of file
diff --git a/tree-sitter-yts/src/parser.c b/tree-sitter-yts/src/parser.c
new file mode 100644
index 0000000..3b43659
--- /dev/null
+++ b/tree-sitter-yts/src/parser.c
@@ -0,0 +1,1505 @@
+#include <tree_sitter/parser.h>
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+
+#define LANGUAGE_VERSION 14
+#define STATE_COUNT 39
+#define LARGE_STATE_COUNT 2
+#define SYMBOL_COUNT 42
+#define ALIAS_COUNT 0
+#define TOKEN_COUNT 30
+#define EXTERNAL_TOKEN_COUNT 0
+#define FIELD_COUNT 0
+#define MAX_ALIAS_SEQUENCE_LENGTH 9
+#define PRODUCTION_ID_COUNT 1
+
+enum
+{
+ anon_sym_LF = 1,
+ anon_sym_pick = 2,
+ anon_sym_p = 3,
+ anon_sym_watch = 4,
+ anon_sym_w = 5,
+ anon_sym_drop = 6,
+ anon_sym_d = 7,
+ anon_sym_url = 8,
+ anon_sym_u = 9,
+ aux_sym_flag_token1 = 10,
+ aux_sym_flag_token2 = 11,
+ aux_sym_flag_token3 = 12,
+ aux_sym_flag_token4 = 13,
+ aux_sym_flag_token5 = 14,
+ aux_sym_flag_token6 = 15,
+ aux_sym_flag_token7 = 16,
+ aux_sym_flag_token8 = 17,
+ aux_sym_flag_token9 = 18,
+ aux_sym_flag_token10 = 19,
+ aux_sym_flag_token11 = 20,
+ aux_sym_flag_token12 = 21,
+ sym_id = 22,
+ aux_sym_title_token1 = 23,
+ aux_sym_date_token1 = 24,
+ anon_sym_LBRACKNoDuration_RBRACK = 25,
+ aux_sym_duration_token1 = 26,
+ aux_sym_duration_token2 = 27,
+ sym_comment = 28,
+ sym_quote = 29,
+ sym_source_file = 30,
+ sym_line = 31,
+ sym_command = 32,
+ sym_flag = 33,
+ sym_title = 34,
+ sym_date = 35,
+ sym_author = 36,
+ sym_duration = 37,
+ sym_url = 38,
+ sym__q = 39,
+ aux_sym_source_file_repeat1 = 40,
+ aux_sym_line_repeat1 = 41,
+};
+
+static const char *const ts_symbol_names[] = {
+ [ts_builtin_sym_end] = "end",
+ [anon_sym_LF] = "\n",
+ [anon_sym_pick] = "pick",
+ [anon_sym_p] = "p",
+ [anon_sym_watch] = "watch",
+ [anon_sym_w] = "w",
+ [anon_sym_drop] = "drop",
+ [anon_sym_d] = "d",
+ [anon_sym_url] = "url",
+ [anon_sym_u] = "u",
+ [aux_sym_flag_token1] = "flag_token1",
+ [aux_sym_flag_token2] = "flag_token2",
+ [aux_sym_flag_token3] = "flag_token3",
+ [aux_sym_flag_token4] = "flag_token4",
+ [aux_sym_flag_token5] = "flag_token5",
+ [aux_sym_flag_token6] = "flag_token6",
+ [aux_sym_flag_token7] = "flag_token7",
+ [aux_sym_flag_token8] = "flag_token8",
+ [aux_sym_flag_token9] = "flag_token9",
+ [aux_sym_flag_token10] = "flag_token10",
+ [aux_sym_flag_token11] = "flag_token11",
+ [aux_sym_flag_token12] = "flag_token12",
+ [sym_id] = "id",
+ [aux_sym_title_token1] = "title_token1",
+ [aux_sym_date_token1] = "date_token1",
+ [anon_sym_LBRACKNoDuration_RBRACK] = "[No Duration]",
+ [aux_sym_duration_token1] = "duration_token1",
+ [aux_sym_duration_token2] = "duration_token2",
+ [sym_comment] = "comment",
+ [sym_quote] = "quote",
+ [sym_source_file] = "source_file",
+ [sym_line] = "line",
+ [sym_command] = "command",
+ [sym_flag] = "flag",
+ [sym_title] = "title",
+ [sym_date] = "date",
+ [sym_author] = "author",
+ [sym_duration] = "duration",
+ [sym_url] = "url",
+ [sym__q] = "_q",
+ [aux_sym_source_file_repeat1] = "source_file_repeat1",
+ [aux_sym_line_repeat1] = "line_repeat1",
+};
+
+static const TSSymbol ts_symbol_map[] = {
+ [ts_builtin_sym_end] = ts_builtin_sym_end,
+ [anon_sym_LF] = anon_sym_LF,
+ [anon_sym_pick] = anon_sym_pick,
+ [anon_sym_p] = anon_sym_p,
+ [anon_sym_watch] = anon_sym_watch,
+ [anon_sym_w] = anon_sym_w,
+ [anon_sym_drop] = anon_sym_drop,
+ [anon_sym_d] = anon_sym_d,
+ [anon_sym_url] = anon_sym_url,
+ [anon_sym_u] = anon_sym_u,
+ [aux_sym_flag_token1] = aux_sym_flag_token1,
+ [aux_sym_flag_token2] = aux_sym_flag_token2,
+ [aux_sym_flag_token3] = aux_sym_flag_token3,
+ [aux_sym_flag_token4] = aux_sym_flag_token4,
+ [aux_sym_flag_token5] = aux_sym_flag_token5,
+ [aux_sym_flag_token6] = aux_sym_flag_token6,
+ [aux_sym_flag_token7] = aux_sym_flag_token7,
+ [aux_sym_flag_token8] = aux_sym_flag_token8,
+ [aux_sym_flag_token9] = aux_sym_flag_token9,
+ [aux_sym_flag_token10] = aux_sym_flag_token10,
+ [aux_sym_flag_token11] = aux_sym_flag_token11,
+ [aux_sym_flag_token12] = aux_sym_flag_token12,
+ [sym_id] = sym_id,
+ [aux_sym_title_token1] = aux_sym_title_token1,
+ [aux_sym_date_token1] = aux_sym_date_token1,
+ [anon_sym_LBRACKNoDuration_RBRACK] = anon_sym_LBRACKNoDuration_RBRACK,
+ [aux_sym_duration_token1] = aux_sym_duration_token1,
+ [aux_sym_duration_token2] = aux_sym_duration_token2,
+ [sym_comment] = sym_comment,
+ [sym_quote] = sym_quote,
+ [sym_source_file] = sym_source_file,
+ [sym_line] = sym_line,
+ [sym_command] = sym_command,
+ [sym_flag] = sym_flag,
+ [sym_title] = sym_title,
+ [sym_date] = sym_date,
+ [sym_author] = sym_author,
+ [sym_duration] = sym_duration,
+ [sym_url] = sym_url,
+ [sym__q] = sym__q,
+ [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1,
+ [aux_sym_line_repeat1] = aux_sym_line_repeat1,
+};
+
+static const TSSymbolMetadata ts_symbol_metadata[] = {
+ [ts_builtin_sym_end] = {
+ .visible = false,
+ .named = true,
+ },
+ [anon_sym_LF] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_pick] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_p] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_watch] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_w] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_drop] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_d] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_url] = {
+ .visible = true,
+ .named = false,
+ },
+ [anon_sym_u] = {
+ .visible = true,
+ .named = false,
+ },
+ [aux_sym_flag_token1] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token2] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token3] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token4] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token5] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token6] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token7] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token8] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token9] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token10] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token11] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_flag_token12] = {
+ .visible = false,
+ .named = false,
+ },
+ [sym_id] = {
+ .visible = true,
+ .named = true,
+ },
+ [aux_sym_title_token1] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_date_token1] = {
+ .visible = false,
+ .named = false,
+ },
+ [anon_sym_LBRACKNoDuration_RBRACK] = {
+ .visible = true,
+ .named = false,
+ },
+ [aux_sym_duration_token1] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_duration_token2] = {
+ .visible = false,
+ .named = false,
+ },
+ [sym_comment] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_quote] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_source_file] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_line] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_command] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_flag] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_title] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_date] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_author] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_duration] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym_url] = {
+ .visible = true,
+ .named = true,
+ },
+ [sym__q] = {
+ .visible = false,
+ .named = true,
+ },
+ [aux_sym_source_file_repeat1] = {
+ .visible = false,
+ .named = false,
+ },
+ [aux_sym_line_repeat1] = {
+ .visible = false,
+ .named = false,
+ },
+};
+
+static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT]
+ [MAX_ALIAS_SEQUENCE_LENGTH]
+ = {
+ [0] = { 0 },
+ };
+
+static const uint16_t ts_non_terminal_alias_map[] = {
+ 0,
+};
+
+static const TSStateId ts_primary_state_ids[STATE_COUNT] = {
+ [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6,
+ [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13,
+ [14] = 14, [15] = 15, [16] = 16, [17] = 17, [18] = 18, [19] = 19, [20] = 20,
+ [21] = 21, [22] = 22, [23] = 23, [24] = 24, [25] = 25, [26] = 26, [27] = 27,
+ [28] = 28, [29] = 29, [30] = 30, [31] = 31, [32] = 32, [33] = 33, [34] = 34,
+ [35] = 35, [36] = 36, [37] = 37, [38] = 38,
+};
+
+static bool
+ts_lex (TSLexer *lexer, TSStateId state)
+{
+ START_LEXER ();
+ eof = lexer->eof (lexer);
+ switch (state)
+ {
+ case 0:
+ if (eof)
+ ADVANCE (57);
+ if (lookahead == '"')
+ ADVANCE (95);
+ if (lookahead == '#')
+ ADVANCE (94);
+ if (lookahead == '-')
+ ADVANCE (20);
+ if (lookahead == '[')
+ ADVANCE (24);
+ if (lookahead == 'd')
+ ADVANCE (64);
+ if (lookahead == 'p')
+ ADVANCE (60);
+ if (lookahead == 'u')
+ ADVANCE (66);
+ if (lookahead == 'w')
+ ADVANCE (62);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ SKIP (0)
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (31);
+ END_STATE ();
+ case 1:
+ if (lookahead == '\n')
+ ADVANCE (58);
+ if (lookahead == '\t' || lookahead == '\r' || lookahead == ' ')
+ SKIP (1)
+ END_STATE ();
+ case 2:
+ if (lookahead == ' ')
+ ADVANCE (7);
+ if (lookahead == '=')
+ ADVANCE (8);
+ END_STATE ();
+ case 3:
+ if (lookahead == ' ')
+ ADVANCE (49);
+ END_STATE ();
+ case 4:
+ if (lookahead == ' ')
+ ADVANCE (23);
+ END_STATE ();
+ case 5:
+ if (lookahead == ' ')
+ ADVANCE (50);
+ END_STATE ();
+ case 6:
+ if (lookahead == ' ')
+ ADVANCE (9);
+ if (lookahead == '=')
+ ADVANCE (10);
+ if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9')
+ || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_'
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (6);
+ END_STATE ();
+ case 7:
+ if (lookahead == '"')
+ ADVANCE (67);
+ if (lookahead == '\'')
+ ADVANCE (68);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (69);
+ END_STATE ();
+ case 8:
+ if (lookahead == '"')
+ ADVANCE (72);
+ if (lookahead == '\'')
+ ADVANCE (73);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (74);
+ END_STATE ();
+ case 9:
+ if (lookahead == '"')
+ ADVANCE (77);
+ if (lookahead == '\'')
+ ADVANCE (78);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (79);
+ END_STATE ();
+ case 10:
+ if (lookahead == '"')
+ ADVANCE (82);
+ if (lookahead == '\'')
+ ADVANCE (83);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (84);
+ END_STATE ();
+ case 11:
+ if (lookahead == '"')
+ ADVANCE (71);
+ if (lookahead != 0)
+ ADVANCE (11);
+ END_STATE ();
+ case 12:
+ if (lookahead == '"')
+ ADVANCE (76);
+ if (lookahead != 0)
+ ADVANCE (12);
+ END_STATE ();
+ case 13:
+ if (lookahead == '"')
+ ADVANCE (81);
+ if (lookahead != 0)
+ ADVANCE (13);
+ END_STATE ();
+ case 14:
+ if (lookahead == '"')
+ ADVANCE (86);
+ if (lookahead != 0)
+ ADVANCE (14);
+ END_STATE ();
+ case 15:
+ if (lookahead == '\'')
+ ADVANCE (70);
+ if (lookahead != 0)
+ ADVANCE (15);
+ END_STATE ();
+ case 16:
+ if (lookahead == '\'')
+ ADVANCE (75);
+ if (lookahead != 0)
+ ADVANCE (16);
+ END_STATE ();
+ case 17:
+ if (lookahead == '\'')
+ ADVANCE (80);
+ if (lookahead != 0)
+ ADVANCE (17);
+ END_STATE ();
+ case 18:
+ if (lookahead == '\'')
+ ADVANCE (85);
+ if (lookahead != 0)
+ ADVANCE (18);
+ END_STATE ();
+ case 19:
+ if (lookahead == '-')
+ ADVANCE (20);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ SKIP (19)
+ if (('0' <= lookahead && lookahead <= '9')
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (87);
+ END_STATE ();
+ case 20:
+ if (lookahead == '-')
+ ADVANCE (55);
+ if (('0' <= lookahead && lookahead <= '9')
+ || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_'
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (2);
+ END_STATE ();
+ case 21:
+ if (lookahead == '-')
+ ADVANCE (53);
+ if (lookahead == 'h')
+ ADVANCE (3);
+ if (lookahead == 'm')
+ ADVANCE (5);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (32);
+ END_STATE ();
+ case 22:
+ if (lookahead == '-')
+ ADVANCE (54);
+ END_STATE ();
+ case 23:
+ if (lookahead == 'D')
+ ADVANCE (47);
+ END_STATE ();
+ case 24:
+ if (lookahead == 'N')
+ ADVANCE (41);
+ END_STATE ();
+ case 25:
+ if (lookahead == ']')
+ ADVANCE (91);
+ END_STATE ();
+ case 26:
+ if (lookahead == 'a')
+ ADVANCE (45);
+ END_STATE ();
+ case 27:
+ if (lookahead == 'c')
+ ADVANCE (35);
+ END_STATE ();
+ case 28:
+ if (lookahead == 'c')
+ ADVANCE (33);
+ END_STATE ();
+ case 29:
+ if (lookahead == 'h')
+ ADVANCE (3);
+ if (lookahead == 'm')
+ ADVANCE (5);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (21);
+ END_STATE ();
+ case 30:
+ if (lookahead == 'h')
+ ADVANCE (3);
+ if (lookahead == 'm')
+ ADVANCE (5);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (29);
+ END_STATE ();
+ case 31:
+ if (lookahead == 'h')
+ ADVANCE (3);
+ if (lookahead == 'm')
+ ADVANCE (5);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (30);
+ END_STATE ();
+ case 32:
+ if (lookahead == 'h')
+ ADVANCE (3);
+ if (lookahead == 'm')
+ ADVANCE (5);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (32);
+ END_STATE ();
+ case 33:
+ if (lookahead == 'h')
+ ADVANCE (61);
+ END_STATE ();
+ case 34:
+ if (lookahead == 'i')
+ ADVANCE (40);
+ END_STATE ();
+ case 35:
+ if (lookahead == 'k')
+ ADVANCE (59);
+ END_STATE ();
+ case 36:
+ if (lookahead == 'l')
+ ADVANCE (65);
+ END_STATE ();
+ case 37:
+ if (lookahead == 'm')
+ ADVANCE (93);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (37);
+ END_STATE ();
+ case 38:
+ if (lookahead == 'n')
+ ADVANCE (25);
+ END_STATE ();
+ case 39:
+ if (lookahead == 'o')
+ ADVANCE (42);
+ END_STATE ();
+ case 40:
+ if (lookahead == 'o')
+ ADVANCE (38);
+ END_STATE ();
+ case 41:
+ if (lookahead == 'o')
+ ADVANCE (4);
+ END_STATE ();
+ case 42:
+ if (lookahead == 'p')
+ ADVANCE (63);
+ END_STATE ();
+ case 43:
+ if (lookahead == 'r')
+ ADVANCE (26);
+ END_STATE ();
+ case 44:
+ if (lookahead == 's')
+ ADVANCE (92);
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (44);
+ END_STATE ();
+ case 45:
+ if (lookahead == 't')
+ ADVANCE (34);
+ END_STATE ();
+ case 46:
+ if (lookahead == 't')
+ ADVANCE (28);
+ END_STATE ();
+ case 47:
+ if (lookahead == 'u')
+ ADVANCE (43);
+ END_STATE ();
+ case 48:
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (88);
+ if (lookahead != 0 && lookahead != '"')
+ ADVANCE (89);
+ END_STATE ();
+ case 49:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (37);
+ END_STATE ();
+ case 50:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (44);
+ END_STATE ();
+ case 51:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (22);
+ END_STATE ();
+ case 52:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (90);
+ END_STATE ();
+ case 53:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (51);
+ END_STATE ();
+ case 54:
+ if (('0' <= lookahead && lookahead <= '9'))
+ ADVANCE (52);
+ END_STATE ();
+ case 55:
+ if (('0' <= lookahead && lookahead <= '9')
+ || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_'
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (56);
+ END_STATE ();
+ case 56:
+ if (lookahead == '-' || ('0' <= lookahead && lookahead <= '9')
+ || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_'
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (6);
+ END_STATE ();
+ case 57:
+ ACCEPT_TOKEN (ts_builtin_sym_end);
+ END_STATE ();
+ case 58:
+ ACCEPT_TOKEN (anon_sym_LF);
+ if (lookahead == '\n')
+ ADVANCE (58);
+ END_STATE ();
+ case 59:
+ ACCEPT_TOKEN (anon_sym_pick);
+ END_STATE ();
+ case 60:
+ ACCEPT_TOKEN (anon_sym_p);
+ if (lookahead == 'i')
+ ADVANCE (27);
+ END_STATE ();
+ case 61:
+ ACCEPT_TOKEN (anon_sym_watch);
+ END_STATE ();
+ case 62:
+ ACCEPT_TOKEN (anon_sym_w);
+ if (lookahead == 'a')
+ ADVANCE (46);
+ END_STATE ();
+ case 63:
+ ACCEPT_TOKEN (anon_sym_drop);
+ END_STATE ();
+ case 64:
+ ACCEPT_TOKEN (anon_sym_d);
+ if (lookahead == 'r')
+ ADVANCE (39);
+ END_STATE ();
+ case 65:
+ ACCEPT_TOKEN (anon_sym_url);
+ END_STATE ();
+ case 66:
+ ACCEPT_TOKEN (anon_sym_u);
+ if (lookahead == 'r')
+ ADVANCE (36);
+ END_STATE ();
+ case 67:
+ ACCEPT_TOKEN (aux_sym_flag_token1);
+ if (lookahead == '"')
+ ADVANCE (69);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (11);
+ if (lookahead != 0)
+ ADVANCE (67);
+ END_STATE ();
+ case 68:
+ ACCEPT_TOKEN (aux_sym_flag_token1);
+ if (lookahead == '\'')
+ ADVANCE (69);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (15);
+ if (lookahead != 0)
+ ADVANCE (68);
+ END_STATE ();
+ case 69:
+ ACCEPT_TOKEN (aux_sym_flag_token1);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (69);
+ END_STATE ();
+ case 70:
+ ACCEPT_TOKEN (aux_sym_flag_token2);
+ END_STATE ();
+ case 71:
+ ACCEPT_TOKEN (aux_sym_flag_token3);
+ END_STATE ();
+ case 72:
+ ACCEPT_TOKEN (aux_sym_flag_token4);
+ if (lookahead == '"')
+ ADVANCE (74);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (12);
+ if (lookahead != 0)
+ ADVANCE (72);
+ END_STATE ();
+ case 73:
+ ACCEPT_TOKEN (aux_sym_flag_token4);
+ if (lookahead == '\'')
+ ADVANCE (74);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (16);
+ if (lookahead != 0)
+ ADVANCE (73);
+ END_STATE ();
+ case 74:
+ ACCEPT_TOKEN (aux_sym_flag_token4);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (74);
+ END_STATE ();
+ case 75:
+ ACCEPT_TOKEN (aux_sym_flag_token5);
+ END_STATE ();
+ case 76:
+ ACCEPT_TOKEN (aux_sym_flag_token6);
+ END_STATE ();
+ case 77:
+ ACCEPT_TOKEN (aux_sym_flag_token7);
+ if (lookahead == '"')
+ ADVANCE (79);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (13);
+ if (lookahead != 0)
+ ADVANCE (77);
+ END_STATE ();
+ case 78:
+ ACCEPT_TOKEN (aux_sym_flag_token7);
+ if (lookahead == '\'')
+ ADVANCE (79);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (17);
+ if (lookahead != 0)
+ ADVANCE (78);
+ END_STATE ();
+ case 79:
+ ACCEPT_TOKEN (aux_sym_flag_token7);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (79);
+ END_STATE ();
+ case 80:
+ ACCEPT_TOKEN (aux_sym_flag_token8);
+ END_STATE ();
+ case 81:
+ ACCEPT_TOKEN (aux_sym_flag_token9);
+ END_STATE ();
+ case 82:
+ ACCEPT_TOKEN (aux_sym_flag_token10);
+ if (lookahead == '"')
+ ADVANCE (84);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (14);
+ if (lookahead != 0)
+ ADVANCE (82);
+ END_STATE ();
+ case 83:
+ ACCEPT_TOKEN (aux_sym_flag_token10);
+ if (lookahead == '\'')
+ ADVANCE (84);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (18);
+ if (lookahead != 0)
+ ADVANCE (83);
+ END_STATE ();
+ case 84:
+ ACCEPT_TOKEN (aux_sym_flag_token10);
+ if (lookahead != 0 && lookahead != '\t' && lookahead != '\n'
+ && lookahead != '\r' && lookahead != ' ')
+ ADVANCE (84);
+ END_STATE ();
+ case 85:
+ ACCEPT_TOKEN (aux_sym_flag_token11);
+ END_STATE ();
+ case 86:
+ ACCEPT_TOKEN (aux_sym_flag_token12);
+ END_STATE ();
+ case 87:
+ ACCEPT_TOKEN (sym_id);
+ if (('0' <= lookahead && lookahead <= '9')
+ || ('a' <= lookahead && lookahead <= 'z'))
+ ADVANCE (87);
+ END_STATE ();
+ case 88:
+ ACCEPT_TOKEN (aux_sym_title_token1);
+ if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r'
+ || lookahead == ' ')
+ ADVANCE (88);
+ if (lookahead != 0 && lookahead != '"')
+ ADVANCE (89);
+ END_STATE ();
+ case 89:
+ ACCEPT_TOKEN (aux_sym_title_token1);
+ if (lookahead != 0 && lookahead != '"')
+ ADVANCE (89);
+ END_STATE ();
+ case 90:
+ ACCEPT_TOKEN (aux_sym_date_token1);
+ END_STATE ();
+ case 91:
+ ACCEPT_TOKEN (anon_sym_LBRACKNoDuration_RBRACK);
+ END_STATE ();
+ case 92:
+ ACCEPT_TOKEN (aux_sym_duration_token1);
+ END_STATE ();
+ case 93:
+ ACCEPT_TOKEN (aux_sym_duration_token2);
+ END_STATE ();
+ case 94:
+ ACCEPT_TOKEN (sym_comment);
+ if (lookahead != 0 && lookahead != '\n')
+ ADVANCE (94);
+ END_STATE ();
+ case 95:
+ ACCEPT_TOKEN (sym_quote);
+ END_STATE ();
+ default:
+ return false;
+ }
+}
+
+static const TSLexMode ts_lex_modes[STATE_COUNT] = {
+ [0] = { .lex_state = 0 }, [1] = { .lex_state = 0 },
+ [2] = { .lex_state = 19 }, [3] = { .lex_state = 19 },
+ [4] = { .lex_state = 19 }, [5] = { .lex_state = 19 },
+ [6] = { .lex_state = 0 }, [7] = { .lex_state = 19 },
+ [8] = { .lex_state = 0 }, [9] = { .lex_state = 0 },
+ [10] = { .lex_state = 0 }, [11] = { .lex_state = 0 },
+ [12] = { .lex_state = 0 }, [13] = { .lex_state = 0 },
+ [14] = { .lex_state = 0 }, [15] = { .lex_state = 0 },
+ [16] = { .lex_state = 0 }, [17] = { .lex_state = 0 },
+ [18] = { .lex_state = 0 }, [19] = { .lex_state = 0 },
+ [20] = { .lex_state = 0 }, [21] = { .lex_state = 0 },
+ [22] = { .lex_state = 0 }, [23] = { .lex_state = 0 },
+ [24] = { .lex_state = 0 }, [25] = { .lex_state = 0 },
+ [26] = { .lex_state = 0 }, [27] = { .lex_state = 0 },
+ [28] = { .lex_state = 48 }, [29] = { .lex_state = 0 },
+ [30] = { .lex_state = 1 }, [31] = { .lex_state = 48 },
+ [32] = { .lex_state = 0 }, [33] = { .lex_state = 0 },
+ [34] = { .lex_state = 0 }, [35] = { .lex_state = 0 },
+ [36] = { .lex_state = 1 }, [37] = { .lex_state = 1 },
+ [38] = { .lex_state = 48 },
+};
+
+static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
+ [0] = {
+ [ts_builtin_sym_end] = ACTIONS(1),
+ [anon_sym_pick] = ACTIONS(1),
+ [anon_sym_p] = ACTIONS(1),
+ [anon_sym_watch] = ACTIONS(1),
+ [anon_sym_w] = ACTIONS(1),
+ [anon_sym_drop] = ACTIONS(1),
+ [anon_sym_d] = ACTIONS(1),
+ [anon_sym_url] = ACTIONS(1),
+ [anon_sym_u] = ACTIONS(1),
+ [aux_sym_flag_token1] = ACTIONS(1),
+ [aux_sym_flag_token2] = ACTIONS(1),
+ [aux_sym_flag_token3] = ACTIONS(1),
+ [aux_sym_flag_token4] = ACTIONS(1),
+ [aux_sym_flag_token5] = ACTIONS(1),
+ [aux_sym_flag_token6] = ACTIONS(1),
+ [aux_sym_flag_token7] = ACTIONS(1),
+ [aux_sym_flag_token8] = ACTIONS(1),
+ [aux_sym_flag_token9] = ACTIONS(1),
+ [aux_sym_flag_token10] = ACTIONS(1),
+ [aux_sym_flag_token11] = ACTIONS(1),
+ [aux_sym_flag_token12] = ACTIONS(1),
+ [aux_sym_date_token1] = ACTIONS(1),
+ [anon_sym_LBRACKNoDuration_RBRACK] = ACTIONS(1),
+ [aux_sym_duration_token1] = ACTIONS(1),
+ [aux_sym_duration_token2] = ACTIONS(1),
+ [sym_comment] = ACTIONS(1),
+ [sym_quote] = ACTIONS(1),
+ },
+ [1] = {
+ [sym_source_file] = STATE(34),
+ [sym_line] = STATE(6),
+ [sym_command] = STATE(3),
+ [aux_sym_source_file_repeat1] = STATE(6),
+ [ts_builtin_sym_end] = ACTIONS(3),
+ [anon_sym_pick] = ACTIONS(5),
+ [anon_sym_p] = ACTIONS(7),
+ [anon_sym_watch] = ACTIONS(5),
+ [anon_sym_w] = ACTIONS(7),
+ [anon_sym_drop] = ACTIONS(5),
+ [anon_sym_d] = ACTIONS(7),
+ [anon_sym_url] = ACTIONS(5),
+ [anon_sym_u] = ACTIONS(7),
+ [sym_comment] = ACTIONS(9),
+ },
+};
+
+static const uint16_t ts_small_parse_table[] = {
+ [0] = 3,
+ ACTIONS (14),
+ 1,
+ sym_id,
+ STATE (2),
+ 2,
+ sym_flag,
+ aux_sym_line_repeat1,
+ ACTIONS (11),
+ 12,
+ aux_sym_flag_token1,
+ aux_sym_flag_token2,
+ aux_sym_flag_token3,
+ aux_sym_flag_token4,
+ aux_sym_flag_token5,
+ aux_sym_flag_token6,
+ aux_sym_flag_token7,
+ aux_sym_flag_token8,
+ aux_sym_flag_token9,
+ aux_sym_flag_token10,
+ aux_sym_flag_token11,
+ aux_sym_flag_token12,
+ [22] = 3,
+ ACTIONS (18),
+ 1,
+ sym_id,
+ STATE (4),
+ 2,
+ sym_flag,
+ aux_sym_line_repeat1,
+ ACTIONS (16),
+ 12,
+ aux_sym_flag_token1,
+ aux_sym_flag_token2,
+ aux_sym_flag_token3,
+ aux_sym_flag_token4,
+ aux_sym_flag_token5,
+ aux_sym_flag_token6,
+ aux_sym_flag_token7,
+ aux_sym_flag_token8,
+ aux_sym_flag_token9,
+ aux_sym_flag_token10,
+ aux_sym_flag_token11,
+ aux_sym_flag_token12,
+ [44] = 3,
+ ACTIONS (20),
+ 1,
+ sym_id,
+ STATE (2),
+ 2,
+ sym_flag,
+ aux_sym_line_repeat1,
+ ACTIONS (16),
+ 12,
+ aux_sym_flag_token1,
+ aux_sym_flag_token2,
+ aux_sym_flag_token3,
+ aux_sym_flag_token4,
+ aux_sym_flag_token5,
+ aux_sym_flag_token6,
+ aux_sym_flag_token7,
+ aux_sym_flag_token8,
+ aux_sym_flag_token9,
+ aux_sym_flag_token10,
+ aux_sym_flag_token11,
+ aux_sym_flag_token12,
+ [66] = 2,
+ ACTIONS (24),
+ 1,
+ sym_id,
+ ACTIONS (22),
+ 12,
+ aux_sym_flag_token1,
+ aux_sym_flag_token2,
+ aux_sym_flag_token3,
+ aux_sym_flag_token4,
+ aux_sym_flag_token5,
+ aux_sym_flag_token6,
+ aux_sym_flag_token7,
+ aux_sym_flag_token8,
+ aux_sym_flag_token9,
+ aux_sym_flag_token10,
+ aux_sym_flag_token11,
+ aux_sym_flag_token12,
+ [84] = 6,
+ ACTIONS (26),
+ 1,
+ ts_builtin_sym_end,
+ ACTIONS (28),
+ 1,
+ sym_comment,
+ STATE (3),
+ 1,
+ sym_command,
+ STATE (8),
+ 2,
+ sym_line,
+ aux_sym_source_file_repeat1,
+ ACTIONS (5),
+ 4,
+ anon_sym_pick,
+ anon_sym_watch,
+ anon_sym_drop,
+ anon_sym_url,
+ ACTIONS (7),
+ 4,
+ anon_sym_p,
+ anon_sym_w,
+ anon_sym_d,
+ anon_sym_u,
+ [110] = 2,
+ ACTIONS (32),
+ 1,
+ sym_id,
+ ACTIONS (30),
+ 12,
+ aux_sym_flag_token1,
+ aux_sym_flag_token2,
+ aux_sym_flag_token3,
+ aux_sym_flag_token4,
+ aux_sym_flag_token5,
+ aux_sym_flag_token6,
+ aux_sym_flag_token7,
+ aux_sym_flag_token8,
+ aux_sym_flag_token9,
+ aux_sym_flag_token10,
+ aux_sym_flag_token11,
+ aux_sym_flag_token12,
+ [128] = 6,
+ ACTIONS (34),
+ 1,
+ ts_builtin_sym_end,
+ ACTIONS (42),
+ 1,
+ sym_comment,
+ STATE (3),
+ 1,
+ sym_command,
+ STATE (8),
+ 2,
+ sym_line,
+ aux_sym_source_file_repeat1,
+ ACTIONS (36),
+ 4,
+ anon_sym_pick,
+ anon_sym_watch,
+ anon_sym_drop,
+ anon_sym_url,
+ ACTIONS (39),
+ 4,
+ anon_sym_p,
+ anon_sym_w,
+ anon_sym_d,
+ anon_sym_u,
+ [154] = 2,
+ ACTIONS (47),
+ 4,
+ anon_sym_p,
+ anon_sym_w,
+ anon_sym_d,
+ anon_sym_u,
+ ACTIONS (45),
+ 6,
+ ts_builtin_sym_end,
+ anon_sym_pick,
+ anon_sym_watch,
+ anon_sym_drop,
+ anon_sym_url,
+ sym_comment,
+ [169] = 2,
+ ACTIONS (51),
+ 4,
+ anon_sym_p,
+ anon_sym_w,
+ anon_sym_d,
+ anon_sym_u,
+ ACTIONS (49),
+ 6,
+ ts_builtin_sym_end,
+ anon_sym_pick,
+ anon_sym_watch,
+ anon_sym_drop,
+ anon_sym_url,
+ sym_comment,
+ [184] = 3,
+ ACTIONS (53),
+ 1,
+ sym_quote,
+ STATE (12),
+ 1,
+ sym__q,
+ STATE (20),
+ 1,
+ sym_duration,
+ [194] = 1,
+ ACTIONS (55),
+ 3,
+ anon_sym_LBRACKNoDuration_RBRACK,
+ aux_sym_duration_token1,
+ aux_sym_duration_token2,
+ [200] = 3,
+ ACTIONS (57),
+ 1,
+ sym_quote,
+ STATE (19),
+ 1,
+ sym_title,
+ STATE (38),
+ 1,
+ sym__q,
+ [210] = 3,
+ ACTIONS (57),
+ 1,
+ sym_quote,
+ STATE (18),
+ 1,
+ sym_title,
+ STATE (38),
+ 1,
+ sym__q,
+ [220] = 3,
+ ACTIONS (59),
+ 1,
+ sym_quote,
+ STATE (11),
+ 1,
+ sym_author,
+ STATE (28),
+ 1,
+ sym__q,
+ [230] = 3,
+ ACTIONS (61),
+ 1,
+ sym_quote,
+ STATE (31),
+ 1,
+ sym__q,
+ STATE (36),
+ 1,
+ sym_url,
+ [240] = 3,
+ ACTIONS (53),
+ 1,
+ sym_quote,
+ STATE (12),
+ 1,
+ sym__q,
+ STATE (16),
+ 1,
+ sym_duration,
+ [250] = 3,
+ ACTIONS (63),
+ 1,
+ sym_quote,
+ STATE (21),
+ 1,
+ sym_date,
+ STATE (33),
+ 1,
+ sym__q,
+ [260] = 3,
+ ACTIONS (63),
+ 1,
+ sym_quote,
+ STATE (15),
+ 1,
+ sym_date,
+ STATE (33),
+ 1,
+ sym__q,
+ [270] = 3,
+ ACTIONS (61),
+ 1,
+ sym_quote,
+ STATE (30),
+ 1,
+ sym_url,
+ STATE (31),
+ 1,
+ sym__q,
+ [280] = 3,
+ ACTIONS (59),
+ 1,
+ sym_quote,
+ STATE (17),
+ 1,
+ sym_author,
+ STATE (28),
+ 1,
+ sym__q,
+ [290] = 2,
+ ACTIONS (65),
+ 1,
+ sym_quote,
+ STATE (29),
+ 1,
+ sym__q,
+ [297] = 2,
+ ACTIONS (67),
+ 1,
+ sym_quote,
+ STATE (32),
+ 1,
+ sym__q,
+ [304] = 2,
+ ACTIONS (69),
+ 1,
+ sym_quote,
+ STATE (27),
+ 1,
+ sym__q,
+ [311] = 2,
+ ACTIONS (71),
+ 1,
+ sym_quote,
+ STATE (35),
+ 1,
+ sym__q,
+ [318] = 2,
+ ACTIONS (73),
+ 1,
+ sym_quote,
+ STATE (37),
+ 1,
+ sym__q,
+ [325] = 1,
+ ACTIONS (75),
+ 1,
+ sym_quote,
+ [329] = 1,
+ ACTIONS (77),
+ 1,
+ aux_sym_title_token1,
+ [333] = 1,
+ ACTIONS (79),
+ 1,
+ sym_quote,
+ [337] = 1,
+ ACTIONS (81),
+ 1,
+ anon_sym_LF,
+ [341] = 1,
+ ACTIONS (83),
+ 1,
+ aux_sym_title_token1,
+ [345] = 1,
+ ACTIONS (85),
+ 1,
+ sym_quote,
+ [349] = 1,
+ ACTIONS (87),
+ 1,
+ aux_sym_date_token1,
+ [353] = 1,
+ ACTIONS (89),
+ 1,
+ ts_builtin_sym_end,
+ [357] = 1,
+ ACTIONS (91),
+ 1,
+ sym_quote,
+ [361] = 1,
+ ACTIONS (93),
+ 1,
+ anon_sym_LF,
+ [365] = 1,
+ ACTIONS (95),
+ 1,
+ anon_sym_LF,
+ [369] = 1,
+ ACTIONS (97),
+ 1,
+ aux_sym_title_token1,
+};
+
+static const uint32_t ts_small_parse_table_map[] = {
+ [SMALL_STATE (2)] = 0, [SMALL_STATE (3)] = 22, [SMALL_STATE (4)] = 44,
+ [SMALL_STATE (5)] = 66, [SMALL_STATE (6)] = 84, [SMALL_STATE (7)] = 110,
+ [SMALL_STATE (8)] = 128, [SMALL_STATE (9)] = 154, [SMALL_STATE (10)] = 169,
+ [SMALL_STATE (11)] = 184, [SMALL_STATE (12)] = 194, [SMALL_STATE (13)] = 200,
+ [SMALL_STATE (14)] = 210, [SMALL_STATE (15)] = 220, [SMALL_STATE (16)] = 230,
+ [SMALL_STATE (17)] = 240, [SMALL_STATE (18)] = 250, [SMALL_STATE (19)] = 260,
+ [SMALL_STATE (20)] = 270, [SMALL_STATE (21)] = 280, [SMALL_STATE (22)] = 290,
+ [SMALL_STATE (23)] = 297, [SMALL_STATE (24)] = 304, [SMALL_STATE (25)] = 311,
+ [SMALL_STATE (26)] = 318, [SMALL_STATE (27)] = 325, [SMALL_STATE (28)] = 329,
+ [SMALL_STATE (29)] = 333, [SMALL_STATE (30)] = 337, [SMALL_STATE (31)] = 341,
+ [SMALL_STATE (32)] = 345, [SMALL_STATE (33)] = 349, [SMALL_STATE (34)] = 353,
+ [SMALL_STATE (35)] = 357, [SMALL_STATE (36)] = 361, [SMALL_STATE (37)] = 365,
+ [SMALL_STATE (38)] = 369,
+};
+
+static const TSParseActionEntry ts_parse_actions[] = {
+ [0] = { .entry = { .count = 0, .reusable = false } },
+ [1] = { .entry = { .count = 1, .reusable = false } },
+ RECOVER (),
+ [3] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_source_file, 0),
+ [5] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (5),
+ [7] = { .entry = { .count = 1, .reusable = false } },
+ SHIFT (5),
+ [9] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (6),
+ [11] = { .entry = { .count = 2, .reusable = false } },
+ REDUCE (aux_sym_line_repeat1, 2),
+ SHIFT_REPEAT (7),
+ [14] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (aux_sym_line_repeat1, 2),
+ [16] = { .entry = { .count = 1, .reusable = false } },
+ SHIFT (7),
+ [18] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (13),
+ [20] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (14),
+ [22] = { .entry = { .count = 1, .reusable = false } },
+ REDUCE (sym_command, 1),
+ [24] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_command, 1),
+ [26] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_source_file, 1),
+ [28] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (8),
+ [30] = { .entry = { .count = 1, .reusable = false } },
+ REDUCE (sym_flag, 1),
+ [32] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_flag, 1),
+ [34] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (aux_sym_source_file_repeat1, 2),
+ [36] = { .entry = { .count = 2, .reusable = true } },
+ REDUCE (aux_sym_source_file_repeat1, 2),
+ SHIFT_REPEAT (5),
+ [39] = { .entry = { .count = 2, .reusable = false } },
+ REDUCE (aux_sym_source_file_repeat1, 2),
+ SHIFT_REPEAT (5),
+ [42] = { .entry = { .count = 2, .reusable = true } },
+ REDUCE (aux_sym_source_file_repeat1, 2),
+ SHIFT_REPEAT (8),
+ [45] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_line, 9),
+ [47] = { .entry = { .count = 1, .reusable = false } },
+ REDUCE (sym_line, 9),
+ [49] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_line, 8),
+ [51] = { .entry = { .count = 1, .reusable = false } },
+ REDUCE (sym_line, 8),
+ [53] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (12),
+ [55] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (25),
+ [57] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (38),
+ [59] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (28),
+ [61] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (31),
+ [63] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (33),
+ [65] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (29),
+ [67] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (32),
+ [69] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (27),
+ [71] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (35),
+ [73] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (37),
+ [75] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_title, 3),
+ [77] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (23),
+ [79] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_date, 3),
+ [81] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (10),
+ [83] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (26),
+ [85] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_author, 3),
+ [87] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (22),
+ [89] = { .entry = { .count = 1, .reusable = true } },
+ ACCEPT_INPUT (),
+ [91] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_duration, 3),
+ [93] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (9),
+ [95] = { .entry = { .count = 1, .reusable = true } },
+ REDUCE (sym_url, 3),
+ [97] = { .entry = { .count = 1, .reusable = true } },
+ SHIFT (24),
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#ifdef _WIN32
+#define extern __declspec (dllexport)
+#endif
+
+ extern const TSLanguage *
+ tree_sitter_yts (void)
+ {
+ static const TSLanguage language = {
+ .version = LANGUAGE_VERSION,
+ .symbol_count = SYMBOL_COUNT,
+ .alias_count = ALIAS_COUNT,
+ .token_count = TOKEN_COUNT,
+ .external_token_count = EXTERNAL_TOKEN_COUNT,
+ .state_count = STATE_COUNT,
+ .large_state_count = LARGE_STATE_COUNT,
+ .production_id_count = PRODUCTION_ID_COUNT,
+ .field_count = FIELD_COUNT,
+ .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
+ .parse_table = &ts_parse_table[0][0],
+ .small_parse_table = ts_small_parse_table,
+ .small_parse_table_map = ts_small_parse_table_map,
+ .parse_actions = ts_parse_actions,
+ .symbol_names = ts_symbol_names,
+ .symbol_metadata = ts_symbol_metadata,
+ .public_symbol_map = ts_symbol_map,
+ .alias_map = ts_non_terminal_alias_map,
+ .alias_sequences = &ts_alias_sequences[0][0],
+ .lex_modes = ts_lex_modes,
+ .lex_fn = ts_lex,
+ .primary_state_ids = ts_primary_state_ids,
+ };
+ return &language;
+ }
+#ifdef __cplusplus
+}
+#endif
diff --git a/tree-sitter-yts/src/tree_sitter/parser.h b/tree-sitter-yts/src/tree_sitter/parser.h
new file mode 100644
index 0000000..1cbb75a
--- /dev/null
+++ b/tree-sitter-yts/src/tree_sitter/parser.h
@@ -0,0 +1,241 @@
+#ifndef TREE_SITTER_PARSER_H_
+#define TREE_SITTER_PARSER_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define ts_builtin_sym_error ((TSSymbol) - 1)
+#define ts_builtin_sym_end 0
+#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
+
+ typedef uint16_t TSStateId;
+
+#ifndef TREE_SITTER_API_H_
+ typedef uint16_t TSSymbol;
+ typedef uint16_t TSFieldId;
+ typedef struct TSLanguage TSLanguage;
+#endif
+
+ typedef struct
+ {
+ TSFieldId field_id;
+ uint8_t child_index;
+ bool inherited;
+ } TSFieldMapEntry;
+
+ typedef struct
+ {
+ uint16_t index;
+ uint16_t length;
+ } TSFieldMapSlice;
+
+ typedef struct
+ {
+ bool visible;
+ bool named;
+ bool supertype;
+ } TSSymbolMetadata;
+
+ typedef struct TSLexer TSLexer;
+
+ struct TSLexer
+ {
+ int32_t lookahead;
+ TSSymbol result_symbol;
+ void (*advance) (TSLexer *, bool);
+ void (*mark_end) (TSLexer *);
+ uint32_t (*get_column) (TSLexer *);
+ bool (*is_at_included_range_start) (const TSLexer *);
+ bool (*eof) (const TSLexer *);
+ };
+
+ typedef enum
+ {
+ TSParseActionTypeShift,
+ TSParseActionTypeReduce,
+ TSParseActionTypeAccept,
+ TSParseActionTypeRecover,
+ } TSParseActionType;
+
+ typedef union
+ {
+ struct
+ {
+ uint8_t type;
+ TSStateId state;
+ bool extra;
+ bool repetition;
+ } shift;
+ struct
+ {
+ uint8_t type;
+ uint8_t child_count;
+ TSSymbol symbol;
+ int16_t dynamic_precedence;
+ uint16_t production_id;
+ } reduce;
+ uint8_t type;
+ } TSParseAction;
+
+ typedef struct
+ {
+ uint16_t lex_state;
+ uint16_t external_lex_state;
+ } TSLexMode;
+
+ typedef union
+ {
+ TSParseAction action;
+ struct
+ {
+ uint8_t count;
+ bool reusable;
+ } entry;
+ } TSParseActionEntry;
+
+ struct TSLanguage
+ {
+ uint32_t version;
+ uint32_t symbol_count;
+ uint32_t alias_count;
+ uint32_t token_count;
+ uint32_t external_token_count;
+ uint32_t state_count;
+ uint32_t large_state_count;
+ uint32_t production_id_count;
+ uint32_t field_count;
+ uint16_t max_alias_sequence_length;
+ const uint16_t *parse_table;
+ const uint16_t *small_parse_table;
+ const uint32_t *small_parse_table_map;
+ const TSParseActionEntry *parse_actions;
+ const char *const *symbol_names;
+ const char *const *field_names;
+ const TSFieldMapSlice *field_map_slices;
+ const TSFieldMapEntry *field_map_entries;
+ const TSSymbolMetadata *symbol_metadata;
+ const TSSymbol *public_symbol_map;
+ const uint16_t *alias_map;
+ const TSSymbol *alias_sequences;
+ const TSLexMode *lex_modes;
+ bool (*lex_fn) (TSLexer *, TSStateId);
+ bool (*keyword_lex_fn) (TSLexer *, TSStateId);
+ TSSymbol keyword_capture_token;
+ struct
+ {
+ const bool *states;
+ const TSSymbol *symbol_map;
+ void *(*create) (void);
+ void (*destroy) (void *);
+ bool (*scan) (void *, TSLexer *, const bool *symbol_whitelist);
+ unsigned (*serialize) (void *, char *);
+ void (*deserialize) (void *, const char *, unsigned);
+ } external_scanner;
+ const TSStateId *primary_state_ids;
+ };
+
+ /*
+ * Lexer Macros
+ */
+
+#define START_LEXER() \
+ bool result = false; \
+ bool skip = false; \
+ bool eof = false; \
+ int32_t lookahead; \
+ goto start; \
+ next_state: \
+ lexer->advance (lexer, skip); \
+ start: \
+ skip = false; \
+ lookahead = lexer->lookahead;
+
+#define ADVANCE(state_value) \
+ { \
+ state = state_value; \
+ goto next_state; \
+ }
+
+#define SKIP(state_value) \
+ { \
+ skip = true; \
+ state = state_value; \
+ goto next_state; \
+ }
+
+#define ACCEPT_TOKEN(symbol_value) \
+ result = true; \
+ lexer->result_symbol = symbol_value; \
+ lexer->mark_end (lexer);
+
+#define END_STATE() return result;
+
+ /*
+ * Parse Table Macros
+ */
+
+#define SMALL_STATE(id) id - LARGE_STATE_COUNT
+
+#define STATE(id) id
+
+#define ACTIONS(id) id
+
+#define SHIFT(state_value) \
+ { \
+ { \
+ .shift = {.type = TSParseActionTypeShift, .state = state_value } \
+ } \
+ }
+
+#define SHIFT_REPEAT(state_value) \
+ { \
+ { \
+ .shift \
+ = {.type = TSParseActionTypeShift, \
+ .state = state_value, \
+ .repetition = true } \
+ } \
+ }
+
+#define SHIFT_EXTRA() \
+ { \
+ { \
+ .shift = {.type = TSParseActionTypeShift, .extra = true } \
+ } \
+ }
+
+#define REDUCE(symbol_val, child_count_val, ...) \
+ { \
+ { \
+ .reduce = { .type = TSParseActionTypeReduce, \
+ .symbol = symbol_val, \
+ .child_count = child_count_val, \
+ __VA_ARGS__ }, \
+ } \
+ }
+
+#define RECOVER() \
+ { \
+ { \
+ .type = TSParseActionTypeRecover \
+ } \
+ }
+
+#define ACCEPT_INPUT() \
+ { \
+ { \
+ .type = TSParseActionTypeAccept \
+ } \
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TREE_SITTER_PARSER_H_