diff --git a/tree-sitter-storybook/Cargo.toml b/tree-sitter-storybook/Cargo.toml new file mode 100644 index 0000000..f0c0caa --- /dev/null +++ b/tree-sitter-storybook/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "tree-sitter-storybook" +version = "0.1.0" +description = "Tree-sitter grammar for Storybook narrative DSL" +authors = ["Storybook Contributors"] +license = "MIT" +readme = "README.md" +keywords = ["tree-sitter", "parser", "storybook"] +repository = "https://github.com/yourusername/storybook" +edition = "2021" +include = [ + "bindings/rust/*", + "grammar.js", + "queries/*", + "src/*" +] + +[lib] +path = "bindings/rust/lib.rs" + +[dependencies] +tree-sitter = "~0.20" + +[build-dependencies] +cc = "1.0" diff --git a/tree-sitter-storybook/README.md b/tree-sitter-storybook/README.md new file mode 100644 index 0000000..702c14d --- /dev/null +++ b/tree-sitter-storybook/README.md @@ -0,0 +1,88 @@ +# tree-sitter-storybook + +Tree-sitter grammar for the Storybook narrative DSL. + +## Overview + +This is a Tree-sitter grammar for Storybook, a domain-specific language for narrative design and character development. The grammar provides syntax highlighting, code navigation, and other editor features through Tree-sitter. + +## Features + +- **Syntax highlighting** for all Storybook constructs +- **Symbol outline** for navigating characters, templates, relationships, etc. +- **Bracket matching** including special handling for prose blocks +- **Auto-indentation** support + +## Installation + +### For development + +```bash +# Install dependencies +npm install + +# Generate parser +npm run build + +# Run tests +npm run test +``` + +### For Zed editor + +This grammar is integrated into the Zed Storybook extension. See the `zed-storybook` directory for the extension. + +## Grammar Structure + +The grammar supports the following top-level declarations: + +- `use` - Import statements +- `character` - Character definitions +- `template` - Reusable field templates +- `life_arc` - State machines for character development +- `schedule` - Daily schedules and routines +- `behavior` - Behavior trees for AI +- `institution` - Organizations and groups +- `relationship` - Multi-party relationships +- `location` - Places and settings +- `species` - Species definitions with templates +- `enum` - Enumeration types + +## Special Features + +### Prose Blocks + +The grammar includes an external scanner (written in C) to handle prose blocks: + +```storybook +---backstory +This is a prose block that can contain +multiple lines of narrative text. +--- +``` + +### Expression Support + +Full support for expressions in life arc transitions: + +```storybook +on self.age >= 18 and self.location is wonderland -> adult_state +``` + +## Testing + +The grammar includes comprehensive tests. Run them with: + +```bash +tree-sitter test +``` + +To test parsing a specific file: + +```bash +tree-sitter parse path/to/file.sb +``` + +## License + +MIT diff --git a/tree-sitter-storybook/binding.gyp b/tree-sitter-storybook/binding.gyp new file mode 100644 index 0000000..06673be --- /dev/null +++ b/tree-sitter-storybook/binding.gyp @@ -0,0 +1,19 @@ +{ + "targets": [ + { + "target_name": "tree_sitter_storybook_binding", + "include_dirs": [ + " +#include "nan.h" + +using namespace v8; + +extern "C" TSLanguage * tree_sitter_storybook(); + +namespace { + +NAN_METHOD(New) {} + +void Init(Local exports, Local module) { + Local tpl = Nan::New(New); + tpl->SetClassName(Nan::New("Language").ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); + Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); + Nan::SetInternalFieldPointer(instance, 0, tree_sitter_storybook()); + + Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("storybook").ToLocalChecked()); + Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +} + +NODE_MODULE(tree_sitter_storybook_binding, Init) + +} // namespace diff --git a/tree-sitter-storybook/bindings/node/index.js b/tree-sitter-storybook/bindings/node/index.js new file mode 100644 index 0000000..3797ddb --- /dev/null +++ b/tree-sitter-storybook/bindings/node/index.js @@ -0,0 +1,19 @@ +try { + module.exports = require("../../build/Release/tree_sitter_storybook_binding"); +} catch (error1) { + if (error1.code !== 'MODULE_NOT_FOUND') { + throw error1; + } + try { + module.exports = require("../../build/Debug/tree_sitter_storybook_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-storybook/bindings/rust/build.rs b/tree-sitter-storybook/bindings/rust/build.rs new file mode 100644 index 0000000..c6061f0 --- /dev/null +++ b/tree-sitter-storybook/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-storybook/bindings/rust/lib.rs b/tree-sitter-storybook/bindings/rust/lib.rs new file mode 100644 index 0000000..9dc9ede --- /dev/null +++ b/tree-sitter-storybook/bindings/rust/lib.rs @@ -0,0 +1,52 @@ +//! This crate provides storybook 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_storybook::language()).expect("Error loading storybook 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_storybook() -> 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_storybook() } +} + +/// 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 storybook language"); + } +} diff --git a/tree-sitter-storybook/build.rs b/tree-sitter-storybook/build.rs new file mode 100644 index 0000000..72bfd53 --- /dev/null +++ b/tree-sitter-storybook/build.rs @@ -0,0 +1,20 @@ +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 we have a scanner + let scanner_path = src_dir.join("scanner.c"); + if scanner_path.exists() { + c_config.file(&scanner_path); + } + + c_config.compile("tree-sitter-storybook"); +} diff --git a/tree-sitter-storybook/grammar.js b/tree-sitter-storybook/grammar.js new file mode 100644 index 0000000..a6f8a50 --- /dev/null +++ b/tree-sitter-storybook/grammar.js @@ -0,0 +1,379 @@ +/** + * Tree-sitter grammar for Storybook DSL + * + * This grammar defines the syntax for the Storybook narrative DSL, + * including characters, templates, relationships, life arcs, behaviors, etc. + */ + +module.exports = grammar({ + name: 'storybook', + + // externals: $ => [ + // $._prose_block_content, + // $._prose_block_end + // ], + + extras: $ => [ + /\s/, // Whitespace + $.line_comment, + $.block_comment + ], + + conflicts: $ => [ + [$.path_segments] + ], + + word: $ => $.identifier, + + rules: { + // Top-level structure + source_file: $ => repeat($.declaration), + + // Comments + line_comment: $ => token(seq('//', /.*/)), + block_comment: $ => token(seq('/*', /[^*]*\*+([^/*][^*]*\*+)*/, '/')), + + // Declarations + declaration: $ => choice( + $.use_declaration, + $.character, + $.template, + $.life_arc, + $.schedule, + $.behavior, + $.institution, + $.relationship, + $.location, + $.species, + $.enum_declaration + ), + + // Use declarations + use_declaration: $ => seq( + 'use', + $.path_segments, + optional(choice( + seq('::', '{', commaSep1($.identifier), '}'), + seq('::', '*') + )), + ';' + ), + + path: $ => $.path_segments, + + path_segments: $ => sep1($.identifier, token('::')), + + // Character declaration + character: $ => seq( + 'character', + field('name', $.identifier), + optional(seq(':', field('species', $.identifier))), + optional(field('template', $.template_clause)), + field('body', $.block) + ), + + template_clause: $ => seq('from', commaSep1($.identifier)), + + // Template declaration + template: $ => seq( + 'template', + field('name', $.identifier), + optional('strict'), + '{', + repeat($.include), + repeat($.field), + '}' + ), + + include: $ => seq('include', $.identifier), + + // Fields (key: value pairs) + field: $ => choice( + seq( + field('name', $.dotted_path), + ':', + field('value', $.value) + ), + $.prose_block + ), + + dotted_path: $ => sep1($.identifier, '.'), + + // Values + value: $ => choice( + $.integer, + $.float, + $.string, + $.boolean, + $.range, + $.time, + $.duration, + $.path, + $.prose_block, + $.list, + $.object, + $.override + ), + + integer: $ => /-?[0-9]+/, + + float: $ => /-?[0-9]+\.[0-9]+/, + + string: $ => /"([^"\\]|\\.)*"/, + + boolean: $ => choice('true', 'false'), + + range: $ => choice( + seq($.integer, '..', $.integer), + seq($.float, '..', $.float) + ), + + time: $ => /[0-9]{2}:[0-9]{2}(:[0-9]{2})?/, + + duration: $ => /[0-9]+[hms]([0-9]+[hms])*/, + + list: $ => seq('[', commaSep($.value), ']'), + + object: $ => $.block, + + block: $ => seq('{', repeat($.field), '}'), + + // Override (@base { remove field, field: value }) + override: $ => seq( + '@', + $.path, + '{', + repeat($.override_op), + '}' + ), + + override_op: $ => choice( + seq('remove', $.identifier), + seq('append', $.field), + $.field + ), + + // Prose blocks (---tag content ---) + prose_block: $ => seq( + field('marker', $.prose_marker), + field('tag', $.identifier), + optional(/[^\n]*/), // Rest of opening line + field('content', $.prose_content), + field('end', $.prose_marker) + ), + + prose_marker: $ => '---', + + // Capture prose content as a single token for markdown injection + prose_content: $ => token(prec(-1, repeat1(choice( + /[^\-]+/, // Any non-dash characters + /-[^\-]/, // Single dash not followed by another dash + /-\-[^\-]/, // Two dashes not followed by another dash + )))), + + // Life arc declaration + life_arc: $ => seq( + 'life_arc', + field('name', $.identifier), + '{', + repeat($.field), + repeat($.arc_state), + '}' + ), + + arc_state: $ => seq( + 'state', + field('name', $.identifier), + '{', + optional($.on_enter), + repeat($.field), + repeat($.transition), + '}' + ), + + on_enter: $ => seq('on', 'enter', $.block), + + transition: $ => seq( + 'on', + field('condition', $.expression), + '->', + field('target', $.identifier) + ), + + // Schedule declaration + schedule: $ => seq( + 'schedule', + field('name', $.identifier), + '{', + repeat($.field), + repeat($.schedule_block), + '}' + ), + + schedule_block: $ => seq( + field('start', $.time), + '->', + field('end', $.time), + ':', + field('activity', $.identifier), + $.block + ), + + // Behavior tree declaration + behavior: $ => seq( + 'behavior', + field('name', $.identifier), + '{', + repeat($.field), + field('root', $.behavior_node), + '}' + ), + + behavior_node: $ => choice( + $.selector_node, + $.sequence_node, + $.repeat_node, + $.action_node, + $.subtree_node + ), + + selector_node: $ => seq('?', '{', repeat1($.behavior_node), '}'), + + sequence_node: $ => seq('>', '{', repeat1($.behavior_node), '}'), + + repeat_node: $ => seq('*', '{', $.behavior_node, '}'), + + action_node: $ => choice( + seq($.identifier, '(', commaSep($.action_param), ')'), + $.identifier + ), + + action_param: $ => choice( + // Named parameter: name: value + seq($.dotted_path, ':', $.value), + // Positional parameter: just value + $.value + ), + + subtree_node: $ => seq('@', $.path), + + // Institution declaration + institution: $ => seq( + 'institution', + field('name', $.identifier), + $.block + ), + + // Relationship declaration + relationship: $ => seq( + 'relationship', + field('name', $.identifier), + '{', + repeat1($.participant), + repeat($.field), + '}' + ), + + participant: $ => choice( + // name { fields } + seq($.path, $.block), + // name as role { fields } + seq($.path, 'as', $.identifier, $.block), + // bare name + $.path + ), + + // Location declaration + location: $ => seq( + 'location', + field('name', $.identifier), + $.block + ), + + // Species declaration + species: $ => seq( + 'species', + field('name', $.identifier), + '{', + repeat($.include), + repeat($.field), + '}' + ), + + // Enum declaration + enum_declaration: $ => seq( + 'enum', + field('name', $.identifier), + '{', + commaSep1($.identifier), + '}' + ), + + // Expressions (for conditions in life arcs) + expression: $ => choice( + $.or_expression, + $.and_expression, + $.not_expression, + $.comparison, + $.field_access, + $.primary_expression + ), + + or_expression: $ => prec.left(1, seq( + $.expression, + 'or', + $.expression + )), + + and_expression: $ => prec.left(2, seq( + $.expression, + 'and', + $.expression + )), + + not_expression: $ => prec(3, seq('not', $.expression)), + + comparison: $ => prec.left(4, seq( + $.expression, + field('operator', choice('is', '>', '>=', '<', '<=')), + $.expression + )), + + field_access: $ => prec.left(5, seq( + $.expression, + '.', + $.identifier + )), + + primary_expression: $ => choice( + 'self', + 'other', + $.integer, + $.float, + $.string, + $.boolean, + $.path + ), + + // Identifiers + identifier: $ => /[a-zA-Z_][a-zA-Z0-9_]*/, + } +}); + +/** + * Helper to create comma-separated lists with optional trailing comma + */ +function commaSep(rule) { + return optional(commaSep1(rule)); +} + +function commaSep1(rule) { + return seq(rule, repeat(seq(',', rule)), optional(',')); +} + +/** + * Helper to create separator-based lists (e.g., :: or .) + */ +function sep1(rule, separator) { + return seq(rule, repeat(seq(separator, rule))); +} diff --git a/tree-sitter-storybook/package-lock.json b/tree-sitter-storybook/package-lock.json new file mode 100644 index 0000000..3d800b4 --- /dev/null +++ b/tree-sitter-storybook/package-lock.json @@ -0,0 +1,554 @@ +{ + "name": "tree-sitter-storybook", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tree-sitter-storybook", + "version": "0.1.0", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^7.1.0", + "node-gyp-build": "^4.8.0" + }, + "devDependencies": { + "prebuildify": "^6.0.0", + "tree-sitter-cli": "^0.20.8" + }, + "peerDependencies": { + "tree-sitter": "^0.20.4" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT", + "peer": true + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC", + "peer": true + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/nan": { + "version": "2.25.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.25.0.tgz", + "integrity": "sha512-0M90Ag7Xn5KMLLZ7zliPWP3rT90P6PN+IzVFS0VqmnPktBk3700xUVv8Ikm9EUaUE5SDWdp/BIxdENzVznpm1g==", + "license": "MIT", + "peer": true + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT", + "peer": true + }, + "node_modules/node-abi": { + "version": "3.87.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.87.0.tgz", + "integrity": "sha512-+CGM1L1CgmtheLcBuleyYOn7NWPVu0s0EJH2C4puxgEZb9h8QpR9G2dBfZJOAUhi7VQxuBPMd0hiISWcTyiYyQ==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "license": "MIT" + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "peer": true, + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuildify": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/prebuildify/-/prebuildify-6.0.1.tgz", + "integrity": "sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "mkdirp-classic": "^0.5.3", + "node-abi": "^3.3.0", + "npm-run-path": "^3.1.0", + "pump": "^3.0.0", + "tar-fs": "^2.1.0" + }, + "bin": { + "prebuildify": "bin.js" + } + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "peer": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tree-sitter": { + "version": "0.20.6", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.6.tgz", + "integrity": "sha512-GxJodajVpfgb3UREzzIbtA1hyRnTxVbWVXrbC6sk4xTMH5ERMBJk9HJNq4c8jOJeUaIOmLcwg+t6mez/PDvGqg==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "dependencies": { + "nan": "^2.18.0", + "prebuild-install": "^7.1.1" + } + }, + "node_modules/tree-sitter-cli": { + "version": "0.20.8", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz", + "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0vy+oZCC33M43u6R1HSCA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "tree-sitter": "cli.js" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/tree-sitter-storybook/package.json b/tree-sitter-storybook/package.json new file mode 100644 index 0000000..ddbfe8e --- /dev/null +++ b/tree-sitter-storybook/package.json @@ -0,0 +1,55 @@ +{ + "name": "tree-sitter-storybook", + "version": "0.1.0", + "description": "Tree-sitter grammar for Storybook narrative DSL", + "main": "bindings/node", + "types": "bindings/node", + "keywords": [ + "tree-sitter", + "parser", + "storybook" + ], + "files": [ + "grammar.js", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/*", + "src/**" + ], + "dependencies": { + "node-addon-api": "^7.1.0", + "node-gyp-build": "^4.8.0" + }, + "devDependencies": { + "tree-sitter-cli": "^0.20.8", + "prebuildify": "^6.0.0" + }, + "peerDependencies": { + "tree-sitter": "^0.20.4" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } + }, + "scripts": { + "install": "node-gyp-build", + "prebuildify": "prebuildify --napi --strip", + "build": "tree-sitter generate && node-gyp-build", + "build-wasm": "tree-sitter build-wasm", + "test": "tree-sitter test" + }, + "tree-sitter": [ + { + "scope": "source.storybook", + "file-types": ["sb"], + "highlights": "queries/highlights.scm" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/yourusername/storybook" + }, + "license": "MIT" +} diff --git a/tree-sitter-storybook/queries/brackets.scm b/tree-sitter-storybook/queries/brackets.scm new file mode 100644 index 0000000..bab178b --- /dev/null +++ b/tree-sitter-storybook/queries/brackets.scm @@ -0,0 +1,16 @@ +; Bracket matching for Storybook DSL + +; Curly braces +("{" @open "}" @close) @bracket + +; Parentheses +("(" @open ")" @close) @bracket + +; Square brackets +("[" @open "]" @close) @bracket + +; Prose blocks (special bracket matching for --- markers) +; Note: Both markers are the same node type +(prose_block + (prose_marker) @open + (prose_marker) @close) @bracket diff --git a/tree-sitter-storybook/queries/highlights.scm b/tree-sitter-storybook/queries/highlights.scm new file mode 100644 index 0000000..8ead7f0 --- /dev/null +++ b/tree-sitter-storybook/queries/highlights.scm @@ -0,0 +1,153 @@ +; Highlights query for Storybook DSL +; Maps grammar nodes to standard highlight groups + +; Comments +(line_comment) @comment.line +(block_comment) @comment.block + +; Keywords - Declaration keywords +[ + "character" + "template" + "life_arc" + "schedule" + "behavior" + "institution" + "relationship" + "location" + "species" + "enum" + "state" +] @keyword.declaration + +; Keywords - Control flow and modifiers +[ + "and" + "or" + "not" + "on" + "enter" + "strict" +] @keyword.control + +; Keywords - Import/module +[ + "use" + "include" + "from" +] @keyword.import + +; Keywords - Special +[ + "as" + "self" + "other" + "remove" + "append" + "is" +] @keyword.special + +; Boolean literals +[ + "true" + "false" +] @constant.builtin.boolean + +; Numbers +(integer) @constant.numeric.integer +(float) @constant.numeric.float +(time) @constant.numeric.time +(duration) @constant.numeric.duration + +; Strings +(string) @string + +; Identifiers in different contexts +(character name: (identifier) @type.character) +(template name: (identifier) @type.template) +(life_arc name: (identifier) @type.life_arc) +(schedule name: (identifier) @type.schedule) +(behavior name: (identifier) @type.behavior) +(institution name: (identifier) @type.institution) +(relationship name: (identifier) @type.relationship) +(location name: (identifier) @type.location) +(species name: (identifier) @type.species) +(enum_declaration name: (identifier) @type.enum) +(arc_state name: (identifier) @type.state) + +; Field names +(field name: (dotted_path) @property) + +; Species reference +(character species: (identifier) @type.builtin) + +; Paths and identifiers +(path) @namespace +(identifier) @variable + +; Prose blocks - tag and content +(prose_block tag: (identifier) @tag) +(prose_block marker: (prose_marker) @punctuation.delimiter) +(prose_content) @markup.raw + +; Operators +[ + ">" + ">=" + "<" + "<=" + "->" + "is" +] @operator + +; Punctuation +[ + "{" + "}" +] @punctuation.bracket + +[ + "(" + ")" +] @punctuation.bracket + +[ + "[" + "]" +] @punctuation.bracket + +[ + ":" + "::" + ";" + "," + "." + ".." + "*" + "?" + "@" +] @punctuation.delimiter + +; Behavior tree nodes +(selector_node "?" @keyword.behavior.selector) +(sequence_node ">" @keyword.behavior.sequence) +(repeat_node "*" @keyword.behavior.repeat) +(action_node (identifier) @function.action) + +; Transitions +(transition "->" @operator.transition) +(transition target: (identifier) @type.state) + +; Schedule blocks +(schedule_block activity: (identifier) @function.activity) + +; Override operations +(override "@" @keyword.override) +(override_op "remove" @keyword.override) +(override_op "append" @keyword.override) + +; Template clause +(template_clause "from" @keyword.import) + +; Error handling +(ERROR) @error diff --git a/tree-sitter-storybook/queries/indents.scm b/tree-sitter-storybook/queries/indents.scm new file mode 100644 index 0000000..01439b4 --- /dev/null +++ b/tree-sitter-storybook/queries/indents.scm @@ -0,0 +1,45 @@ +; Indentation query for Storybook DSL + +; Increase indent after opening braces +[ + "{" + "(" + "[" +] @indent.begin + +; Decrease indent before closing braces +[ + "}" + ")" + "]" +] @indent.end + +; Special handling for prose blocks +(prose_block + marker: (prose_marker) @indent.begin + content: (_) + end: (_) @indent.end +) + +; Block structures that should indent their contents +[ + (block) + (character) + (template) + (life_arc) + (arc_state) + (schedule) + (schedule_block) + (behavior) + (institution) + (relationship) + (location) + (species) + (enum_declaration) + (selector_node) + (sequence_node) + (repeat_node) +] @indent.begin + +; Dedent after semicolon at top level +(use_declaration ";" @indent.end) diff --git a/tree-sitter-storybook/queries/injections.scm b/tree-sitter-storybook/queries/injections.scm new file mode 100644 index 0000000..f00aeeb --- /dev/null +++ b/tree-sitter-storybook/queries/injections.scm @@ -0,0 +1,12 @@ +; Injections for embedded languages in Storybook + +; Treat prose block content as Markdown +((prose_content) @injection.content + (#set! injection.language "markdown")) + +; Alternative: If you want to be more specific and only inject for certain tags: +; ((prose_block +; tag: (identifier) @tag +; content: (_) @injection.content) +; (#match? @tag "^(description|backstory|narrative|details|notes)$") +; (#set! injection.language "markdown")) diff --git a/tree-sitter-storybook/queries/outline.scm b/tree-sitter-storybook/queries/outline.scm new file mode 100644 index 0000000..f7ce582 --- /dev/null +++ b/tree-sitter-storybook/queries/outline.scm @@ -0,0 +1,57 @@ +; Outline/symbols query for Storybook DSL +; Defines what symbols appear in the document outline + +; Characters +(character + name: (identifier) @name +) @symbol.character + +; Templates +(template + name: (identifier) @name +) @symbol.template + +; Life arcs +(life_arc + name: (identifier) @name +) @symbol.life_arc + +; Life arc states +(arc_state + name: (identifier) @name +) @symbol.state + +; Schedules +(schedule + name: (identifier) @name +) @symbol.schedule + +; Behaviors +(behavior + name: (identifier) @name +) @symbol.behavior + +; Institutions +(institution + name: (identifier) @name +) @symbol.institution + +; Relationships +(relationship + name: (identifier) @name +) @symbol.relationship + +; Locations +(location + name: (identifier) @name +) @symbol.location + +; Species +(species + name: (identifier) @name +) @symbol.species + +; Enums +(enum_declaration + name: (identifier) @name +) @symbol.enum diff --git a/tree-sitter-storybook/src/grammar.json b/tree-sitter-storybook/src/grammar.json new file mode 100644 index 0000000..b9ae2b4 --- /dev/null +++ b/tree-sitter-storybook/src/grammar.json @@ -0,0 +1,1713 @@ +{ + "name": "storybook", + "word": "identifier", + "rules": { + "source_file": { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "declaration" + } + }, + "line_comment": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "//" + }, + { + "type": "PATTERN", + "value": ".*" + } + ] + } + }, + "block_comment": { + "type": "TOKEN", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "/*" + }, + { + "type": "PATTERN", + "value": "[^*]*\\*+([^/*][^*]*\\*+)*" + }, + { + "type": "STRING", + "value": "/" + } + ] + } + }, + "declaration": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "use_declaration" + }, + { + "type": "SYMBOL", + "name": "character" + }, + { + "type": "SYMBOL", + "name": "template" + }, + { + "type": "SYMBOL", + "name": "life_arc" + }, + { + "type": "SYMBOL", + "name": "schedule" + }, + { + "type": "SYMBOL", + "name": "behavior" + }, + { + "type": "SYMBOL", + "name": "institution" + }, + { + "type": "SYMBOL", + "name": "relationship" + }, + { + "type": "SYMBOL", + "name": "location" + }, + { + "type": "SYMBOL", + "name": "species" + }, + { + "type": "SYMBOL", + "name": "enum_declaration" + } + ] + }, + "use_declaration": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "use" + }, + { + "type": "SYMBOL", + "name": "path_segments" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "::" + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "BLANK" + } + ] + } + ] + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "::" + }, + { + "type": "STRING", + "value": "*" + } + ] + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": ";" + } + ] + }, + "path": { + "type": "SYMBOL", + "name": "path_segments" + }, + "path_segments": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "TOKEN", + "content": { + "type": "STRING", + "value": "::" + } + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + } + ] + }, + "character": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "character" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": ":" + }, + { + "type": "FIELD", + "name": "species", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "CHOICE", + "members": [ + { + "type": "FIELD", + "name": "template", + "content": { + "type": "SYMBOL", + "name": "template_clause" + } + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "FIELD", + "name": "body", + "content": { + "type": "SYMBOL", + "name": "block" + } + } + ] + }, + "template_clause": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "from" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "BLANK" + } + ] + } + ] + } + ] + }, + "template": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "template" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "strict" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "include" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "include": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "include" + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + }, + "field": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "dotted_path" + } + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "FIELD", + "name": "value", + "content": { + "type": "SYMBOL", + "name": "value" + } + } + ] + }, + { + "type": "SYMBOL", + "name": "prose_block" + } + ] + }, + "dotted_path": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + } + ] + }, + "value": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "integer" + }, + { + "type": "SYMBOL", + "name": "float" + }, + { + "type": "SYMBOL", + "name": "string" + }, + { + "type": "SYMBOL", + "name": "boolean" + }, + { + "type": "SYMBOL", + "name": "range" + }, + { + "type": "SYMBOL", + "name": "time" + }, + { + "type": "SYMBOL", + "name": "duration" + }, + { + "type": "SYMBOL", + "name": "path" + }, + { + "type": "SYMBOL", + "name": "prose_block" + }, + { + "type": "SYMBOL", + "name": "list" + }, + { + "type": "SYMBOL", + "name": "object" + }, + { + "type": "SYMBOL", + "name": "override" + } + ] + }, + "integer": { + "type": "PATTERN", + "value": "-?[0-9]+" + }, + "float": { + "type": "PATTERN", + "value": "-?[0-9]+\\.[0-9]+" + }, + "string": { + "type": "PATTERN", + "value": "\"([^\"\\\\]|\\\\.)*\"" + }, + "boolean": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "true" + }, + { + "type": "STRING", + "value": "false" + } + ] + }, + "range": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "integer" + }, + { + "type": "STRING", + "value": ".." + }, + { + "type": "SYMBOL", + "name": "integer" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "float" + }, + { + "type": "STRING", + "value": ".." + }, + { + "type": "SYMBOL", + "name": "float" + } + ] + } + ] + }, + "time": { + "type": "PATTERN", + "value": "[0-9]{2}:[0-9]{2}(:[0-9]{2})?" + }, + "duration": { + "type": "PATTERN", + "value": "[0-9]+[hms]([0-9]+[hms])*" + }, + "list": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "[" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "value" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "value" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "BLANK" + } + ] + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": "]" + } + ] + }, + "object": { + "type": "SYMBOL", + "name": "block" + }, + "block": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "override": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "@" + }, + { + "type": "SYMBOL", + "name": "path" + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "override_op" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "override_op": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "remove" + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "append" + }, + { + "type": "SYMBOL", + "name": "field" + } + ] + }, + { + "type": "SYMBOL", + "name": "field" + } + ] + }, + "prose_block": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "marker", + "content": { + "type": "SYMBOL", + "name": "prose_marker" + } + }, + { + "type": "FIELD", + "name": "tag", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "PATTERN", + "value": "[^\\n]*" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "FIELD", + "name": "content", + "content": { + "type": "SYMBOL", + "name": "prose_content" + } + }, + { + "type": "FIELD", + "name": "end", + "content": { + "type": "SYMBOL", + "name": "prose_marker" + } + } + ] + }, + "prose_marker": { + "type": "STRING", + "value": "---" + }, + "prose_content": { + "type": "TOKEN", + "content": { + "type": "PREC", + "value": -1, + "content": { + "type": "REPEAT1", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "PATTERN", + "value": "[^\\-]+" + }, + { + "type": "PATTERN", + "value": "-[^\\-]" + }, + { + "type": "PATTERN", + "value": "-\\-[^\\-]" + } + ] + } + } + } + }, + "life_arc": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "life_arc" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "arc_state" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "arc_state": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "state" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "on_enter" + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "transition" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "on_enter": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "on" + }, + { + "type": "STRING", + "value": "enter" + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + "transition": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "on" + }, + { + "type": "FIELD", + "name": "condition", + "content": { + "type": "SYMBOL", + "name": "expression" + } + }, + { + "type": "STRING", + "value": "->" + }, + { + "type": "FIELD", + "name": "target", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + } + ] + }, + "schedule": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "schedule" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "schedule_block" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "schedule_block": { + "type": "SEQ", + "members": [ + { + "type": "FIELD", + "name": "start", + "content": { + "type": "SYMBOL", + "name": "time" + } + }, + { + "type": "STRING", + "value": "->" + }, + { + "type": "FIELD", + "name": "end", + "content": { + "type": "SYMBOL", + "name": "time" + } + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "FIELD", + "name": "activity", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + "behavior": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "behavior" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "FIELD", + "name": "root", + "content": { + "type": "SYMBOL", + "name": "behavior_node" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "behavior_node": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "selector_node" + }, + { + "type": "SYMBOL", + "name": "sequence_node" + }, + { + "type": "SYMBOL", + "name": "repeat_node" + }, + { + "type": "SYMBOL", + "name": "action_node" + }, + { + "type": "SYMBOL", + "name": "subtree_node" + } + ] + }, + "selector_node": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "?" + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "behavior_node" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "sequence_node": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": ">" + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "behavior_node" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "repeat_node": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "*" + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "SYMBOL", + "name": "behavior_node" + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "action_node": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "STRING", + "value": "(" + }, + { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "action_param" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "action_param" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "BLANK" + } + ] + } + ] + }, + { + "type": "BLANK" + } + ] + }, + { + "type": "STRING", + "value": ")" + } + ] + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + }, + "action_param": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "dotted_path" + }, + { + "type": "STRING", + "value": ":" + }, + { + "type": "SYMBOL", + "name": "value" + } + ] + }, + { + "type": "SYMBOL", + "name": "value" + } + ] + }, + "subtree_node": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "@" + }, + { + "type": "SYMBOL", + "name": "path" + } + ] + }, + "institution": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "institution" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + "relationship": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "relationship" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT1", + "content": { + "type": "SYMBOL", + "name": "participant" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "participant": { + "type": "CHOICE", + "members": [ + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "path" + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "path" + }, + { + "type": "STRING", + "value": "as" + }, + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + { + "type": "SYMBOL", + "name": "path" + } + ] + }, + "location": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "location" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "SYMBOL", + "name": "block" + } + ] + }, + "species": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "species" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "include" + } + }, + { + "type": "REPEAT", + "content": { + "type": "SYMBOL", + "name": "field" + } + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "enum_declaration": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "enum" + }, + { + "type": "FIELD", + "name": "name", + "content": { + "type": "SYMBOL", + "name": "identifier" + } + }, + { + "type": "STRING", + "value": "{" + }, + { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "identifier" + }, + { + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + }, + { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "BLANK" + } + ] + } + ] + }, + { + "type": "STRING", + "value": "}" + } + ] + }, + "expression": { + "type": "CHOICE", + "members": [ + { + "type": "SYMBOL", + "name": "or_expression" + }, + { + "type": "SYMBOL", + "name": "and_expression" + }, + { + "type": "SYMBOL", + "name": "not_expression" + }, + { + "type": "SYMBOL", + "name": "comparison" + }, + { + "type": "SYMBOL", + "name": "field_access" + }, + { + "type": "SYMBOL", + "name": "primary_expression" + } + ] + }, + "or_expression": { + "type": "PREC_LEFT", + "value": 1, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "STRING", + "value": "or" + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + } + }, + "and_expression": { + "type": "PREC_LEFT", + "value": 2, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "STRING", + "value": "and" + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + } + }, + "not_expression": { + "type": "PREC", + "value": 3, + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "not" + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + } + }, + "comparison": { + "type": "PREC_LEFT", + "value": 4, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "FIELD", + "name": "operator", + "content": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "is" + }, + { + "type": "STRING", + "value": ">" + }, + { + "type": "STRING", + "value": ">=" + }, + { + "type": "STRING", + "value": "<" + }, + { + "type": "STRING", + "value": "<=" + } + ] + } + }, + { + "type": "SYMBOL", + "name": "expression" + } + ] + } + }, + "field_access": { + "type": "PREC_LEFT", + "value": 5, + "content": { + "type": "SEQ", + "members": [ + { + "type": "SYMBOL", + "name": "expression" + }, + { + "type": "STRING", + "value": "." + }, + { + "type": "SYMBOL", + "name": "identifier" + } + ] + } + }, + "primary_expression": { + "type": "CHOICE", + "members": [ + { + "type": "STRING", + "value": "self" + }, + { + "type": "STRING", + "value": "other" + }, + { + "type": "SYMBOL", + "name": "integer" + }, + { + "type": "SYMBOL", + "name": "float" + }, + { + "type": "SYMBOL", + "name": "string" + }, + { + "type": "SYMBOL", + "name": "boolean" + }, + { + "type": "SYMBOL", + "name": "path" + } + ] + }, + "identifier": { + "type": "PATTERN", + "value": "[a-zA-Z_][a-zA-Z0-9_]*" + } + }, + "extras": [ + { + "type": "PATTERN", + "value": "\\s" + }, + { + "type": "SYMBOL", + "name": "line_comment" + }, + { + "type": "SYMBOL", + "name": "block_comment" + } + ], + "conflicts": [ + [ + "path_segments" + ] + ], + "precedences": [], + "externals": [], + "inline": [], + "supertypes": [] +} + diff --git a/tree-sitter-storybook/src/node-types.json b/tree-sitter-storybook/src/node-types.json new file mode 100644 index 0000000..8bf47d1 --- /dev/null +++ b/tree-sitter-storybook/src/node-types.json @@ -0,0 +1,1401 @@ +[ + { + "type": "action_node", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "action_param", + "named": true + }, + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "action_param", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "dotted_path", + "named": true + }, + { + "type": "value", + "named": true + } + ] + } + }, + { + "type": "and_expression", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "arc_state", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "on_enter", + "named": true + }, + { + "type": "transition", + "named": true + } + ] + } + }, + { + "type": "behavior", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + }, + "root": { + "multiple": false, + "required": true, + "types": [ + { + "type": "behavior_node", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + } + ] + } + }, + { + "type": "behavior_node", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "action_node", + "named": true + }, + { + "type": "repeat_node", + "named": true + }, + { + "type": "selector_node", + "named": true + }, + { + "type": "sequence_node", + "named": true + }, + { + "type": "subtree_node", + "named": true + } + ] + } + }, + { + "type": "block", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + } + ] + } + }, + { + "type": "boolean", + "named": true, + "fields": {} + }, + { + "type": "character", + "named": true, + "fields": { + "body": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + }, + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + }, + "species": { + "multiple": false, + "required": false, + "types": [ + { + "type": "identifier", + "named": true + } + ] + }, + "template": { + "multiple": false, + "required": false, + "types": [ + { + "type": "template_clause", + "named": true + } + ] + } + } + }, + { + "type": "comparison", + "named": true, + "fields": { + "operator": { + "multiple": false, + "required": true, + "types": [ + { + "type": "<", + "named": false + }, + { + "type": "<=", + "named": false + }, + { + "type": ">", + "named": false + }, + { + "type": ">=", + "named": false + }, + { + "type": "is", + "named": false + } + ] + } + }, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "declaration", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "behavior", + "named": true + }, + { + "type": "character", + "named": true + }, + { + "type": "enum_declaration", + "named": true + }, + { + "type": "institution", + "named": true + }, + { + "type": "life_arc", + "named": true + }, + { + "type": "location", + "named": true + }, + { + "type": "relationship", + "named": true + }, + { + "type": "schedule", + "named": true + }, + { + "type": "species", + "named": true + }, + { + "type": "template", + "named": true + }, + { + "type": "use_declaration", + "named": true + } + ] + } + }, + { + "type": "dotted_path", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "enum_declaration", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "expression", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "and_expression", + "named": true + }, + { + "type": "comparison", + "named": true + }, + { + "type": "field_access", + "named": true + }, + { + "type": "not_expression", + "named": true + }, + { + "type": "or_expression", + "named": true + }, + { + "type": "primary_expression", + "named": true + } + ] + } + }, + { + "type": "field", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": false, + "types": [ + { + "type": "dotted_path", + "named": true + } + ] + }, + "value": { + "multiple": false, + "required": false, + "types": [ + { + "type": "value", + "named": true + } + ] + } + }, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "prose_block", + "named": true + } + ] + } + }, + { + "type": "field_access", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "expression", + "named": true + }, + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "include", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "institution", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + } + }, + { + "type": "life_arc", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "arc_state", + "named": true + }, + { + "type": "field", + "named": true + } + ] + } + }, + { + "type": "list", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "value", + "named": true + } + ] + } + }, + { + "type": "location", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + } + }, + { + "type": "not_expression", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "object", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + } + }, + { + "type": "on_enter", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + } + }, + { + "type": "or_expression", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + } + }, + { + "type": "override", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "override_op", + "named": true + }, + { + "type": "path", + "named": true + } + ] + } + }, + { + "type": "override_op", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "participant", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "block", + "named": true + }, + { + "type": "identifier", + "named": true + }, + { + "type": "path", + "named": true + } + ] + } + }, + { + "type": "path", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "path_segments", + "named": true + } + ] + } + }, + { + "type": "path_segments", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "primary_expression", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": false, + "types": [ + { + "type": "boolean", + "named": true + }, + { + "type": "float", + "named": true + }, + { + "type": "integer", + "named": true + }, + { + "type": "path", + "named": true + }, + { + "type": "string", + "named": true + } + ] + } + }, + { + "type": "prose_block", + "named": true, + "fields": { + "content": { + "multiple": false, + "required": true, + "types": [ + { + "type": "prose_content", + "named": true + } + ] + }, + "end": { + "multiple": false, + "required": true, + "types": [ + { + "type": "prose_marker", + "named": true + } + ] + }, + "marker": { + "multiple": false, + "required": true, + "types": [ + { + "type": "prose_marker", + "named": true + } + ] + }, + "tag": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + } + }, + { + "type": "range", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "float", + "named": true + }, + { + "type": "integer", + "named": true + } + ] + } + }, + { + "type": "relationship", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "participant", + "named": true + } + ] + } + }, + { + "type": "repeat_node", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "behavior_node", + "named": true + } + ] + } + }, + { + "type": "schedule", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "schedule_block", + "named": true + } + ] + } + }, + { + "type": "schedule_block", + "named": true, + "fields": { + "activity": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + }, + "end": { + "multiple": false, + "required": true, + "types": [ + { + "type": "time", + "named": true + } + ] + }, + "start": { + "multiple": false, + "required": true, + "types": [ + { + "type": "time", + "named": true + } + ] + } + }, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "block", + "named": true + } + ] + } + }, + { + "type": "selector_node", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "behavior_node", + "named": true + } + ] + } + }, + { + "type": "sequence_node", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "behavior_node", + "named": true + } + ] + } + }, + { + "type": "source_file", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "declaration", + "named": true + } + ] + } + }, + { + "type": "species", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "include", + "named": true + } + ] + } + }, + { + "type": "subtree_node", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "path", + "named": true + } + ] + } + }, + { + "type": "template", + "named": true, + "fields": { + "name": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "field", + "named": true + }, + { + "type": "include", + "named": true + } + ] + } + }, + { + "type": "template_clause", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + }, + { + "type": "transition", + "named": true, + "fields": { + "condition": { + "multiple": false, + "required": true, + "types": [ + { + "type": "expression", + "named": true + } + ] + }, + "target": { + "multiple": false, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + } + ] + } + } + }, + { + "type": "use_declaration", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": true, + "types": [ + { + "type": "identifier", + "named": true + }, + { + "type": "path_segments", + "named": true + } + ] + } + }, + { + "type": "value", + "named": true, + "fields": {}, + "children": { + "multiple": false, + "required": true, + "types": [ + { + "type": "boolean", + "named": true + }, + { + "type": "duration", + "named": true + }, + { + "type": "float", + "named": true + }, + { + "type": "integer", + "named": true + }, + { + "type": "list", + "named": true + }, + { + "type": "object", + "named": true + }, + { + "type": "override", + "named": true + }, + { + "type": "path", + "named": true + }, + { + "type": "prose_block", + "named": true + }, + { + "type": "range", + "named": true + }, + { + "type": "string", + "named": true + }, + { + "type": "time", + "named": true + } + ] + } + }, + { + "type": "(", + "named": false + }, + { + "type": ")", + "named": false + }, + { + "type": "*", + "named": false + }, + { + "type": ",", + "named": false + }, + { + "type": "->", + "named": false + }, + { + "type": ".", + "named": false + }, + { + "type": "..", + "named": false + }, + { + "type": ":", + "named": false + }, + { + "type": "::", + "named": false + }, + { + "type": ";", + "named": false + }, + { + "type": "<", + "named": false + }, + { + "type": "<=", + "named": false + }, + { + "type": ">", + "named": false + }, + { + "type": ">=", + "named": false + }, + { + "type": "?", + "named": false + }, + { + "type": "@", + "named": false + }, + { + "type": "[", + "named": false + }, + { + "type": "]", + "named": false + }, + { + "type": "and", + "named": false + }, + { + "type": "append", + "named": false + }, + { + "type": "as", + "named": false + }, + { + "type": "behavior", + "named": false + }, + { + "type": "block_comment", + "named": true + }, + { + "type": "character", + "named": false + }, + { + "type": "duration", + "named": true + }, + { + "type": "enter", + "named": false + }, + { + "type": "enum", + "named": false + }, + { + "type": "false", + "named": false + }, + { + "type": "float", + "named": true + }, + { + "type": "from", + "named": false + }, + { + "type": "identifier", + "named": true + }, + { + "type": "include", + "named": false + }, + { + "type": "institution", + "named": false + }, + { + "type": "integer", + "named": true + }, + { + "type": "is", + "named": false + }, + { + "type": "life_arc", + "named": false + }, + { + "type": "line_comment", + "named": true + }, + { + "type": "location", + "named": false + }, + { + "type": "not", + "named": false + }, + { + "type": "on", + "named": false + }, + { + "type": "or", + "named": false + }, + { + "type": "other", + "named": false + }, + { + "type": "prose_content", + "named": true + }, + { + "type": "prose_marker", + "named": true + }, + { + "type": "relationship", + "named": false + }, + { + "type": "remove", + "named": false + }, + { + "type": "schedule", + "named": false + }, + { + "type": "self", + "named": false + }, + { + "type": "species", + "named": false + }, + { + "type": "state", + "named": false + }, + { + "type": "strict", + "named": false + }, + { + "type": "string", + "named": true + }, + { + "type": "template", + "named": false + }, + { + "type": "time", + "named": true + }, + { + "type": "true", + "named": false + }, + { + "type": "use", + "named": false + }, + { + "type": "{", + "named": false + }, + { + "type": "}", + "named": false + } +] \ No newline at end of file diff --git a/tree-sitter-storybook/src/parser.c b/tree-sitter-storybook/src/parser.c new file mode 100644 index 0000000..a0b8606 --- /dev/null +++ b/tree-sitter-storybook/src/parser.c @@ -0,0 +1,7086 @@ +#include + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#define LANGUAGE_VERSION 14 +#define STATE_COUNT 258 +#define LARGE_STATE_COUNT 2 +#define SYMBOL_COUNT 121 +#define ALIAS_COUNT 0 +#define TOKEN_COUNT 60 +#define EXTERNAL_TOKEN_COUNT 0 +#define FIELD_COUNT 15 +#define MAX_ALIAS_SEQUENCE_LENGTH 9 +#define PRODUCTION_ID_COUNT 14 + +enum { + sym_identifier = 1, + sym_line_comment = 2, + sym_block_comment = 3, + anon_sym_use = 4, + anon_sym_COLON_COLON = 5, + anon_sym_LBRACE = 6, + anon_sym_COMMA = 7, + anon_sym_RBRACE = 8, + anon_sym_STAR = 9, + anon_sym_SEMI = 10, + anon_sym_character = 11, + anon_sym_COLON = 12, + anon_sym_from = 13, + anon_sym_template = 14, + anon_sym_strict = 15, + anon_sym_include = 16, + anon_sym_DOT = 17, + sym_integer = 18, + sym_float = 19, + sym_string = 20, + anon_sym_true = 21, + anon_sym_false = 22, + anon_sym_DOT_DOT = 23, + sym_time = 24, + sym_duration = 25, + anon_sym_LBRACK = 26, + anon_sym_RBRACK = 27, + anon_sym_AT = 28, + anon_sym_remove = 29, + anon_sym_append = 30, + aux_sym_prose_block_token1 = 31, + sym_prose_marker = 32, + sym_prose_content = 33, + anon_sym_life_arc = 34, + anon_sym_state = 35, + anon_sym_on = 36, + anon_sym_enter = 37, + anon_sym_DASH_GT = 38, + anon_sym_schedule = 39, + anon_sym_behavior = 40, + anon_sym_QMARK = 41, + anon_sym_GT = 42, + anon_sym_LPAREN = 43, + anon_sym_RPAREN = 44, + anon_sym_institution = 45, + anon_sym_relationship = 46, + anon_sym_as = 47, + anon_sym_location = 48, + anon_sym_species = 49, + anon_sym_enum = 50, + anon_sym_or = 51, + anon_sym_and = 52, + anon_sym_not = 53, + anon_sym_is = 54, + anon_sym_GT_EQ = 55, + anon_sym_LT = 56, + anon_sym_LT_EQ = 57, + anon_sym_self = 58, + anon_sym_other = 59, + sym_source_file = 60, + sym_declaration = 61, + sym_use_declaration = 62, + sym_path = 63, + sym_path_segments = 64, + sym_character = 65, + sym_template_clause = 66, + sym_template = 67, + sym_include = 68, + sym_field = 69, + sym_dotted_path = 70, + sym_value = 71, + sym_boolean = 72, + sym_range = 73, + sym_list = 74, + sym_object = 75, + sym_block = 76, + sym_override = 77, + sym_override_op = 78, + sym_prose_block = 79, + sym_life_arc = 80, + sym_arc_state = 81, + sym_on_enter = 82, + sym_transition = 83, + sym_schedule = 84, + sym_schedule_block = 85, + sym_behavior = 86, + sym_behavior_node = 87, + sym_selector_node = 88, + sym_sequence_node = 89, + sym_repeat_node = 90, + sym_action_node = 91, + sym_action_param = 92, + sym_subtree_node = 93, + sym_institution = 94, + sym_relationship = 95, + sym_participant = 96, + sym_location = 97, + sym_species = 98, + sym_enum_declaration = 99, + sym_expression = 100, + sym_or_expression = 101, + sym_and_expression = 102, + sym_not_expression = 103, + sym_comparison = 104, + sym_field_access = 105, + sym_primary_expression = 106, + aux_sym_source_file_repeat1 = 107, + aux_sym_use_declaration_repeat1 = 108, + aux_sym_path_segments_repeat1 = 109, + aux_sym_template_repeat1 = 110, + aux_sym_template_repeat2 = 111, + aux_sym_dotted_path_repeat1 = 112, + aux_sym_list_repeat1 = 113, + aux_sym_override_repeat1 = 114, + aux_sym_life_arc_repeat1 = 115, + aux_sym_arc_state_repeat1 = 116, + aux_sym_schedule_repeat1 = 117, + aux_sym_selector_node_repeat1 = 118, + aux_sym_action_node_repeat1 = 119, + aux_sym_relationship_repeat1 = 120, +}; + +static const char * const ts_symbol_names[] = { + [ts_builtin_sym_end] = "end", + [sym_identifier] = "identifier", + [sym_line_comment] = "line_comment", + [sym_block_comment] = "block_comment", + [anon_sym_use] = "use", + [anon_sym_COLON_COLON] = "::", + [anon_sym_LBRACE] = "{", + [anon_sym_COMMA] = ",", + [anon_sym_RBRACE] = "}", + [anon_sym_STAR] = "*", + [anon_sym_SEMI] = ";", + [anon_sym_character] = "character", + [anon_sym_COLON] = ":", + [anon_sym_from] = "from", + [anon_sym_template] = "template", + [anon_sym_strict] = "strict", + [anon_sym_include] = "include", + [anon_sym_DOT] = ".", + [sym_integer] = "integer", + [sym_float] = "float", + [sym_string] = "string", + [anon_sym_true] = "true", + [anon_sym_false] = "false", + [anon_sym_DOT_DOT] = "..", + [sym_time] = "time", + [sym_duration] = "duration", + [anon_sym_LBRACK] = "[", + [anon_sym_RBRACK] = "]", + [anon_sym_AT] = "@", + [anon_sym_remove] = "remove", + [anon_sym_append] = "append", + [aux_sym_prose_block_token1] = "prose_block_token1", + [sym_prose_marker] = "prose_marker", + [sym_prose_content] = "prose_content", + [anon_sym_life_arc] = "life_arc", + [anon_sym_state] = "state", + [anon_sym_on] = "on", + [anon_sym_enter] = "enter", + [anon_sym_DASH_GT] = "->", + [anon_sym_schedule] = "schedule", + [anon_sym_behavior] = "behavior", + [anon_sym_QMARK] = "\?", + [anon_sym_GT] = ">", + [anon_sym_LPAREN] = "(", + [anon_sym_RPAREN] = ")", + [anon_sym_institution] = "institution", + [anon_sym_relationship] = "relationship", + [anon_sym_as] = "as", + [anon_sym_location] = "location", + [anon_sym_species] = "species", + [anon_sym_enum] = "enum", + [anon_sym_or] = "or", + [anon_sym_and] = "and", + [anon_sym_not] = "not", + [anon_sym_is] = "is", + [anon_sym_GT_EQ] = ">=", + [anon_sym_LT] = "<", + [anon_sym_LT_EQ] = "<=", + [anon_sym_self] = "self", + [anon_sym_other] = "other", + [sym_source_file] = "source_file", + [sym_declaration] = "declaration", + [sym_use_declaration] = "use_declaration", + [sym_path] = "path", + [sym_path_segments] = "path_segments", + [sym_character] = "character", + [sym_template_clause] = "template_clause", + [sym_template] = "template", + [sym_include] = "include", + [sym_field] = "field", + [sym_dotted_path] = "dotted_path", + [sym_value] = "value", + [sym_boolean] = "boolean", + [sym_range] = "range", + [sym_list] = "list", + [sym_object] = "object", + [sym_block] = "block", + [sym_override] = "override", + [sym_override_op] = "override_op", + [sym_prose_block] = "prose_block", + [sym_life_arc] = "life_arc", + [sym_arc_state] = "arc_state", + [sym_on_enter] = "on_enter", + [sym_transition] = "transition", + [sym_schedule] = "schedule", + [sym_schedule_block] = "schedule_block", + [sym_behavior] = "behavior", + [sym_behavior_node] = "behavior_node", + [sym_selector_node] = "selector_node", + [sym_sequence_node] = "sequence_node", + [sym_repeat_node] = "repeat_node", + [sym_action_node] = "action_node", + [sym_action_param] = "action_param", + [sym_subtree_node] = "subtree_node", + [sym_institution] = "institution", + [sym_relationship] = "relationship", + [sym_participant] = "participant", + [sym_location] = "location", + [sym_species] = "species", + [sym_enum_declaration] = "enum_declaration", + [sym_expression] = "expression", + [sym_or_expression] = "or_expression", + [sym_and_expression] = "and_expression", + [sym_not_expression] = "not_expression", + [sym_comparison] = "comparison", + [sym_field_access] = "field_access", + [sym_primary_expression] = "primary_expression", + [aux_sym_source_file_repeat1] = "source_file_repeat1", + [aux_sym_use_declaration_repeat1] = "use_declaration_repeat1", + [aux_sym_path_segments_repeat1] = "path_segments_repeat1", + [aux_sym_template_repeat1] = "template_repeat1", + [aux_sym_template_repeat2] = "template_repeat2", + [aux_sym_dotted_path_repeat1] = "dotted_path_repeat1", + [aux_sym_list_repeat1] = "list_repeat1", + [aux_sym_override_repeat1] = "override_repeat1", + [aux_sym_life_arc_repeat1] = "life_arc_repeat1", + [aux_sym_arc_state_repeat1] = "arc_state_repeat1", + [aux_sym_schedule_repeat1] = "schedule_repeat1", + [aux_sym_selector_node_repeat1] = "selector_node_repeat1", + [aux_sym_action_node_repeat1] = "action_node_repeat1", + [aux_sym_relationship_repeat1] = "relationship_repeat1", +}; + +static const TSSymbol ts_symbol_map[] = { + [ts_builtin_sym_end] = ts_builtin_sym_end, + [sym_identifier] = sym_identifier, + [sym_line_comment] = sym_line_comment, + [sym_block_comment] = sym_block_comment, + [anon_sym_use] = anon_sym_use, + [anon_sym_COLON_COLON] = anon_sym_COLON_COLON, + [anon_sym_LBRACE] = anon_sym_LBRACE, + [anon_sym_COMMA] = anon_sym_COMMA, + [anon_sym_RBRACE] = anon_sym_RBRACE, + [anon_sym_STAR] = anon_sym_STAR, + [anon_sym_SEMI] = anon_sym_SEMI, + [anon_sym_character] = anon_sym_character, + [anon_sym_COLON] = anon_sym_COLON, + [anon_sym_from] = anon_sym_from, + [anon_sym_template] = anon_sym_template, + [anon_sym_strict] = anon_sym_strict, + [anon_sym_include] = anon_sym_include, + [anon_sym_DOT] = anon_sym_DOT, + [sym_integer] = sym_integer, + [sym_float] = sym_float, + [sym_string] = sym_string, + [anon_sym_true] = anon_sym_true, + [anon_sym_false] = anon_sym_false, + [anon_sym_DOT_DOT] = anon_sym_DOT_DOT, + [sym_time] = sym_time, + [sym_duration] = sym_duration, + [anon_sym_LBRACK] = anon_sym_LBRACK, + [anon_sym_RBRACK] = anon_sym_RBRACK, + [anon_sym_AT] = anon_sym_AT, + [anon_sym_remove] = anon_sym_remove, + [anon_sym_append] = anon_sym_append, + [aux_sym_prose_block_token1] = aux_sym_prose_block_token1, + [sym_prose_marker] = sym_prose_marker, + [sym_prose_content] = sym_prose_content, + [anon_sym_life_arc] = anon_sym_life_arc, + [anon_sym_state] = anon_sym_state, + [anon_sym_on] = anon_sym_on, + [anon_sym_enter] = anon_sym_enter, + [anon_sym_DASH_GT] = anon_sym_DASH_GT, + [anon_sym_schedule] = anon_sym_schedule, + [anon_sym_behavior] = anon_sym_behavior, + [anon_sym_QMARK] = anon_sym_QMARK, + [anon_sym_GT] = anon_sym_GT, + [anon_sym_LPAREN] = anon_sym_LPAREN, + [anon_sym_RPAREN] = anon_sym_RPAREN, + [anon_sym_institution] = anon_sym_institution, + [anon_sym_relationship] = anon_sym_relationship, + [anon_sym_as] = anon_sym_as, + [anon_sym_location] = anon_sym_location, + [anon_sym_species] = anon_sym_species, + [anon_sym_enum] = anon_sym_enum, + [anon_sym_or] = anon_sym_or, + [anon_sym_and] = anon_sym_and, + [anon_sym_not] = anon_sym_not, + [anon_sym_is] = anon_sym_is, + [anon_sym_GT_EQ] = anon_sym_GT_EQ, + [anon_sym_LT] = anon_sym_LT, + [anon_sym_LT_EQ] = anon_sym_LT_EQ, + [anon_sym_self] = anon_sym_self, + [anon_sym_other] = anon_sym_other, + [sym_source_file] = sym_source_file, + [sym_declaration] = sym_declaration, + [sym_use_declaration] = sym_use_declaration, + [sym_path] = sym_path, + [sym_path_segments] = sym_path_segments, + [sym_character] = sym_character, + [sym_template_clause] = sym_template_clause, + [sym_template] = sym_template, + [sym_include] = sym_include, + [sym_field] = sym_field, + [sym_dotted_path] = sym_dotted_path, + [sym_value] = sym_value, + [sym_boolean] = sym_boolean, + [sym_range] = sym_range, + [sym_list] = sym_list, + [sym_object] = sym_object, + [sym_block] = sym_block, + [sym_override] = sym_override, + [sym_override_op] = sym_override_op, + [sym_prose_block] = sym_prose_block, + [sym_life_arc] = sym_life_arc, + [sym_arc_state] = sym_arc_state, + [sym_on_enter] = sym_on_enter, + [sym_transition] = sym_transition, + [sym_schedule] = sym_schedule, + [sym_schedule_block] = sym_schedule_block, + [sym_behavior] = sym_behavior, + [sym_behavior_node] = sym_behavior_node, + [sym_selector_node] = sym_selector_node, + [sym_sequence_node] = sym_sequence_node, + [sym_repeat_node] = sym_repeat_node, + [sym_action_node] = sym_action_node, + [sym_action_param] = sym_action_param, + [sym_subtree_node] = sym_subtree_node, + [sym_institution] = sym_institution, + [sym_relationship] = sym_relationship, + [sym_participant] = sym_participant, + [sym_location] = sym_location, + [sym_species] = sym_species, + [sym_enum_declaration] = sym_enum_declaration, + [sym_expression] = sym_expression, + [sym_or_expression] = sym_or_expression, + [sym_and_expression] = sym_and_expression, + [sym_not_expression] = sym_not_expression, + [sym_comparison] = sym_comparison, + [sym_field_access] = sym_field_access, + [sym_primary_expression] = sym_primary_expression, + [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, + [aux_sym_use_declaration_repeat1] = aux_sym_use_declaration_repeat1, + [aux_sym_path_segments_repeat1] = aux_sym_path_segments_repeat1, + [aux_sym_template_repeat1] = aux_sym_template_repeat1, + [aux_sym_template_repeat2] = aux_sym_template_repeat2, + [aux_sym_dotted_path_repeat1] = aux_sym_dotted_path_repeat1, + [aux_sym_list_repeat1] = aux_sym_list_repeat1, + [aux_sym_override_repeat1] = aux_sym_override_repeat1, + [aux_sym_life_arc_repeat1] = aux_sym_life_arc_repeat1, + [aux_sym_arc_state_repeat1] = aux_sym_arc_state_repeat1, + [aux_sym_schedule_repeat1] = aux_sym_schedule_repeat1, + [aux_sym_selector_node_repeat1] = aux_sym_selector_node_repeat1, + [aux_sym_action_node_repeat1] = aux_sym_action_node_repeat1, + [aux_sym_relationship_repeat1] = aux_sym_relationship_repeat1, +}; + +static const TSSymbolMetadata ts_symbol_metadata[] = { + [ts_builtin_sym_end] = { + .visible = false, + .named = true, + }, + [sym_identifier] = { + .visible = true, + .named = true, + }, + [sym_line_comment] = { + .visible = true, + .named = true, + }, + [sym_block_comment] = { + .visible = true, + .named = true, + }, + [anon_sym_use] = { + .visible = true, + .named = false, + }, + [anon_sym_COLON_COLON] = { + .visible = true, + .named = false, + }, + [anon_sym_LBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_COMMA] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACE] = { + .visible = true, + .named = false, + }, + [anon_sym_STAR] = { + .visible = true, + .named = false, + }, + [anon_sym_SEMI] = { + .visible = true, + .named = false, + }, + [anon_sym_character] = { + .visible = true, + .named = false, + }, + [anon_sym_COLON] = { + .visible = true, + .named = false, + }, + [anon_sym_from] = { + .visible = true, + .named = false, + }, + [anon_sym_template] = { + .visible = true, + .named = false, + }, + [anon_sym_strict] = { + .visible = true, + .named = false, + }, + [anon_sym_include] = { + .visible = true, + .named = false, + }, + [anon_sym_DOT] = { + .visible = true, + .named = false, + }, + [sym_integer] = { + .visible = true, + .named = true, + }, + [sym_float] = { + .visible = true, + .named = true, + }, + [sym_string] = { + .visible = true, + .named = true, + }, + [anon_sym_true] = { + .visible = true, + .named = false, + }, + [anon_sym_false] = { + .visible = true, + .named = false, + }, + [anon_sym_DOT_DOT] = { + .visible = true, + .named = false, + }, + [sym_time] = { + .visible = true, + .named = true, + }, + [sym_duration] = { + .visible = true, + .named = true, + }, + [anon_sym_LBRACK] = { + .visible = true, + .named = false, + }, + [anon_sym_RBRACK] = { + .visible = true, + .named = false, + }, + [anon_sym_AT] = { + .visible = true, + .named = false, + }, + [anon_sym_remove] = { + .visible = true, + .named = false, + }, + [anon_sym_append] = { + .visible = true, + .named = false, + }, + [aux_sym_prose_block_token1] = { + .visible = false, + .named = false, + }, + [sym_prose_marker] = { + .visible = true, + .named = true, + }, + [sym_prose_content] = { + .visible = true, + .named = true, + }, + [anon_sym_life_arc] = { + .visible = true, + .named = false, + }, + [anon_sym_state] = { + .visible = true, + .named = false, + }, + [anon_sym_on] = { + .visible = true, + .named = false, + }, + [anon_sym_enter] = { + .visible = true, + .named = false, + }, + [anon_sym_DASH_GT] = { + .visible = true, + .named = false, + }, + [anon_sym_schedule] = { + .visible = true, + .named = false, + }, + [anon_sym_behavior] = { + .visible = true, + .named = false, + }, + [anon_sym_QMARK] = { + .visible = true, + .named = false, + }, + [anon_sym_GT] = { + .visible = true, + .named = false, + }, + [anon_sym_LPAREN] = { + .visible = true, + .named = false, + }, + [anon_sym_RPAREN] = { + .visible = true, + .named = false, + }, + [anon_sym_institution] = { + .visible = true, + .named = false, + }, + [anon_sym_relationship] = { + .visible = true, + .named = false, + }, + [anon_sym_as] = { + .visible = true, + .named = false, + }, + [anon_sym_location] = { + .visible = true, + .named = false, + }, + [anon_sym_species] = { + .visible = true, + .named = false, + }, + [anon_sym_enum] = { + .visible = true, + .named = false, + }, + [anon_sym_or] = { + .visible = true, + .named = false, + }, + [anon_sym_and] = { + .visible = true, + .named = false, + }, + [anon_sym_not] = { + .visible = true, + .named = false, + }, + [anon_sym_is] = { + .visible = true, + .named = false, + }, + [anon_sym_GT_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_LT] = { + .visible = true, + .named = false, + }, + [anon_sym_LT_EQ] = { + .visible = true, + .named = false, + }, + [anon_sym_self] = { + .visible = true, + .named = false, + }, + [anon_sym_other] = { + .visible = true, + .named = false, + }, + [sym_source_file] = { + .visible = true, + .named = true, + }, + [sym_declaration] = { + .visible = true, + .named = true, + }, + [sym_use_declaration] = { + .visible = true, + .named = true, + }, + [sym_path] = { + .visible = true, + .named = true, + }, + [sym_path_segments] = { + .visible = true, + .named = true, + }, + [sym_character] = { + .visible = true, + .named = true, + }, + [sym_template_clause] = { + .visible = true, + .named = true, + }, + [sym_template] = { + .visible = true, + .named = true, + }, + [sym_include] = { + .visible = true, + .named = true, + }, + [sym_field] = { + .visible = true, + .named = true, + }, + [sym_dotted_path] = { + .visible = true, + .named = true, + }, + [sym_value] = { + .visible = true, + .named = true, + }, + [sym_boolean] = { + .visible = true, + .named = true, + }, + [sym_range] = { + .visible = true, + .named = true, + }, + [sym_list] = { + .visible = true, + .named = true, + }, + [sym_object] = { + .visible = true, + .named = true, + }, + [sym_block] = { + .visible = true, + .named = true, + }, + [sym_override] = { + .visible = true, + .named = true, + }, + [sym_override_op] = { + .visible = true, + .named = true, + }, + [sym_prose_block] = { + .visible = true, + .named = true, + }, + [sym_life_arc] = { + .visible = true, + .named = true, + }, + [sym_arc_state] = { + .visible = true, + .named = true, + }, + [sym_on_enter] = { + .visible = true, + .named = true, + }, + [sym_transition] = { + .visible = true, + .named = true, + }, + [sym_schedule] = { + .visible = true, + .named = true, + }, + [sym_schedule_block] = { + .visible = true, + .named = true, + }, + [sym_behavior] = { + .visible = true, + .named = true, + }, + [sym_behavior_node] = { + .visible = true, + .named = true, + }, + [sym_selector_node] = { + .visible = true, + .named = true, + }, + [sym_sequence_node] = { + .visible = true, + .named = true, + }, + [sym_repeat_node] = { + .visible = true, + .named = true, + }, + [sym_action_node] = { + .visible = true, + .named = true, + }, + [sym_action_param] = { + .visible = true, + .named = true, + }, + [sym_subtree_node] = { + .visible = true, + .named = true, + }, + [sym_institution] = { + .visible = true, + .named = true, + }, + [sym_relationship] = { + .visible = true, + .named = true, + }, + [sym_participant] = { + .visible = true, + .named = true, + }, + [sym_location] = { + .visible = true, + .named = true, + }, + [sym_species] = { + .visible = true, + .named = true, + }, + [sym_enum_declaration] = { + .visible = true, + .named = true, + }, + [sym_expression] = { + .visible = true, + .named = true, + }, + [sym_or_expression] = { + .visible = true, + .named = true, + }, + [sym_and_expression] = { + .visible = true, + .named = true, + }, + [sym_not_expression] = { + .visible = true, + .named = true, + }, + [sym_comparison] = { + .visible = true, + .named = true, + }, + [sym_field_access] = { + .visible = true, + .named = true, + }, + [sym_primary_expression] = { + .visible = true, + .named = true, + }, + [aux_sym_source_file_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_use_declaration_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_path_segments_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_template_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_template_repeat2] = { + .visible = false, + .named = false, + }, + [aux_sym_dotted_path_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_list_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_override_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_life_arc_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_arc_state_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_schedule_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_selector_node_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_action_node_repeat1] = { + .visible = false, + .named = false, + }, + [aux_sym_relationship_repeat1] = { + .visible = false, + .named = false, + }, +}; + +enum { + field_activity = 1, + field_body = 2, + field_condition = 3, + field_content = 4, + field_end = 5, + field_marker = 6, + field_name = 7, + field_operator = 8, + field_root = 9, + field_species = 10, + field_start = 11, + field_tag = 12, + field_target = 13, + field_template = 14, + field_value = 15, +}; + +static const char * const ts_field_names[] = { + [0] = NULL, + [field_activity] = "activity", + [field_body] = "body", + [field_condition] = "condition", + [field_content] = "content", + [field_end] = "end", + [field_marker] = "marker", + [field_name] = "name", + [field_operator] = "operator", + [field_root] = "root", + [field_species] = "species", + [field_start] = "start", + [field_tag] = "tag", + [field_target] = "target", + [field_template] = "template", + [field_value] = "value", +}; + +static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = { + [1] = {.index = 0, .length = 2}, + [2] = {.index = 2, .length = 1}, + [3] = {.index = 3, .length = 3}, + [4] = {.index = 6, .length = 3}, + [5] = {.index = 9, .length = 2}, + [6] = {.index = 11, .length = 2}, + [7] = {.index = 13, .length = 4}, + [8] = {.index = 17, .length = 2}, + [9] = {.index = 19, .length = 4}, + [10] = {.index = 23, .length = 4}, + [11] = {.index = 27, .length = 3}, + [12] = {.index = 30, .length = 2}, + [13] = {.index = 32, .length = 1}, +}; + +static const TSFieldMapEntry ts_field_map_entries[] = { + [0] = + {field_body, 2}, + {field_name, 1}, + [2] = + {field_name, 1}, + [3] = + {field_body, 3}, + {field_name, 1}, + {field_template, 2}, + [6] = + {field_body, 4}, + {field_name, 1}, + {field_species, 3}, + [9] = + {field_name, 1}, + {field_root, 3}, + [11] = + {field_name, 0}, + {field_value, 2}, + [13] = + {field_body, 5}, + {field_name, 1}, + {field_species, 3}, + {field_template, 4}, + [17] = + {field_name, 1}, + {field_root, 4}, + [19] = + {field_content, 2}, + {field_end, 3}, + {field_marker, 0}, + {field_tag, 1}, + [23] = + {field_content, 3}, + {field_end, 4}, + {field_marker, 0}, + {field_tag, 1}, + [27] = + {field_activity, 4}, + {field_end, 2}, + {field_start, 0}, + [30] = + {field_condition, 1}, + {field_target, 3}, + [32] = + {field_operator, 1}, +}; + +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, + [39] = 39, + [40] = 40, + [41] = 41, + [42] = 42, + [43] = 43, + [44] = 44, + [45] = 45, + [46] = 46, + [47] = 47, + [48] = 48, + [49] = 49, + [50] = 50, + [51] = 51, + [52] = 52, + [53] = 53, + [54] = 54, + [55] = 55, + [56] = 56, + [57] = 57, + [58] = 58, + [59] = 59, + [60] = 60, + [61] = 61, + [62] = 62, + [63] = 63, + [64] = 64, + [65] = 65, + [66] = 66, + [67] = 67, + [68] = 68, + [69] = 69, + [70] = 70, + [71] = 71, + [72] = 72, + [73] = 73, + [74] = 74, + [75] = 75, + [76] = 76, + [77] = 77, + [78] = 78, + [79] = 79, + [80] = 80, + [81] = 81, + [82] = 82, + [83] = 83, + [84] = 84, + [85] = 85, + [86] = 86, + [87] = 87, + [88] = 88, + [89] = 89, + [90] = 90, + [91] = 91, + [92] = 92, + [93] = 93, + [94] = 94, + [95] = 95, + [96] = 96, + [97] = 97, + [98] = 98, + [99] = 99, + [100] = 100, + [101] = 101, + [102] = 102, + [103] = 103, + [104] = 104, + [105] = 105, + [106] = 106, + [107] = 107, + [108] = 108, + [109] = 109, + [110] = 110, + [111] = 111, + [112] = 112, + [113] = 113, + [114] = 114, + [115] = 115, + [116] = 116, + [117] = 117, + [118] = 118, + [119] = 119, + [120] = 120, + [121] = 121, + [122] = 122, + [123] = 123, + [124] = 124, + [125] = 125, + [126] = 126, + [127] = 127, + [128] = 128, + [129] = 129, + [130] = 130, + [131] = 131, + [132] = 132, + [133] = 133, + [134] = 134, + [135] = 135, + [136] = 136, + [137] = 137, + [138] = 138, + [139] = 139, + [140] = 140, + [141] = 141, + [142] = 142, + [143] = 143, + [144] = 144, + [145] = 145, + [146] = 146, + [147] = 147, + [148] = 148, + [149] = 149, + [150] = 150, + [151] = 151, + [152] = 152, + [153] = 3, + [154] = 154, + [155] = 155, + [156] = 156, + [157] = 157, + [158] = 158, + [159] = 4, + [160] = 160, + [161] = 161, + [162] = 162, + [163] = 163, + [164] = 164, + [165] = 165, + [166] = 166, + [167] = 167, + [168] = 168, + [169] = 169, + [170] = 170, + [171] = 171, + [172] = 172, + [173] = 173, + [174] = 174, + [175] = 175, + [176] = 176, + [177] = 177, + [178] = 178, + [179] = 179, + [180] = 180, + [181] = 181, + [182] = 182, + [183] = 183, + [184] = 184, + [185] = 185, + [186] = 186, + [187] = 187, + [188] = 188, + [189] = 189, + [190] = 190, + [191] = 191, + [192] = 192, + [193] = 193, + [194] = 194, + [195] = 195, + [196] = 196, + [197] = 197, + [198] = 198, + [199] = 199, + [200] = 200, + [201] = 201, + [202] = 202, + [203] = 203, + [204] = 204, + [205] = 205, + [206] = 206, + [207] = 207, + [208] = 208, + [209] = 209, + [210] = 210, + [211] = 211, + [212] = 212, + [213] = 213, + [214] = 214, + [215] = 215, + [216] = 216, + [217] = 217, + [218] = 218, + [219] = 219, + [220] = 220, + [221] = 221, + [222] = 222, + [223] = 223, + [224] = 224, + [225] = 225, + [226] = 226, + [227] = 227, + [228] = 228, + [229] = 229, + [230] = 230, + [231] = 231, + [232] = 232, + [233] = 233, + [234] = 234, + [235] = 235, + [236] = 236, + [237] = 237, + [238] = 238, + [239] = 239, + [240] = 240, + [241] = 241, + [242] = 242, + [243] = 243, + [244] = 244, + [245] = 245, + [246] = 246, + [247] = 247, + [248] = 248, + [249] = 249, + [250] = 250, + [251] = 251, + [252] = 252, + [253] = 253, + [254] = 254, + [255] = 255, + [256] = 256, + [257] = 257, +}; + +static bool ts_lex(TSLexer *lexer, TSStateId state) { + START_LEXER(); + eof = lexer->eof(lexer); + switch (state) { + case 0: + if (eof) ADVANCE(23); + if (lookahead == '"') ADVANCE(2); + if (lookahead == '(') ADVANCE(80); + if (lookahead == ')') ADVANCE(81); + if (lookahead == '*') ADVANCE(35); + if (lookahead == ',') ADVANCE(33); + if (lookahead == '-') ADVANCE(9); + if (lookahead == '.') ADVANCE(39); + if (lookahead == '/') ADVANCE(4); + if (lookahead == ':') ADVANCE(37); + if (lookahead == ';') ADVANCE(36); + if (lookahead == '<') ADVANCE(83); + if (lookahead == '>') ADVANCE(79); + if (lookahead == '?') ADVANCE(77); + if (lookahead == '@') ADVANCE(57); + if (lookahead == '[') ADVANCE(55); + if (lookahead == ']') ADVANCE(56); + if (lookahead == '{') ADVANCE(32); + if (lookahead == '}') ADVANCE(34); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(0) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(42); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 1: + if (lookahead == '"') ADVANCE(2); + if (lookahead == '(') ADVANCE(80); + if (lookahead == ')') ADVANCE(81); + if (lookahead == '*') ADVANCE(35); + if (lookahead == ',') ADVANCE(33); + if (lookahead == '-') ADVANCE(9); + if (lookahead == '.') ADVANCE(38); + if (lookahead == '/') ADVANCE(4); + if (lookahead == ':') ADVANCE(37); + if (lookahead == ';') ADVANCE(36); + if (lookahead == '<') ADVANCE(83); + if (lookahead == '>') ADVANCE(79); + if (lookahead == '?') ADVANCE(77); + if (lookahead == '@') ADVANCE(57); + if (lookahead == ']') ADVANCE(56); + if (lookahead == '{') ADVANCE(32); + if (lookahead == '}') ADVANCE(34); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(1) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(45); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 2: + if (lookahead == '"') ADVANCE(50); + if (lookahead == '\\') ADVANCE(21); + if (lookahead != 0) ADVANCE(2); + END_STATE(); + case 3: + if (lookahead == ')') ADVANCE(81); + if (lookahead == '*') ADVANCE(35); + if (lookahead == ',') ADVANCE(33); + if (lookahead == '-') ADVANCE(10); + if (lookahead == '.') ADVANCE(14); + if (lookahead == '/') ADVANCE(4); + if (lookahead == '>') ADVANCE(78); + if (lookahead == '?') ADVANCE(77); + if (lookahead == '@') ADVANCE(57); + if (lookahead == ']') ADVANCE(56); + if (lookahead == '}') ADVANCE(34); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(3) + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(47); + if (('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + case 4: + if (lookahead == '*') ADVANCE(6); + if (lookahead == '/') ADVANCE(27); + END_STATE(); + case 5: + if (lookahead == '*') ADVANCE(5); + if (lookahead == '/') ADVANCE(28); + if (lookahead != 0) ADVANCE(6); + END_STATE(); + case 6: + if (lookahead == '*') ADVANCE(5); + if (lookahead != 0) ADVANCE(6); + END_STATE(); + case 7: + if (lookahead == '*') ADVANCE(72); + if (lookahead == '-') ADVANCE(6); + if (lookahead != 0) ADVANCE(73); + END_STATE(); + case 8: + if (lookahead == '*') ADVANCE(72); + if (lookahead == '-') ADVANCE(7); + if (lookahead != 0) ADVANCE(73); + END_STATE(); + case 9: + if (lookahead == '-') ADVANCE(11); + if (lookahead == '>') ADVANCE(76); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(44); + END_STATE(); + case 10: + if (lookahead == '-') ADVANCE(11); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(48); + END_STATE(); + case 11: + if (lookahead == '-') ADVANCE(70); + END_STATE(); + case 12: + if (lookahead == '-') ADVANCE(13); + if (lookahead == '/') ADVANCE(71); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(74); + if (lookahead != 0) ADVANCE(75); + END_STATE(); + case 13: + if (lookahead == '-') ADVANCE(22); + if (lookahead != 0) ADVANCE(75); + END_STATE(); + case 14: + if (lookahead == '.') ADVANCE(51); + END_STATE(); + case 15: + if (lookahead == 'h' || + lookahead == 'm' || + lookahead == 's') ADVANCE(54); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(15); + END_STATE(); + case 16: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(49); + END_STATE(); + case 17: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(53); + END_STATE(); + case 18: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52); + END_STATE(); + case 19: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(17); + END_STATE(); + case 20: + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(18); + END_STATE(); + case 21: + if (lookahead != 0 && + lookahead != '\n') ADVANCE(2); + END_STATE(); + case 22: + if (lookahead != 0 && + lookahead != '-') ADVANCE(75); + END_STATE(); + case 23: + ACCEPT_TOKEN(ts_builtin_sym_end); + END_STATE(); + case 24: + ACCEPT_TOKEN(sym_line_comment); + if (lookahead == '-') ADVANCE(27); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(26); + END_STATE(); + case 25: + ACCEPT_TOKEN(sym_line_comment); + if (lookahead == '-') ADVANCE(24); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(26); + END_STATE(); + case 26: + ACCEPT_TOKEN(sym_line_comment); + if (lookahead == '-') ADVANCE(25); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(26); + END_STATE(); + case 27: + ACCEPT_TOKEN(sym_line_comment); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(27); + END_STATE(); + case 28: + ACCEPT_TOKEN(sym_block_comment); + END_STATE(); + case 29: + ACCEPT_TOKEN(sym_block_comment); + if (lookahead == '-') ADVANCE(68); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(66); + END_STATE(); + case 30: + ACCEPT_TOKEN(sym_block_comment); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(69); + END_STATE(); + case 31: + ACCEPT_TOKEN(anon_sym_COLON_COLON); + END_STATE(); + case 32: + ACCEPT_TOKEN(anon_sym_LBRACE); + END_STATE(); + case 33: + ACCEPT_TOKEN(anon_sym_COMMA); + END_STATE(); + case 34: + ACCEPT_TOKEN(anon_sym_RBRACE); + END_STATE(); + case 35: + ACCEPT_TOKEN(anon_sym_STAR); + END_STATE(); + case 36: + ACCEPT_TOKEN(anon_sym_SEMI); + END_STATE(); + case 37: + ACCEPT_TOKEN(anon_sym_COLON); + if (lookahead == ':') ADVANCE(31); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_DOT); + END_STATE(); + case 39: + ACCEPT_TOKEN(anon_sym_DOT); + if (lookahead == '.') ADVANCE(51); + END_STATE(); + case 40: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (lookahead == ':') ADVANCE(19); + if (lookahead == 'h' || + lookahead == 'm' || + lookahead == 's') ADVANCE(54); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(43); + END_STATE(); + case 41: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (lookahead == ':') ADVANCE(19); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(44); + END_STATE(); + case 42: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (lookahead == 'h' || + lookahead == 'm' || + lookahead == 's') ADVANCE(54); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(40); + END_STATE(); + case 43: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (lookahead == 'h' || + lookahead == 'm' || + lookahead == 's') ADVANCE(54); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(43); + END_STATE(); + case 44: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(44); + END_STATE(); + case 45: + ACCEPT_TOKEN(sym_integer); + if (lookahead == '.') ADVANCE(16); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(41); + END_STATE(); + case 46: + ACCEPT_TOKEN(sym_integer); + if (lookahead == ':') ADVANCE(19); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(48); + END_STATE(); + case 47: + ACCEPT_TOKEN(sym_integer); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(46); + END_STATE(); + case 48: + ACCEPT_TOKEN(sym_integer); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(48); + END_STATE(); + case 49: + ACCEPT_TOKEN(sym_float); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(49); + END_STATE(); + case 50: + ACCEPT_TOKEN(sym_string); + END_STATE(); + case 51: + ACCEPT_TOKEN(anon_sym_DOT_DOT); + END_STATE(); + case 52: + ACCEPT_TOKEN(sym_time); + END_STATE(); + case 53: + ACCEPT_TOKEN(sym_time); + if (lookahead == ':') ADVANCE(20); + END_STATE(); + case 54: + ACCEPT_TOKEN(sym_duration); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(15); + END_STATE(); + case 55: + ACCEPT_TOKEN(anon_sym_LBRACK); + END_STATE(); + case 56: + ACCEPT_TOKEN(anon_sym_RBRACK); + END_STATE(); + case 57: + ACCEPT_TOKEN(anon_sym_AT); + END_STATE(); + case 58: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(6); + if (lookahead == '*') ADVANCE(58); + if (lookahead == '/') ADVANCE(30); + if (lookahead != 0) ADVANCE(59); + END_STATE(); + case 59: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(6); + if (lookahead == '*') ADVANCE(58); + if (lookahead != 0) ADVANCE(59); + END_STATE(); + case 60: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(60); + if (lookahead == '-') ADVANCE(68); + if (lookahead == '/') ADVANCE(65); + if (lookahead == '\t' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(60); + if (lookahead != 0) ADVANCE(66); + END_STATE(); + case 61: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(73); + if (lookahead == '*') ADVANCE(63); + if (lookahead == '-') ADVANCE(59); + if (lookahead != 0) ADVANCE(64); + END_STATE(); + case 62: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(73); + if (lookahead == '*') ADVANCE(63); + if (lookahead == '-') ADVANCE(61); + if (lookahead != 0) ADVANCE(64); + END_STATE(); + case 63: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(73); + if (lookahead == '*') ADVANCE(63); + if (lookahead == '-') ADVANCE(62); + if (lookahead == '/') ADVANCE(29); + if (lookahead != 0) ADVANCE(64); + END_STATE(); + case 64: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '\n') ADVANCE(73); + if (lookahead == '*') ADVANCE(63); + if (lookahead == '-') ADVANCE(62); + if (lookahead != 0) ADVANCE(64); + END_STATE(); + case 65: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '*') ADVANCE(64); + if (lookahead == '-') ADVANCE(68); + if (lookahead == '/') ADVANCE(26); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(66); + END_STATE(); + case 66: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '-') ADVANCE(68); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(66); + END_STATE(); + case 67: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '-') ADVANCE(69); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(66); + END_STATE(); + case 68: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead == '-') ADVANCE(67); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(66); + END_STATE(); + case 69: + ACCEPT_TOKEN(aux_sym_prose_block_token1); + if (lookahead != 0 && + lookahead != '\n') ADVANCE(69); + END_STATE(); + case 70: + ACCEPT_TOKEN(sym_prose_marker); + END_STATE(); + case 71: + ACCEPT_TOKEN(sym_prose_content); + if (lookahead == '*') ADVANCE(73); + if (lookahead == '-') ADVANCE(13); + if (lookahead == '/') ADVANCE(26); + if (lookahead != 0) ADVANCE(75); + END_STATE(); + case 72: + ACCEPT_TOKEN(sym_prose_content); + if (lookahead == '*') ADVANCE(72); + if (lookahead == '-') ADVANCE(8); + if (lookahead == '/') ADVANCE(28); + if (lookahead != 0) ADVANCE(73); + END_STATE(); + case 73: + ACCEPT_TOKEN(sym_prose_content); + if (lookahead == '*') ADVANCE(72); + if (lookahead == '-') ADVANCE(8); + if (lookahead != 0) ADVANCE(73); + END_STATE(); + case 74: + ACCEPT_TOKEN(sym_prose_content); + if (lookahead == '-') ADVANCE(13); + if (lookahead == '/') ADVANCE(71); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(74); + if (lookahead != 0) ADVANCE(75); + END_STATE(); + case 75: + ACCEPT_TOKEN(sym_prose_content); + if (lookahead == '-') ADVANCE(13); + if (lookahead != 0) ADVANCE(75); + END_STATE(); + case 76: + ACCEPT_TOKEN(anon_sym_DASH_GT); + END_STATE(); + case 77: + ACCEPT_TOKEN(anon_sym_QMARK); + END_STATE(); + case 78: + ACCEPT_TOKEN(anon_sym_GT); + END_STATE(); + case 79: + ACCEPT_TOKEN(anon_sym_GT); + if (lookahead == '=') ADVANCE(82); + END_STATE(); + case 80: + ACCEPT_TOKEN(anon_sym_LPAREN); + END_STATE(); + case 81: + ACCEPT_TOKEN(anon_sym_RPAREN); + END_STATE(); + case 82: + ACCEPT_TOKEN(anon_sym_GT_EQ); + END_STATE(); + case 83: + ACCEPT_TOKEN(anon_sym_LT); + if (lookahead == '=') ADVANCE(84); + END_STATE(); + case 84: + ACCEPT_TOKEN(anon_sym_LT_EQ); + END_STATE(); + case 85: + ACCEPT_TOKEN(sym_identifier); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(85); + END_STATE(); + default: + return false; + } +} + +static bool ts_lex_keywords(TSLexer *lexer, TSStateId state) { + START_LEXER(); + eof = lexer->eof(lexer); + switch (state) { + case 0: + if (lookahead == 'a') ADVANCE(1); + if (lookahead == 'b') ADVANCE(2); + if (lookahead == 'c') ADVANCE(3); + if (lookahead == 'e') ADVANCE(4); + if (lookahead == 'f') ADVANCE(5); + if (lookahead == 'i') ADVANCE(6); + if (lookahead == 'l') ADVANCE(7); + if (lookahead == 'n') ADVANCE(8); + if (lookahead == 'o') ADVANCE(9); + if (lookahead == 'r') ADVANCE(10); + if (lookahead == 's') ADVANCE(11); + if (lookahead == 't') ADVANCE(12); + if (lookahead == 'u') ADVANCE(13); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(0) + END_STATE(); + case 1: + if (lookahead == 'n') ADVANCE(14); + if (lookahead == 'p') ADVANCE(15); + if (lookahead == 's') ADVANCE(16); + END_STATE(); + case 2: + if (lookahead == 'e') ADVANCE(17); + END_STATE(); + case 3: + if (lookahead == 'h') ADVANCE(18); + END_STATE(); + case 4: + if (lookahead == 'n') ADVANCE(19); + END_STATE(); + case 5: + if (lookahead == 'a') ADVANCE(20); + if (lookahead == 'r') ADVANCE(21); + END_STATE(); + case 6: + if (lookahead == 'n') ADVANCE(22); + if (lookahead == 's') ADVANCE(23); + END_STATE(); + case 7: + if (lookahead == 'i') ADVANCE(24); + if (lookahead == 'o') ADVANCE(25); + END_STATE(); + case 8: + if (lookahead == 'o') ADVANCE(26); + END_STATE(); + case 9: + if (lookahead == 'n') ADVANCE(27); + if (lookahead == 'r') ADVANCE(28); + if (lookahead == 't') ADVANCE(29); + END_STATE(); + case 10: + if (lookahead == 'e') ADVANCE(30); + END_STATE(); + case 11: + if (lookahead == 'c') ADVANCE(31); + if (lookahead == 'e') ADVANCE(32); + if (lookahead == 'p') ADVANCE(33); + if (lookahead == 't') ADVANCE(34); + END_STATE(); + case 12: + if (lookahead == 'e') ADVANCE(35); + if (lookahead == 'r') ADVANCE(36); + END_STATE(); + case 13: + if (lookahead == 's') ADVANCE(37); + END_STATE(); + case 14: + if (lookahead == 'd') ADVANCE(38); + END_STATE(); + case 15: + if (lookahead == 'p') ADVANCE(39); + END_STATE(); + case 16: + ACCEPT_TOKEN(anon_sym_as); + END_STATE(); + case 17: + if (lookahead == 'h') ADVANCE(40); + END_STATE(); + case 18: + if (lookahead == 'a') ADVANCE(41); + END_STATE(); + case 19: + if (lookahead == 't') ADVANCE(42); + if (lookahead == 'u') ADVANCE(43); + END_STATE(); + case 20: + if (lookahead == 'l') ADVANCE(44); + END_STATE(); + case 21: + if (lookahead == 'o') ADVANCE(45); + END_STATE(); + case 22: + if (lookahead == 'c') ADVANCE(46); + if (lookahead == 's') ADVANCE(47); + END_STATE(); + case 23: + ACCEPT_TOKEN(anon_sym_is); + END_STATE(); + case 24: + if (lookahead == 'f') ADVANCE(48); + END_STATE(); + case 25: + if (lookahead == 'c') ADVANCE(49); + END_STATE(); + case 26: + if (lookahead == 't') ADVANCE(50); + END_STATE(); + case 27: + ACCEPT_TOKEN(anon_sym_on); + END_STATE(); + case 28: + ACCEPT_TOKEN(anon_sym_or); + END_STATE(); + case 29: + if (lookahead == 'h') ADVANCE(51); + END_STATE(); + case 30: + if (lookahead == 'l') ADVANCE(52); + if (lookahead == 'm') ADVANCE(53); + END_STATE(); + case 31: + if (lookahead == 'h') ADVANCE(54); + END_STATE(); + case 32: + if (lookahead == 'l') ADVANCE(55); + END_STATE(); + case 33: + if (lookahead == 'e') ADVANCE(56); + END_STATE(); + case 34: + if (lookahead == 'a') ADVANCE(57); + if (lookahead == 'r') ADVANCE(58); + END_STATE(); + case 35: + if (lookahead == 'm') ADVANCE(59); + END_STATE(); + case 36: + if (lookahead == 'u') ADVANCE(60); + END_STATE(); + case 37: + if (lookahead == 'e') ADVANCE(61); + END_STATE(); + case 38: + ACCEPT_TOKEN(anon_sym_and); + END_STATE(); + case 39: + if (lookahead == 'e') ADVANCE(62); + END_STATE(); + case 40: + if (lookahead == 'a') ADVANCE(63); + END_STATE(); + case 41: + if (lookahead == 'r') ADVANCE(64); + END_STATE(); + case 42: + if (lookahead == 'e') ADVANCE(65); + END_STATE(); + case 43: + if (lookahead == 'm') ADVANCE(66); + END_STATE(); + case 44: + if (lookahead == 's') ADVANCE(67); + END_STATE(); + case 45: + if (lookahead == 'm') ADVANCE(68); + END_STATE(); + case 46: + if (lookahead == 'l') ADVANCE(69); + END_STATE(); + case 47: + if (lookahead == 't') ADVANCE(70); + END_STATE(); + case 48: + if (lookahead == 'e') ADVANCE(71); + END_STATE(); + case 49: + if (lookahead == 'a') ADVANCE(72); + END_STATE(); + case 50: + ACCEPT_TOKEN(anon_sym_not); + END_STATE(); + case 51: + if (lookahead == 'e') ADVANCE(73); + END_STATE(); + case 52: + if (lookahead == 'a') ADVANCE(74); + END_STATE(); + case 53: + if (lookahead == 'o') ADVANCE(75); + END_STATE(); + case 54: + if (lookahead == 'e') ADVANCE(76); + END_STATE(); + case 55: + if (lookahead == 'f') ADVANCE(77); + END_STATE(); + case 56: + if (lookahead == 'c') ADVANCE(78); + END_STATE(); + case 57: + if (lookahead == 't') ADVANCE(79); + END_STATE(); + case 58: + if (lookahead == 'i') ADVANCE(80); + END_STATE(); + case 59: + if (lookahead == 'p') ADVANCE(81); + END_STATE(); + case 60: + if (lookahead == 'e') ADVANCE(82); + END_STATE(); + case 61: + ACCEPT_TOKEN(anon_sym_use); + END_STATE(); + case 62: + if (lookahead == 'n') ADVANCE(83); + END_STATE(); + case 63: + if (lookahead == 'v') ADVANCE(84); + END_STATE(); + case 64: + if (lookahead == 'a') ADVANCE(85); + END_STATE(); + case 65: + if (lookahead == 'r') ADVANCE(86); + END_STATE(); + case 66: + ACCEPT_TOKEN(anon_sym_enum); + END_STATE(); + case 67: + if (lookahead == 'e') ADVANCE(87); + END_STATE(); + case 68: + ACCEPT_TOKEN(anon_sym_from); + END_STATE(); + case 69: + if (lookahead == 'u') ADVANCE(88); + END_STATE(); + case 70: + if (lookahead == 'i') ADVANCE(89); + END_STATE(); + case 71: + if (lookahead == '_') ADVANCE(90); + END_STATE(); + case 72: + if (lookahead == 't') ADVANCE(91); + END_STATE(); + case 73: + if (lookahead == 'r') ADVANCE(92); + END_STATE(); + case 74: + if (lookahead == 't') ADVANCE(93); + END_STATE(); + case 75: + if (lookahead == 'v') ADVANCE(94); + END_STATE(); + case 76: + if (lookahead == 'd') ADVANCE(95); + END_STATE(); + case 77: + ACCEPT_TOKEN(anon_sym_self); + END_STATE(); + case 78: + if (lookahead == 'i') ADVANCE(96); + END_STATE(); + case 79: + if (lookahead == 'e') ADVANCE(97); + END_STATE(); + case 80: + if (lookahead == 'c') ADVANCE(98); + END_STATE(); + case 81: + if (lookahead == 'l') ADVANCE(99); + END_STATE(); + case 82: + ACCEPT_TOKEN(anon_sym_true); + END_STATE(); + case 83: + if (lookahead == 'd') ADVANCE(100); + END_STATE(); + case 84: + if (lookahead == 'i') ADVANCE(101); + END_STATE(); + case 85: + if (lookahead == 'c') ADVANCE(102); + END_STATE(); + case 86: + ACCEPT_TOKEN(anon_sym_enter); + END_STATE(); + case 87: + ACCEPT_TOKEN(anon_sym_false); + END_STATE(); + case 88: + if (lookahead == 'd') ADVANCE(103); + END_STATE(); + case 89: + if (lookahead == 't') ADVANCE(104); + END_STATE(); + case 90: + if (lookahead == 'a') ADVANCE(105); + END_STATE(); + case 91: + if (lookahead == 'i') ADVANCE(106); + END_STATE(); + case 92: + ACCEPT_TOKEN(anon_sym_other); + END_STATE(); + case 93: + if (lookahead == 'i') ADVANCE(107); + END_STATE(); + case 94: + if (lookahead == 'e') ADVANCE(108); + END_STATE(); + case 95: + if (lookahead == 'u') ADVANCE(109); + END_STATE(); + case 96: + if (lookahead == 'e') ADVANCE(110); + END_STATE(); + case 97: + ACCEPT_TOKEN(anon_sym_state); + END_STATE(); + case 98: + if (lookahead == 't') ADVANCE(111); + END_STATE(); + case 99: + if (lookahead == 'a') ADVANCE(112); + END_STATE(); + case 100: + ACCEPT_TOKEN(anon_sym_append); + END_STATE(); + case 101: + if (lookahead == 'o') ADVANCE(113); + END_STATE(); + case 102: + if (lookahead == 't') ADVANCE(114); + END_STATE(); + case 103: + if (lookahead == 'e') ADVANCE(115); + END_STATE(); + case 104: + if (lookahead == 'u') ADVANCE(116); + END_STATE(); + case 105: + if (lookahead == 'r') ADVANCE(117); + END_STATE(); + case 106: + if (lookahead == 'o') ADVANCE(118); + END_STATE(); + case 107: + if (lookahead == 'o') ADVANCE(119); + END_STATE(); + case 108: + ACCEPT_TOKEN(anon_sym_remove); + END_STATE(); + case 109: + if (lookahead == 'l') ADVANCE(120); + END_STATE(); + case 110: + if (lookahead == 's') ADVANCE(121); + END_STATE(); + case 111: + ACCEPT_TOKEN(anon_sym_strict); + END_STATE(); + case 112: + if (lookahead == 't') ADVANCE(122); + END_STATE(); + case 113: + if (lookahead == 'r') ADVANCE(123); + END_STATE(); + case 114: + if (lookahead == 'e') ADVANCE(124); + END_STATE(); + case 115: + ACCEPT_TOKEN(anon_sym_include); + END_STATE(); + case 116: + if (lookahead == 't') ADVANCE(125); + END_STATE(); + case 117: + if (lookahead == 'c') ADVANCE(126); + END_STATE(); + case 118: + if (lookahead == 'n') ADVANCE(127); + END_STATE(); + case 119: + if (lookahead == 'n') ADVANCE(128); + END_STATE(); + case 120: + if (lookahead == 'e') ADVANCE(129); + END_STATE(); + case 121: + ACCEPT_TOKEN(anon_sym_species); + END_STATE(); + case 122: + if (lookahead == 'e') ADVANCE(130); + END_STATE(); + case 123: + ACCEPT_TOKEN(anon_sym_behavior); + END_STATE(); + case 124: + if (lookahead == 'r') ADVANCE(131); + END_STATE(); + case 125: + if (lookahead == 'i') ADVANCE(132); + END_STATE(); + case 126: + ACCEPT_TOKEN(anon_sym_life_arc); + END_STATE(); + case 127: + ACCEPT_TOKEN(anon_sym_location); + END_STATE(); + case 128: + if (lookahead == 's') ADVANCE(133); + END_STATE(); + case 129: + ACCEPT_TOKEN(anon_sym_schedule); + END_STATE(); + case 130: + ACCEPT_TOKEN(anon_sym_template); + END_STATE(); + case 131: + ACCEPT_TOKEN(anon_sym_character); + END_STATE(); + case 132: + if (lookahead == 'o') ADVANCE(134); + END_STATE(); + case 133: + if (lookahead == 'h') ADVANCE(135); + END_STATE(); + case 134: + if (lookahead == 'n') ADVANCE(136); + END_STATE(); + case 135: + if (lookahead == 'i') ADVANCE(137); + END_STATE(); + case 136: + ACCEPT_TOKEN(anon_sym_institution); + END_STATE(); + case 137: + if (lookahead == 'p') ADVANCE(138); + END_STATE(); + case 138: + ACCEPT_TOKEN(anon_sym_relationship); + END_STATE(); + default: + return false; + } +} + +static const TSLexMode ts_lex_modes[STATE_COUNT] = { + [0] = {.lex_state = 0}, + [1] = {.lex_state = 0}, + [2] = {.lex_state = 1}, + [3] = {.lex_state = 1}, + [4] = {.lex_state = 1}, + [5] = {.lex_state = 1}, + [6] = {.lex_state = 0}, + [7] = {.lex_state = 0}, + [8] = {.lex_state = 0}, + [9] = {.lex_state = 1}, + [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 = 1}, + [19] = {.lex_state = 0}, + [20] = {.lex_state = 0}, + [21] = {.lex_state = 0}, + [22] = {.lex_state = 1}, + [23] = {.lex_state = 1}, + [24] = {.lex_state = 1}, + [25] = {.lex_state = 1}, + [26] = {.lex_state = 1}, + [27] = {.lex_state = 1}, + [28] = {.lex_state = 3}, + [29] = {.lex_state = 3}, + [30] = {.lex_state = 0}, + [31] = {.lex_state = 0}, + [32] = {.lex_state = 0}, + [33] = {.lex_state = 0}, + [34] = {.lex_state = 0}, + [35] = {.lex_state = 0}, + [36] = {.lex_state = 0}, + [37] = {.lex_state = 0}, + [38] = {.lex_state = 0}, + [39] = {.lex_state = 0}, + [40] = {.lex_state = 0}, + [41] = {.lex_state = 0}, + [42] = {.lex_state = 0}, + [43] = {.lex_state = 0}, + [44] = {.lex_state = 0}, + [45] = {.lex_state = 0}, + [46] = {.lex_state = 0}, + [47] = {.lex_state = 0}, + [48] = {.lex_state = 0}, + [49] = {.lex_state = 0}, + [50] = {.lex_state = 0}, + [51] = {.lex_state = 0}, + [52] = {.lex_state = 0}, + [53] = {.lex_state = 0}, + [54] = {.lex_state = 0}, + [55] = {.lex_state = 0}, + [56] = {.lex_state = 0}, + [57] = {.lex_state = 0}, + [58] = {.lex_state = 0}, + [59] = {.lex_state = 0}, + [60] = {.lex_state = 0}, + [61] = {.lex_state = 0}, + [62] = {.lex_state = 0}, + [63] = {.lex_state = 0}, + [64] = {.lex_state = 0}, + [65] = {.lex_state = 1}, + [66] = {.lex_state = 0}, + [67] = {.lex_state = 0}, + [68] = {.lex_state = 0}, + [69] = {.lex_state = 0}, + [70] = {.lex_state = 0}, + [71] = {.lex_state = 0}, + [72] = {.lex_state = 0}, + [73] = {.lex_state = 0}, + [74] = {.lex_state = 0}, + [75] = {.lex_state = 0}, + [76] = {.lex_state = 0}, + [77] = {.lex_state = 0}, + [78] = {.lex_state = 0}, + [79] = {.lex_state = 0}, + [80] = {.lex_state = 0}, + [81] = {.lex_state = 0}, + [82] = {.lex_state = 0}, + [83] = {.lex_state = 0}, + [84] = {.lex_state = 0}, + [85] = {.lex_state = 0}, + [86] = {.lex_state = 0}, + [87] = {.lex_state = 0}, + [88] = {.lex_state = 0}, + [89] = {.lex_state = 0}, + [90] = {.lex_state = 0}, + [91] = {.lex_state = 0}, + [92] = {.lex_state = 0}, + [93] = {.lex_state = 0}, + [94] = {.lex_state = 0}, + [95] = {.lex_state = 0}, + [96] = {.lex_state = 0}, + [97] = {.lex_state = 0}, + [98] = {.lex_state = 0}, + [99] = {.lex_state = 0}, + [100] = {.lex_state = 0}, + [101] = {.lex_state = 0}, + [102] = {.lex_state = 0}, + [103] = {.lex_state = 1}, + [104] = {.lex_state = 1}, + [105] = {.lex_state = 1}, + [106] = {.lex_state = 1}, + [107] = {.lex_state = 1}, + [108] = {.lex_state = 1}, + [109] = {.lex_state = 1}, + [110] = {.lex_state = 1}, + [111] = {.lex_state = 0}, + [112] = {.lex_state = 0}, + [113] = {.lex_state = 0}, + [114] = {.lex_state = 0}, + [115] = {.lex_state = 0}, + [116] = {.lex_state = 0}, + [117] = {.lex_state = 0}, + [118] = {.lex_state = 0}, + [119] = {.lex_state = 0}, + [120] = {.lex_state = 0}, + [121] = {.lex_state = 0}, + [122] = {.lex_state = 0}, + [123] = {.lex_state = 0}, + [124] = {.lex_state = 0}, + [125] = {.lex_state = 0}, + [126] = {.lex_state = 0}, + [127] = {.lex_state = 0}, + [128] = {.lex_state = 0}, + [129] = {.lex_state = 0}, + [130] = {.lex_state = 0}, + [131] = {.lex_state = 0}, + [132] = {.lex_state = 0}, + [133] = {.lex_state = 0}, + [134] = {.lex_state = 1}, + [135] = {.lex_state = 0}, + [136] = {.lex_state = 0}, + [137] = {.lex_state = 0}, + [138] = {.lex_state = 0}, + [139] = {.lex_state = 0}, + [140] = {.lex_state = 0}, + [141] = {.lex_state = 0}, + [142] = {.lex_state = 0}, + [143] = {.lex_state = 0}, + [144] = {.lex_state = 0}, + [145] = {.lex_state = 0}, + [146] = {.lex_state = 0}, + [147] = {.lex_state = 0}, + [148] = {.lex_state = 0}, + [149] = {.lex_state = 0}, + [150] = {.lex_state = 0}, + [151] = {.lex_state = 0}, + [152] = {.lex_state = 0}, + [153] = {.lex_state = 0}, + [154] = {.lex_state = 0}, + [155] = {.lex_state = 0}, + [156] = {.lex_state = 0}, + [157] = {.lex_state = 0}, + [158] = {.lex_state = 0}, + [159] = {.lex_state = 0}, + [160] = {.lex_state = 1}, + [161] = {.lex_state = 0}, + [162] = {.lex_state = 1}, + [163] = {.lex_state = 0}, + [164] = {.lex_state = 0}, + [165] = {.lex_state = 0}, + [166] = {.lex_state = 0}, + [167] = {.lex_state = 1}, + [168] = {.lex_state = 0}, + [169] = {.lex_state = 0}, + [170] = {.lex_state = 0}, + [171] = {.lex_state = 0}, + [172] = {.lex_state = 0}, + [173] = {.lex_state = 0}, + [174] = {.lex_state = 0}, + [175] = {.lex_state = 0}, + [176] = {.lex_state = 0}, + [177] = {.lex_state = 0}, + [178] = {.lex_state = 60}, + [179] = {.lex_state = 0}, + [180] = {.lex_state = 0}, + [181] = {.lex_state = 0}, + [182] = {.lex_state = 0}, + [183] = {.lex_state = 0}, + [184] = {.lex_state = 0}, + [185] = {.lex_state = 0}, + [186] = {.lex_state = 0}, + [187] = {.lex_state = 0}, + [188] = {.lex_state = 0}, + [189] = {.lex_state = 0}, + [190] = {.lex_state = 0}, + [191] = {.lex_state = 0}, + [192] = {.lex_state = 0}, + [193] = {.lex_state = 0}, + [194] = {.lex_state = 0}, + [195] = {.lex_state = 0}, + [196] = {.lex_state = 0}, + [197] = {.lex_state = 1}, + [198] = {.lex_state = 0}, + [199] = {.lex_state = 0}, + [200] = {.lex_state = 0}, + [201] = {.lex_state = 0}, + [202] = {.lex_state = 0}, + [203] = {.lex_state = 0}, + [204] = {.lex_state = 0}, + [205] = {.lex_state = 0}, + [206] = {.lex_state = 0}, + [207] = {.lex_state = 0}, + [208] = {.lex_state = 0}, + [209] = {.lex_state = 0}, + [210] = {.lex_state = 0}, + [211] = {.lex_state = 0}, + [212] = {.lex_state = 0}, + [213] = {.lex_state = 0}, + [214] = {.lex_state = 0}, + [215] = {.lex_state = 0}, + [216] = {.lex_state = 3}, + [217] = {.lex_state = 0}, + [218] = {.lex_state = 0}, + [219] = {.lex_state = 0}, + [220] = {.lex_state = 0}, + [221] = {.lex_state = 12}, + [222] = {.lex_state = 0}, + [223] = {.lex_state = 0}, + [224] = {.lex_state = 0}, + [225] = {.lex_state = 0}, + [226] = {.lex_state = 0}, + [227] = {.lex_state = 0}, + [228] = {.lex_state = 0}, + [229] = {.lex_state = 0}, + [230] = {.lex_state = 0}, + [231] = {.lex_state = 0}, + [232] = {.lex_state = 0}, + [233] = {.lex_state = 0}, + [234] = {.lex_state = 0}, + [235] = {.lex_state = 0}, + [236] = {.lex_state = 0}, + [237] = {.lex_state = 0}, + [238] = {.lex_state = 0}, + [239] = {.lex_state = 0}, + [240] = {.lex_state = 0}, + [241] = {.lex_state = 0}, + [242] = {.lex_state = 0}, + [243] = {.lex_state = 0}, + [244] = {.lex_state = 0}, + [245] = {.lex_state = 0}, + [246] = {.lex_state = 0}, + [247] = {.lex_state = 0}, + [248] = {.lex_state = 0}, + [249] = {.lex_state = 0}, + [250] = {.lex_state = 0}, + [251] = {.lex_state = 0}, + [252] = {.lex_state = 0}, + [253] = {.lex_state = 0}, + [254] = {.lex_state = 0}, + [255] = {.lex_state = 0}, + [256] = {.lex_state = 0}, + [257] = {.lex_state = 0}, +}; + +static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { + [0] = { + [ts_builtin_sym_end] = ACTIONS(1), + [sym_identifier] = ACTIONS(1), + [sym_line_comment] = ACTIONS(3), + [sym_block_comment] = ACTIONS(3), + [anon_sym_use] = ACTIONS(1), + [anon_sym_COLON_COLON] = ACTIONS(1), + [anon_sym_LBRACE] = ACTIONS(1), + [anon_sym_COMMA] = ACTIONS(1), + [anon_sym_RBRACE] = ACTIONS(1), + [anon_sym_STAR] = ACTIONS(1), + [anon_sym_SEMI] = ACTIONS(1), + [anon_sym_character] = ACTIONS(1), + [anon_sym_COLON] = ACTIONS(1), + [anon_sym_from] = ACTIONS(1), + [anon_sym_template] = ACTIONS(1), + [anon_sym_strict] = ACTIONS(1), + [anon_sym_include] = ACTIONS(1), + [anon_sym_DOT] = ACTIONS(1), + [sym_integer] = ACTIONS(1), + [sym_float] = ACTIONS(1), + [sym_string] = ACTIONS(1), + [anon_sym_true] = ACTIONS(1), + [anon_sym_false] = ACTIONS(1), + [anon_sym_DOT_DOT] = ACTIONS(1), + [sym_time] = ACTIONS(1), + [sym_duration] = ACTIONS(1), + [anon_sym_LBRACK] = ACTIONS(1), + [anon_sym_RBRACK] = ACTIONS(1), + [anon_sym_AT] = ACTIONS(1), + [anon_sym_remove] = ACTIONS(1), + [anon_sym_append] = ACTIONS(1), + [sym_prose_marker] = ACTIONS(1), + [anon_sym_life_arc] = ACTIONS(1), + [anon_sym_state] = ACTIONS(1), + [anon_sym_on] = ACTIONS(1), + [anon_sym_enter] = ACTIONS(1), + [anon_sym_DASH_GT] = ACTIONS(1), + [anon_sym_schedule] = ACTIONS(1), + [anon_sym_behavior] = ACTIONS(1), + [anon_sym_QMARK] = ACTIONS(1), + [anon_sym_GT] = ACTIONS(1), + [anon_sym_LPAREN] = ACTIONS(1), + [anon_sym_RPAREN] = ACTIONS(1), + [anon_sym_institution] = ACTIONS(1), + [anon_sym_relationship] = ACTIONS(1), + [anon_sym_as] = ACTIONS(1), + [anon_sym_location] = ACTIONS(1), + [anon_sym_species] = ACTIONS(1), + [anon_sym_enum] = ACTIONS(1), + [anon_sym_or] = ACTIONS(1), + [anon_sym_and] = ACTIONS(1), + [anon_sym_not] = ACTIONS(1), + [anon_sym_is] = ACTIONS(1), + [anon_sym_GT_EQ] = ACTIONS(1), + [anon_sym_LT] = ACTIONS(1), + [anon_sym_LT_EQ] = ACTIONS(1), + [anon_sym_self] = ACTIONS(1), + [anon_sym_other] = ACTIONS(1), + }, + [1] = { + [sym_source_file] = STATE(226), + [sym_declaration] = STATE(8), + [sym_use_declaration] = STATE(75), + [sym_character] = STATE(75), + [sym_template] = STATE(75), + [sym_life_arc] = STATE(75), + [sym_schedule] = STATE(75), + [sym_behavior] = STATE(75), + [sym_institution] = STATE(75), + [sym_relationship] = STATE(75), + [sym_location] = STATE(75), + [sym_species] = STATE(75), + [sym_enum_declaration] = STATE(75), + [aux_sym_source_file_repeat1] = STATE(8), + [ts_builtin_sym_end] = ACTIONS(5), + [sym_line_comment] = ACTIONS(3), + [sym_block_comment] = ACTIONS(3), + [anon_sym_use] = ACTIONS(7), + [anon_sym_character] = ACTIONS(9), + [anon_sym_template] = ACTIONS(11), + [anon_sym_life_arc] = ACTIONS(13), + [anon_sym_schedule] = ACTIONS(15), + [anon_sym_behavior] = ACTIONS(17), + [anon_sym_institution] = ACTIONS(19), + [anon_sym_relationship] = ACTIONS(21), + [anon_sym_location] = ACTIONS(23), + [anon_sym_species] = ACTIONS(25), + [anon_sym_enum] = ACTIONS(27), + }, +}; + +static const uint16_t ts_small_parse_table[] = { + [0] = 5, + ACTIONS(31), 1, + anon_sym_COLON_COLON, + STATE(2), 1, + aux_sym_path_segments_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(29), 11, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_as, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(34), 15, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_SEMI, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [41] = 5, + ACTIONS(38), 1, + anon_sym_COLON_COLON, + STATE(2), 1, + aux_sym_path_segments_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(36), 11, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_as, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(40), 14, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [81] = 5, + ACTIONS(38), 1, + anon_sym_COLON_COLON, + STATE(3), 1, + aux_sym_path_segments_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(42), 11, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_as, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(44), 14, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [121] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(29), 11, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_as, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(34), 16, + anon_sym_COLON_COLON, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_SEMI, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [157] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(46), 11, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + ACTIONS(48), 16, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_remove, + anon_sym_append, + anon_sym_life_arc, + anon_sym_state, + anon_sym_on, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + sym_identifier, + [193] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(50), 11, + ts_builtin_sym_end, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + ACTIONS(52), 16, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_remove, + anon_sym_append, + anon_sym_life_arc, + anon_sym_state, + anon_sym_on, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + sym_identifier, + [229] = 15, + ACTIONS(7), 1, + anon_sym_use, + ACTIONS(9), 1, + anon_sym_character, + ACTIONS(11), 1, + anon_sym_template, + ACTIONS(13), 1, + anon_sym_life_arc, + ACTIONS(15), 1, + anon_sym_schedule, + ACTIONS(17), 1, + anon_sym_behavior, + ACTIONS(19), 1, + anon_sym_institution, + ACTIONS(21), 1, + anon_sym_relationship, + ACTIONS(23), 1, + anon_sym_location, + ACTIONS(25), 1, + anon_sym_species, + ACTIONS(27), 1, + anon_sym_enum, + ACTIONS(54), 1, + ts_builtin_sym_end, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(10), 2, + sym_declaration, + aux_sym_source_file_repeat1, + STATE(75), 11, + sym_use_declaration, + sym_character, + sym_template, + sym_life_arc, + sym_schedule, + sym_behavior, + sym_institution, + sym_relationship, + sym_location, + sym_species, + sym_enum_declaration, + [287] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(56), 11, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_as, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(58), 14, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [321] = 15, + ACTIONS(60), 1, + ts_builtin_sym_end, + ACTIONS(62), 1, + anon_sym_use, + ACTIONS(65), 1, + anon_sym_character, + ACTIONS(68), 1, + anon_sym_template, + ACTIONS(71), 1, + anon_sym_life_arc, + ACTIONS(74), 1, + anon_sym_schedule, + ACTIONS(77), 1, + anon_sym_behavior, + ACTIONS(80), 1, + anon_sym_institution, + ACTIONS(83), 1, + anon_sym_relationship, + ACTIONS(86), 1, + anon_sym_location, + ACTIONS(89), 1, + anon_sym_species, + ACTIONS(92), 1, + anon_sym_enum, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(10), 2, + sym_declaration, + aux_sym_source_file_repeat1, + STATE(75), 11, + sym_use_declaration, + sym_character, + sym_template, + sym_life_arc, + sym_schedule, + sym_behavior, + sym_institution, + sym_relationship, + sym_location, + sym_species, + sym_enum_declaration, + [379] = 17, + ACTIONS(95), 1, + sym_identifier, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(113), 1, + anon_sym_RPAREN, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(192), 1, + sym_value, + STATE(194), 1, + sym_action_param, + STATE(220), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [441] = 17, + ACTIONS(95), 1, + sym_identifier, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(115), 1, + anon_sym_RPAREN, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(164), 1, + sym_action_param, + STATE(192), 1, + sym_value, + STATE(220), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [503] = 17, + ACTIONS(95), 1, + sym_identifier, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(117), 1, + anon_sym_RPAREN, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(192), 1, + sym_value, + STATE(194), 1, + sym_action_param, + STATE(220), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [565] = 16, + ACTIONS(95), 1, + sym_identifier, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(192), 1, + sym_value, + STATE(194), 1, + sym_action_param, + STATE(220), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [624] = 15, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(121), 1, + anon_sym_RBRACK, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(173), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [680] = 15, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(123), 1, + anon_sym_RBRACK, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(188), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [736] = 15, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(125), 1, + anon_sym_RBRACK, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(188), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [792] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(127), 10, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + anon_sym_GT, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_LT, + sym_identifier, + ACTIONS(129), 13, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_DOT, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_DASH_GT, + anon_sym_QMARK, + anon_sym_RPAREN, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [824] = 14, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(56), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [877] = 14, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(188), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [930] = 14, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(99), 1, + sym_integer, + ACTIONS(101), 1, + sym_float, + ACTIONS(107), 1, + anon_sym_LBRACK, + ACTIONS(109), 1, + anon_sym_AT, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(119), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(33), 1, + sym_block, + STATE(195), 1, + sym_value, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(103), 3, + sym_string, + sym_time, + sym_duration, + STATE(42), 7, + sym_path, + sym_boolean, + sym_range, + sym_list, + sym_object, + sym_override, + sym_prose_block, + [983] = 11, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(135), 1, + anon_sym_enter, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(107), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1028] = 10, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(107), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1070] = 10, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(106), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1112] = 10, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(103), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1154] = 10, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(110), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1196] = 10, + ACTIONS(119), 1, + sym_identifier, + ACTIONS(137), 1, + anon_sym_not, + STATE(9), 1, + sym_path_segments, + STATE(104), 1, + sym_expression, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(105), 2, + anon_sym_true, + anon_sym_false, + ACTIONS(133), 2, + sym_float, + sym_string, + STATE(105), 2, + sym_path, + sym_boolean, + ACTIONS(131), 3, + sym_integer, + anon_sym_self, + anon_sym_other, + STATE(108), 6, + sym_or_expression, + sym_and_expression, + sym_not_expression, + sym_comparison, + sym_field_access, + sym_primary_expression, + [1238] = 4, + ACTIONS(143), 1, + anon_sym_DOT_DOT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(139), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(141), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1265] = 4, + ACTIONS(145), 1, + anon_sym_DOT_DOT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(139), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(141), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1292] = 12, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(147), 1, + sym_identifier, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + STATE(250), 1, + sym_behavior_node, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(31), 2, + sym_field, + aux_sym_template_repeat2, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [1335] = 12, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(147), 1, + sym_identifier, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + STATE(232), 1, + sym_behavior_node, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [1378] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(157), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(159), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1402] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(161), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(163), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1426] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(165), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(167), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1450] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(169), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(171), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1474] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(173), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(175), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1498] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(177), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(179), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1522] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(181), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(183), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1546] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(185), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(187), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1570] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(189), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(191), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1594] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(193), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(195), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1618] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(139), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(141), 10, + anon_sym_COMMA, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_RBRACK, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + anon_sym_RPAREN, + [1642] = 8, + ACTIONS(197), 1, + sym_identifier, + ACTIONS(202), 1, + sym_prose_marker, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(205), 2, + anon_sym_state, + anon_sym_on, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + ACTIONS(200), 6, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + [1675] = 9, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + ACTIONS(207), 1, + sym_identifier, + ACTIONS(209), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(46), 2, + sym_behavior_node, + aux_sym_selector_node_repeat1, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [1709] = 9, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + ACTIONS(207), 1, + sym_identifier, + ACTIONS(211), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(46), 2, + sym_behavior_node, + aux_sym_selector_node_repeat1, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [1743] = 9, + ACTIONS(213), 1, + sym_identifier, + ACTIONS(216), 1, + anon_sym_RBRACE, + ACTIONS(218), 1, + anon_sym_STAR, + ACTIONS(221), 1, + anon_sym_AT, + ACTIONS(224), 1, + anon_sym_QMARK, + ACTIONS(227), 1, + anon_sym_GT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(46), 2, + sym_behavior_node, + aux_sym_selector_node_repeat1, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [1777] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(230), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1796] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(232), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1815] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(234), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1834] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(236), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1853] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(238), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1872] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(240), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1891] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(242), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1910] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(244), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1929] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(246), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [1948] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(248), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(250), 7, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + [1969] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(252), 5, + anon_sym_remove, + anon_sym_append, + anon_sym_state, + anon_sym_on, + sym_identifier, + ACTIONS(254), 7, + anon_sym_RBRACE, + anon_sym_STAR, + sym_time, + anon_sym_AT, + sym_prose_marker, + anon_sym_QMARK, + anon_sym_GT, + [1990] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(256), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2009] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(258), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2028] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(260), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2047] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(262), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2066] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(264), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2085] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(266), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2104] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(268), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2123] = 8, + ACTIONS(38), 1, + anon_sym_COLON_COLON, + ACTIONS(270), 1, + anon_sym_COLON, + ACTIONS(272), 1, + anon_sym_DOT, + STATE(3), 1, + aux_sym_path_segments_repeat1, + STATE(167), 1, + aux_sym_dotted_path_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(42), 2, + anon_sym_as, + sym_identifier, + ACTIONS(44), 5, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + sym_prose_marker, + anon_sym_RPAREN, + [2154] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(274), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2173] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(276), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2192] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(278), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2211] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(280), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2230] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(282), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2249] = 8, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + ACTIONS(207), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(45), 2, + sym_behavior_node, + aux_sym_selector_node_repeat1, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [2280] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(284), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2299] = 8, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + ACTIONS(207), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(44), 2, + sym_behavior_node, + aux_sym_selector_node_repeat1, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [2330] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(286), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2349] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(288), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2368] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(290), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2387] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(292), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2406] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(294), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2425] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(296), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2444] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(298), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2463] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(300), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2482] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(302), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2501] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(304), 12, + ts_builtin_sym_end, + anon_sym_use, + anon_sym_character, + anon_sym_template, + anon_sym_life_arc, + anon_sym_schedule, + anon_sym_behavior, + anon_sym_institution, + anon_sym_relationship, + anon_sym_location, + anon_sym_species, + anon_sym_enum, + [2520] = 10, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(306), 1, + sym_identifier, + ACTIONS(308), 1, + anon_sym_RBRACE, + STATE(9), 1, + sym_path_segments, + STATE(57), 1, + sym_prose_block, + STATE(130), 1, + sym_path, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(118), 2, + sym_participant, + aux_sym_relationship_repeat1, + STATE(119), 2, + sym_field, + aux_sym_template_repeat2, + [2554] = 8, + ACTIONS(149), 1, + anon_sym_STAR, + ACTIONS(151), 1, + anon_sym_AT, + ACTIONS(153), 1, + anon_sym_QMARK, + ACTIONS(155), 1, + anon_sym_GT, + ACTIONS(207), 1, + sym_identifier, + STATE(218), 1, + sym_behavior_node, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(131), 5, + sym_selector_node, + sym_sequence_node, + sym_repeat_node, + sym_action_node, + sym_subtree_node, + [2584] = 10, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(312), 1, + anon_sym_RBRACE, + ACTIONS(314), 1, + anon_sym_on, + STATE(57), 1, + sym_prose_block, + STATE(90), 1, + sym_on_enter, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(93), 2, + sym_field, + aux_sym_template_repeat2, + STATE(141), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [2618] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(316), 1, + anon_sym_RBRACE, + ACTIONS(318), 1, + anon_sym_include, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(97), 2, + sym_include, + aux_sym_template_repeat1, + STATE(117), 2, + sym_field, + aux_sym_template_repeat2, + [2649] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(316), 1, + anon_sym_RBRACE, + ACTIONS(318), 1, + anon_sym_include, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(117), 2, + sym_field, + aux_sym_template_repeat2, + STATE(125), 2, + sym_include, + aux_sym_template_repeat1, + [2680] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(320), 1, + anon_sym_RBRACE, + ACTIONS(322), 1, + anon_sym_state, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + STATE(147), 2, + sym_arc_state, + aux_sym_life_arc_repeat1, + [2711] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(324), 1, + anon_sym_RBRACE, + ACTIONS(326), 1, + anon_sym_on, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(101), 2, + sym_field, + aux_sym_template_repeat2, + STATE(146), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [2742] = 10, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(328), 1, + anon_sym_RBRACE, + ACTIONS(330), 1, + anon_sym_remove, + ACTIONS(332), 1, + anon_sym_append, + STATE(57), 1, + sym_prose_block, + STATE(132), 1, + sym_field, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(99), 2, + sym_override_op, + aux_sym_override_repeat1, + [2775] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(336), 1, + anon_sym_RBRACE, + ACTIONS(338), 1, + sym_time, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + STATE(149), 2, + sym_schedule_block, + aux_sym_schedule_repeat1, + [2806] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(324), 1, + anon_sym_RBRACE, + ACTIONS(326), 1, + anon_sym_on, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + STATE(146), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [2837] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(318), 1, + anon_sym_include, + ACTIONS(340), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(102), 2, + sym_include, + aux_sym_template_repeat1, + STATE(111), 2, + sym_field, + aux_sym_template_repeat2, + [2868] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(318), 1, + anon_sym_include, + ACTIONS(342), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(88), 2, + sym_include, + aux_sym_template_repeat1, + STATE(112), 2, + sym_field, + aux_sym_template_repeat2, + [2899] = 10, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(330), 1, + anon_sym_remove, + ACTIONS(332), 1, + anon_sym_append, + ACTIONS(344), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(132), 1, + sym_field, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(91), 2, + sym_override_op, + aux_sym_override_repeat1, + [2932] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(318), 1, + anon_sym_include, + ACTIONS(346), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(113), 2, + sym_field, + aux_sym_template_repeat2, + STATE(125), 2, + sym_include, + aux_sym_template_repeat1, + [2963] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(338), 1, + sym_time, + ACTIONS(348), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(92), 2, + sym_field, + aux_sym_template_repeat2, + STATE(140), 2, + sym_schedule_block, + aux_sym_schedule_repeat1, + [2994] = 10, + ACTIONS(350), 1, + sym_identifier, + ACTIONS(353), 1, + anon_sym_RBRACE, + ACTIONS(355), 1, + anon_sym_remove, + ACTIONS(358), 1, + anon_sym_append, + ACTIONS(361), 1, + sym_prose_marker, + STATE(57), 1, + sym_prose_block, + STATE(132), 1, + sym_field, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(99), 2, + sym_override_op, + aux_sym_override_repeat1, + [3027] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(322), 1, + anon_sym_state, + ACTIONS(364), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(89), 2, + sym_field, + aux_sym_template_repeat2, + STATE(151), 2, + sym_arc_state, + aux_sym_life_arc_repeat1, + [3058] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(326), 1, + anon_sym_on, + ACTIONS(366), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + STATE(138), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [3089] = 9, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(310), 1, + sym_identifier, + ACTIONS(318), 1, + anon_sym_include, + ACTIONS(368), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(116), 2, + sym_field, + aux_sym_template_repeat2, + STATE(125), 2, + sym_include, + aux_sym_template_repeat1, + [3120] = 4, + ACTIONS(370), 1, + anon_sym_DOT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(374), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(372), 6, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3140] = 5, + ACTIONS(370), 1, + anon_sym_DOT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(378), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(376), 3, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + ACTIONS(380), 3, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3162] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(384), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(382), 7, + anon_sym_DOT, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3180] = 5, + ACTIONS(370), 1, + anon_sym_DOT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(378), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(380), 3, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + ACTIONS(386), 3, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + [3202] = 7, + ACTIONS(370), 1, + anon_sym_DOT, + ACTIONS(388), 1, + anon_sym_DASH_GT, + ACTIONS(390), 1, + anon_sym_or, + ACTIONS(392), 1, + anon_sym_and, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(378), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(380), 3, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3228] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(396), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(394), 7, + anon_sym_DOT, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3246] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(400), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(398), 7, + anon_sym_DOT, + anon_sym_DASH_GT, + anon_sym_or, + anon_sym_and, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3264] = 6, + ACTIONS(370), 1, + anon_sym_DOT, + ACTIONS(392), 1, + anon_sym_and, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(378), 2, + anon_sym_GT, + anon_sym_LT, + ACTIONS(402), 2, + anon_sym_DASH_GT, + anon_sym_or, + ACTIONS(380), 3, + anon_sym_is, + anon_sym_GT_EQ, + anon_sym_LT_EQ, + [3288] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(368), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3312] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(316), 1, + anon_sym_RBRACE, + ACTIONS(334), 1, + sym_identifier, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3336] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(404), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3360] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(406), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(115), 2, + sym_field, + aux_sym_template_repeat2, + [3384] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(408), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3408] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(410), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3432] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(346), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3456] = 6, + ACTIONS(412), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(130), 1, + sym_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(415), 2, + anon_sym_RBRACE, + sym_prose_marker, + STATE(118), 2, + sym_participant, + aux_sym_relationship_repeat1, + [3478] = 7, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + ACTIONS(417), 1, + anon_sym_RBRACE, + STATE(57), 1, + sym_prose_block, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(43), 2, + sym_field, + aux_sym_template_repeat2, + [3502] = 3, + ACTIONS(421), 1, + anon_sym_LPAREN, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(419), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3518] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(423), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3531] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(425), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3544] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(427), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3557] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(429), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3570] = 5, + ACTIONS(431), 1, + sym_identifier, + ACTIONS(435), 1, + anon_sym_include, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(433), 2, + anon_sym_RBRACE, + sym_prose_marker, + STATE(125), 2, + sym_include, + aux_sym_template_repeat1, + [3589] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(438), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3602] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(440), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3615] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(442), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3628] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(444), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3641] = 6, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(446), 1, + sym_identifier, + ACTIONS(450), 1, + anon_sym_as, + STATE(157), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(448), 2, + anon_sym_RBRACE, + sym_prose_marker, + [3662] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(452), 6, + anon_sym_RBRACE, + anon_sym_STAR, + anon_sym_AT, + anon_sym_QMARK, + anon_sym_GT, + sym_identifier, + [3675] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(456), 2, + anon_sym_RBRACE, + sym_prose_marker, + ACTIONS(454), 3, + anon_sym_remove, + anon_sym_append, + sym_identifier, + [3689] = 6, + ACTIONS(111), 1, + sym_prose_marker, + ACTIONS(334), 1, + sym_identifier, + STATE(57), 1, + sym_prose_block, + STATE(137), 1, + sym_field, + STATE(203), 1, + sym_dotted_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [3709] = 6, + ACTIONS(272), 1, + anon_sym_DOT, + ACTIONS(419), 1, + anon_sym_RBRACE, + ACTIONS(421), 1, + anon_sym_LPAREN, + ACTIONS(458), 1, + anon_sym_COLON, + STATE(167), 1, + aux_sym_dotted_path_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [3729] = 5, + ACTIONS(460), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(130), 1, + sym_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(84), 2, + sym_participant, + aux_sym_relationship_repeat1, + [3747] = 6, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(462), 1, + anon_sym_COLON, + ACTIONS(464), 1, + anon_sym_from, + STATE(81), 1, + sym_block, + STATE(186), 1, + sym_template_clause, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [3767] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(468), 2, + anon_sym_RBRACE, + sym_prose_marker, + ACTIONS(466), 3, + anon_sym_remove, + anon_sym_append, + sym_identifier, + [3781] = 4, + ACTIONS(470), 1, + anon_sym_RBRACE, + ACTIONS(472), 1, + anon_sym_on, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(145), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [3796] = 4, + ACTIONS(474), 1, + anon_sym_RBRACE, + ACTIONS(476), 1, + sym_time, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(139), 2, + sym_schedule_block, + aux_sym_schedule_repeat1, + [3811] = 4, + ACTIONS(336), 1, + anon_sym_RBRACE, + ACTIONS(338), 1, + sym_time, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(139), 2, + sym_schedule_block, + aux_sym_schedule_repeat1, + [3826] = 4, + ACTIONS(324), 1, + anon_sym_RBRACE, + ACTIONS(472), 1, + anon_sym_on, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(145), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [3841] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(479), 2, + anon_sym_include, + sym_identifier, + ACTIONS(481), 2, + anon_sym_RBRACE, + sym_prose_marker, + [3854] = 5, + ACTIONS(97), 1, + anon_sym_LBRACE, + ACTIONS(464), 1, + anon_sym_from, + STATE(78), 1, + sym_block, + STATE(180), 1, + sym_template_clause, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [3871] = 3, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(483), 2, + anon_sym_on, + sym_identifier, + ACTIONS(485), 2, + anon_sym_RBRACE, + sym_prose_marker, + [3884] = 4, + ACTIONS(487), 1, + anon_sym_RBRACE, + ACTIONS(489), 1, + anon_sym_on, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(145), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [3899] = 4, + ACTIONS(366), 1, + anon_sym_RBRACE, + ACTIONS(472), 1, + anon_sym_on, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(145), 2, + sym_transition, + aux_sym_arc_state_repeat1, + [3914] = 4, + ACTIONS(492), 1, + anon_sym_RBRACE, + ACTIONS(494), 1, + anon_sym_state, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(148), 2, + sym_arc_state, + aux_sym_life_arc_repeat1, + [3929] = 4, + ACTIONS(496), 1, + anon_sym_RBRACE, + ACTIONS(498), 1, + anon_sym_state, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(148), 2, + sym_arc_state, + aux_sym_life_arc_repeat1, + [3944] = 4, + ACTIONS(338), 1, + sym_time, + ACTIONS(501), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(139), 2, + sym_schedule_block, + aux_sym_schedule_repeat1, + [3959] = 4, + ACTIONS(505), 1, + anon_sym_COMMA, + STATE(150), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(503), 2, + anon_sym_LBRACE, + anon_sym_RBRACE, + [3974] = 4, + ACTIONS(320), 1, + anon_sym_RBRACE, + ACTIONS(494), 1, + anon_sym_state, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + STATE(148), 2, + sym_arc_state, + aux_sym_life_arc_repeat1, + [3989] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(508), 3, + anon_sym_RBRACE, + sym_prose_marker, + sym_identifier, + [3999] = 4, + ACTIONS(40), 1, + anon_sym_SEMI, + ACTIONS(510), 1, + anon_sym_COLON_COLON, + STATE(2), 1, + aux_sym_path_segments_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4013] = 4, + ACTIONS(125), 1, + anon_sym_RBRACK, + ACTIONS(513), 1, + anon_sym_COMMA, + STATE(163), 1, + aux_sym_list_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4027] = 4, + ACTIONS(515), 1, + anon_sym_COMMA, + ACTIONS(517), 1, + anon_sym_RBRACE, + STATE(150), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4041] = 4, + ACTIONS(113), 1, + anon_sym_RPAREN, + ACTIONS(519), 1, + anon_sym_COMMA, + STATE(172), 1, + aux_sym_action_node_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4055] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(521), 3, + anon_sym_RBRACE, + sym_prose_marker, + sym_identifier, + [4065] = 4, + ACTIONS(523), 1, + anon_sym_COMMA, + ACTIONS(525), 1, + anon_sym_RBRACE, + STATE(150), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4079] = 4, + ACTIONS(44), 1, + anon_sym_SEMI, + ACTIONS(527), 1, + anon_sym_COLON_COLON, + STATE(153), 1, + aux_sym_path_segments_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4093] = 4, + ACTIONS(530), 1, + anon_sym_COLON, + ACTIONS(532), 1, + anon_sym_DOT, + STATE(160), 1, + aux_sym_dotted_path_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4107] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(503), 3, + anon_sym_LBRACE, + anon_sym_COMMA, + anon_sym_RBRACE, + [4117] = 4, + ACTIONS(272), 1, + anon_sym_DOT, + ACTIONS(458), 1, + anon_sym_COLON, + STATE(167), 1, + aux_sym_dotted_path_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4131] = 4, + ACTIONS(535), 1, + anon_sym_COMMA, + ACTIONS(538), 1, + anon_sym_RBRACK, + STATE(163), 1, + aux_sym_list_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4145] = 4, + ACTIONS(540), 1, + anon_sym_COMMA, + ACTIONS(542), 1, + anon_sym_RPAREN, + STATE(156), 1, + aux_sym_action_node_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4159] = 4, + ACTIONS(460), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(249), 1, + sym_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4173] = 4, + ACTIONS(544), 1, + anon_sym_LBRACE, + ACTIONS(546), 1, + anon_sym_COMMA, + STATE(150), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4187] = 4, + ACTIONS(272), 1, + anon_sym_DOT, + ACTIONS(548), 1, + anon_sym_COLON, + STATE(160), 1, + aux_sym_dotted_path_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4201] = 4, + ACTIONS(550), 1, + anon_sym_COMMA, + ACTIONS(552), 1, + anon_sym_RBRACE, + STATE(158), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4215] = 4, + ACTIONS(554), 1, + anon_sym_COMMA, + ACTIONS(556), 1, + anon_sym_RBRACE, + STATE(155), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4229] = 4, + ACTIONS(558), 1, + anon_sym_LBRACE, + ACTIONS(560), 1, + anon_sym_COMMA, + STATE(166), 1, + aux_sym_use_declaration_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4243] = 4, + ACTIONS(460), 1, + sym_identifier, + STATE(9), 1, + sym_path_segments, + STATE(122), 1, + sym_path, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4257] = 4, + ACTIONS(562), 1, + anon_sym_COMMA, + ACTIONS(565), 1, + anon_sym_RPAREN, + STATE(172), 1, + aux_sym_action_node_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4271] = 4, + ACTIONS(567), 1, + anon_sym_COMMA, + ACTIONS(569), 1, + anon_sym_RBRACK, + STATE(154), 1, + aux_sym_list_repeat1, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4285] = 3, + ACTIONS(517), 1, + anon_sym_RBRACE, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4296] = 3, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(573), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4307] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(575), 2, + anon_sym_RBRACE, + anon_sym_state, + [4316] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(577), 2, + anon_sym_RBRACE, + anon_sym_on, + [4325] = 3, + ACTIONS(581), 1, + aux_sym_prose_block_token1, + ACTIONS(583), 1, + sym_prose_content, + ACTIONS(579), 2, + sym_line_comment, + sym_block_comment, + [4336] = 3, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(585), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4347] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(55), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4358] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(587), 2, + anon_sym_RBRACE, + sym_time, + [4367] = 3, + ACTIONS(544), 1, + anon_sym_LBRACE, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4378] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(589), 2, + anon_sym_RBRACE, + anon_sym_state, + [4387] = 3, + ACTIONS(591), 1, + anon_sym_LBRACE, + ACTIONS(593), 1, + anon_sym_STAR, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4398] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(595), 2, + anon_sym_RBRACE, + anon_sym_state, + [4407] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(60), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4418] = 3, + ACTIONS(597), 1, + sym_identifier, + STATE(193), 1, + sym_path_segments, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4429] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(538), 2, + anon_sym_COMMA, + anon_sym_RBRACK, + [4438] = 3, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(599), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4449] = 3, + ACTIONS(525), 1, + anon_sym_RBRACE, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4460] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(152), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4471] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(601), 2, + anon_sym_COMMA, + anon_sym_RPAREN, + [4480] = 3, + ACTIONS(603), 1, + anon_sym_COLON_COLON, + ACTIONS(605), 1, + anon_sym_SEMI, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4491] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(565), 2, + anon_sym_COMMA, + anon_sym_RPAREN, + [4500] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(607), 2, + anon_sym_COMMA, + anon_sym_RPAREN, + [4509] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(181), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4520] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(530), 2, + anon_sym_COLON, + anon_sym_DOT, + [4529] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(144), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4540] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(49), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4551] = 2, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + ACTIONS(609), 2, + anon_sym_RBRACE, + anon_sym_state, + [4560] = 3, + ACTIONS(611), 1, + anon_sym_LBRACE, + ACTIONS(613), 1, + anon_sym_strict, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4571] = 3, + ACTIONS(97), 1, + anon_sym_LBRACE, + STATE(66), 1, + sym_block, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4582] = 2, + ACTIONS(615), 1, + anon_sym_COLON, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4590] = 2, + ACTIONS(617), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4598] = 2, + ACTIONS(619), 1, + anon_sym_SEMI, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4606] = 2, + ACTIONS(621), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4614] = 2, + ACTIONS(623), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4622] = 2, + ACTIONS(625), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4630] = 2, + ACTIONS(627), 1, + anon_sym_COLON, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4638] = 2, + ACTIONS(629), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4646] = 2, + ACTIONS(631), 1, + anon_sym_SEMI, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4654] = 2, + ACTIONS(633), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4662] = 2, + ACTIONS(635), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4670] = 2, + ACTIONS(637), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4678] = 2, + ACTIONS(639), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4686] = 2, + ACTIONS(641), 1, + sym_integer, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4694] = 2, + ACTIONS(643), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4702] = 2, + ACTIONS(645), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4710] = 2, + ACTIONS(647), 1, + sym_prose_marker, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4718] = 2, + ACTIONS(649), 1, + anon_sym_COLON, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4726] = 2, + ACTIONS(651), 1, + sym_prose_content, + ACTIONS(579), 2, + sym_line_comment, + sym_block_comment, + [4734] = 2, + ACTIONS(653), 1, + anon_sym_SEMI, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4742] = 2, + ACTIONS(655), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4750] = 2, + ACTIONS(657), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4758] = 2, + ACTIONS(659), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4766] = 2, + ACTIONS(661), 1, + ts_builtin_sym_end, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4774] = 2, + ACTIONS(663), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4782] = 2, + ACTIONS(665), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4790] = 2, + ACTIONS(667), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4798] = 2, + ACTIONS(669), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4806] = 2, + ACTIONS(671), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4814] = 2, + ACTIONS(673), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4822] = 2, + ACTIONS(675), 1, + sym_time, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4830] = 2, + ACTIONS(677), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4838] = 2, + ACTIONS(679), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4846] = 2, + ACTIONS(681), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4854] = 2, + ACTIONS(683), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4862] = 2, + ACTIONS(685), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4870] = 2, + ACTIONS(687), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4878] = 2, + ACTIONS(689), 1, + anon_sym_SEMI, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4886] = 2, + ACTIONS(691), 1, + anon_sym_DASH_GT, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4894] = 2, + ACTIONS(693), 1, + sym_prose_marker, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4902] = 2, + ACTIONS(571), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4910] = 2, + ACTIONS(695), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4918] = 2, + ACTIONS(697), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4926] = 2, + ACTIONS(699), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4934] = 2, + ACTIONS(701), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4942] = 2, + ACTIONS(703), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4950] = 2, + ACTIONS(705), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4958] = 2, + ACTIONS(707), 1, + anon_sym_RBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4966] = 2, + ACTIONS(709), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4974] = 2, + ACTIONS(711), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4982] = 2, + ACTIONS(713), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4990] = 2, + ACTIONS(715), 1, + anon_sym_LBRACE, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [4998] = 2, + ACTIONS(641), 1, + sym_float, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [5006] = 2, + ACTIONS(717), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, + [5014] = 2, + ACTIONS(719), 1, + sym_identifier, + ACTIONS(3), 2, + sym_line_comment, + sym_block_comment, +}; + +static const uint32_t ts_small_parse_table_map[] = { + [SMALL_STATE(2)] = 0, + [SMALL_STATE(3)] = 41, + [SMALL_STATE(4)] = 81, + [SMALL_STATE(5)] = 121, + [SMALL_STATE(6)] = 157, + [SMALL_STATE(7)] = 193, + [SMALL_STATE(8)] = 229, + [SMALL_STATE(9)] = 287, + [SMALL_STATE(10)] = 321, + [SMALL_STATE(11)] = 379, + [SMALL_STATE(12)] = 441, + [SMALL_STATE(13)] = 503, + [SMALL_STATE(14)] = 565, + [SMALL_STATE(15)] = 624, + [SMALL_STATE(16)] = 680, + [SMALL_STATE(17)] = 736, + [SMALL_STATE(18)] = 792, + [SMALL_STATE(19)] = 824, + [SMALL_STATE(20)] = 877, + [SMALL_STATE(21)] = 930, + [SMALL_STATE(22)] = 983, + [SMALL_STATE(23)] = 1028, + [SMALL_STATE(24)] = 1070, + [SMALL_STATE(25)] = 1112, + [SMALL_STATE(26)] = 1154, + [SMALL_STATE(27)] = 1196, + [SMALL_STATE(28)] = 1238, + [SMALL_STATE(29)] = 1265, + [SMALL_STATE(30)] = 1292, + [SMALL_STATE(31)] = 1335, + [SMALL_STATE(32)] = 1378, + [SMALL_STATE(33)] = 1402, + [SMALL_STATE(34)] = 1426, + [SMALL_STATE(35)] = 1450, + [SMALL_STATE(36)] = 1474, + [SMALL_STATE(37)] = 1498, + [SMALL_STATE(38)] = 1522, + [SMALL_STATE(39)] = 1546, + [SMALL_STATE(40)] = 1570, + [SMALL_STATE(41)] = 1594, + [SMALL_STATE(42)] = 1618, + [SMALL_STATE(43)] = 1642, + [SMALL_STATE(44)] = 1675, + [SMALL_STATE(45)] = 1709, + [SMALL_STATE(46)] = 1743, + [SMALL_STATE(47)] = 1777, + [SMALL_STATE(48)] = 1796, + [SMALL_STATE(49)] = 1815, + [SMALL_STATE(50)] = 1834, + [SMALL_STATE(51)] = 1853, + [SMALL_STATE(52)] = 1872, + [SMALL_STATE(53)] = 1891, + [SMALL_STATE(54)] = 1910, + [SMALL_STATE(55)] = 1929, + [SMALL_STATE(56)] = 1948, + [SMALL_STATE(57)] = 1969, + [SMALL_STATE(58)] = 1990, + [SMALL_STATE(59)] = 2009, + [SMALL_STATE(60)] = 2028, + [SMALL_STATE(61)] = 2047, + [SMALL_STATE(62)] = 2066, + [SMALL_STATE(63)] = 2085, + [SMALL_STATE(64)] = 2104, + [SMALL_STATE(65)] = 2123, + [SMALL_STATE(66)] = 2154, + [SMALL_STATE(67)] = 2173, + [SMALL_STATE(68)] = 2192, + [SMALL_STATE(69)] = 2211, + [SMALL_STATE(70)] = 2230, + [SMALL_STATE(71)] = 2249, + [SMALL_STATE(72)] = 2280, + [SMALL_STATE(73)] = 2299, + [SMALL_STATE(74)] = 2330, + [SMALL_STATE(75)] = 2349, + [SMALL_STATE(76)] = 2368, + [SMALL_STATE(77)] = 2387, + [SMALL_STATE(78)] = 2406, + [SMALL_STATE(79)] = 2425, + [SMALL_STATE(80)] = 2444, + [SMALL_STATE(81)] = 2463, + [SMALL_STATE(82)] = 2482, + [SMALL_STATE(83)] = 2501, + [SMALL_STATE(84)] = 2520, + [SMALL_STATE(85)] = 2554, + [SMALL_STATE(86)] = 2584, + [SMALL_STATE(87)] = 2618, + [SMALL_STATE(88)] = 2649, + [SMALL_STATE(89)] = 2680, + [SMALL_STATE(90)] = 2711, + [SMALL_STATE(91)] = 2742, + [SMALL_STATE(92)] = 2775, + [SMALL_STATE(93)] = 2806, + [SMALL_STATE(94)] = 2837, + [SMALL_STATE(95)] = 2868, + [SMALL_STATE(96)] = 2899, + [SMALL_STATE(97)] = 2932, + [SMALL_STATE(98)] = 2963, + [SMALL_STATE(99)] = 2994, + [SMALL_STATE(100)] = 3027, + [SMALL_STATE(101)] = 3058, + [SMALL_STATE(102)] = 3089, + [SMALL_STATE(103)] = 3120, + [SMALL_STATE(104)] = 3140, + [SMALL_STATE(105)] = 3162, + [SMALL_STATE(106)] = 3180, + [SMALL_STATE(107)] = 3202, + [SMALL_STATE(108)] = 3228, + [SMALL_STATE(109)] = 3246, + [SMALL_STATE(110)] = 3264, + [SMALL_STATE(111)] = 3288, + [SMALL_STATE(112)] = 3312, + [SMALL_STATE(113)] = 3336, + [SMALL_STATE(114)] = 3360, + [SMALL_STATE(115)] = 3384, + [SMALL_STATE(116)] = 3408, + [SMALL_STATE(117)] = 3432, + [SMALL_STATE(118)] = 3456, + [SMALL_STATE(119)] = 3478, + [SMALL_STATE(120)] = 3502, + [SMALL_STATE(121)] = 3518, + [SMALL_STATE(122)] = 3531, + [SMALL_STATE(123)] = 3544, + [SMALL_STATE(124)] = 3557, + [SMALL_STATE(125)] = 3570, + [SMALL_STATE(126)] = 3589, + [SMALL_STATE(127)] = 3602, + [SMALL_STATE(128)] = 3615, + [SMALL_STATE(129)] = 3628, + [SMALL_STATE(130)] = 3641, + [SMALL_STATE(131)] = 3662, + [SMALL_STATE(132)] = 3675, + [SMALL_STATE(133)] = 3689, + [SMALL_STATE(134)] = 3709, + [SMALL_STATE(135)] = 3729, + [SMALL_STATE(136)] = 3747, + [SMALL_STATE(137)] = 3767, + [SMALL_STATE(138)] = 3781, + [SMALL_STATE(139)] = 3796, + [SMALL_STATE(140)] = 3811, + [SMALL_STATE(141)] = 3826, + [SMALL_STATE(142)] = 3841, + [SMALL_STATE(143)] = 3854, + [SMALL_STATE(144)] = 3871, + [SMALL_STATE(145)] = 3884, + [SMALL_STATE(146)] = 3899, + [SMALL_STATE(147)] = 3914, + [SMALL_STATE(148)] = 3929, + [SMALL_STATE(149)] = 3944, + [SMALL_STATE(150)] = 3959, + [SMALL_STATE(151)] = 3974, + [SMALL_STATE(152)] = 3989, + [SMALL_STATE(153)] = 3999, + [SMALL_STATE(154)] = 4013, + [SMALL_STATE(155)] = 4027, + [SMALL_STATE(156)] = 4041, + [SMALL_STATE(157)] = 4055, + [SMALL_STATE(158)] = 4065, + [SMALL_STATE(159)] = 4079, + [SMALL_STATE(160)] = 4093, + [SMALL_STATE(161)] = 4107, + [SMALL_STATE(162)] = 4117, + [SMALL_STATE(163)] = 4131, + [SMALL_STATE(164)] = 4145, + [SMALL_STATE(165)] = 4159, + [SMALL_STATE(166)] = 4173, + [SMALL_STATE(167)] = 4187, + [SMALL_STATE(168)] = 4201, + [SMALL_STATE(169)] = 4215, + [SMALL_STATE(170)] = 4229, + [SMALL_STATE(171)] = 4243, + [SMALL_STATE(172)] = 4257, + [SMALL_STATE(173)] = 4271, + [SMALL_STATE(174)] = 4285, + [SMALL_STATE(175)] = 4296, + [SMALL_STATE(176)] = 4307, + [SMALL_STATE(177)] = 4316, + [SMALL_STATE(178)] = 4325, + [SMALL_STATE(179)] = 4336, + [SMALL_STATE(180)] = 4347, + [SMALL_STATE(181)] = 4358, + [SMALL_STATE(182)] = 4367, + [SMALL_STATE(183)] = 4378, + [SMALL_STATE(184)] = 4387, + [SMALL_STATE(185)] = 4398, + [SMALL_STATE(186)] = 4407, + [SMALL_STATE(187)] = 4418, + [SMALL_STATE(188)] = 4429, + [SMALL_STATE(189)] = 4438, + [SMALL_STATE(190)] = 4449, + [SMALL_STATE(191)] = 4460, + [SMALL_STATE(192)] = 4471, + [SMALL_STATE(193)] = 4480, + [SMALL_STATE(194)] = 4491, + [SMALL_STATE(195)] = 4500, + [SMALL_STATE(196)] = 4509, + [SMALL_STATE(197)] = 4520, + [SMALL_STATE(198)] = 4529, + [SMALL_STATE(199)] = 4540, + [SMALL_STATE(200)] = 4551, + [SMALL_STATE(201)] = 4560, + [SMALL_STATE(202)] = 4571, + [SMALL_STATE(203)] = 4582, + [SMALL_STATE(204)] = 4590, + [SMALL_STATE(205)] = 4598, + [SMALL_STATE(206)] = 4606, + [SMALL_STATE(207)] = 4614, + [SMALL_STATE(208)] = 4622, + [SMALL_STATE(209)] = 4630, + [SMALL_STATE(210)] = 4638, + [SMALL_STATE(211)] = 4646, + [SMALL_STATE(212)] = 4654, + [SMALL_STATE(213)] = 4662, + [SMALL_STATE(214)] = 4670, + [SMALL_STATE(215)] = 4678, + [SMALL_STATE(216)] = 4686, + [SMALL_STATE(217)] = 4694, + [SMALL_STATE(218)] = 4702, + [SMALL_STATE(219)] = 4710, + [SMALL_STATE(220)] = 4718, + [SMALL_STATE(221)] = 4726, + [SMALL_STATE(222)] = 4734, + [SMALL_STATE(223)] = 4742, + [SMALL_STATE(224)] = 4750, + [SMALL_STATE(225)] = 4758, + [SMALL_STATE(226)] = 4766, + [SMALL_STATE(227)] = 4774, + [SMALL_STATE(228)] = 4782, + [SMALL_STATE(229)] = 4790, + [SMALL_STATE(230)] = 4798, + [SMALL_STATE(231)] = 4806, + [SMALL_STATE(232)] = 4814, + [SMALL_STATE(233)] = 4822, + [SMALL_STATE(234)] = 4830, + [SMALL_STATE(235)] = 4838, + [SMALL_STATE(236)] = 4846, + [SMALL_STATE(237)] = 4854, + [SMALL_STATE(238)] = 4862, + [SMALL_STATE(239)] = 4870, + [SMALL_STATE(240)] = 4878, + [SMALL_STATE(241)] = 4886, + [SMALL_STATE(242)] = 4894, + [SMALL_STATE(243)] = 4902, + [SMALL_STATE(244)] = 4910, + [SMALL_STATE(245)] = 4918, + [SMALL_STATE(246)] = 4926, + [SMALL_STATE(247)] = 4934, + [SMALL_STATE(248)] = 4942, + [SMALL_STATE(249)] = 4950, + [SMALL_STATE(250)] = 4958, + [SMALL_STATE(251)] = 4966, + [SMALL_STATE(252)] = 4974, + [SMALL_STATE(253)] = 4982, + [SMALL_STATE(254)] = 4990, + [SMALL_STATE(255)] = 4998, + [SMALL_STATE(256)] = 5006, + [SMALL_STATE(257)] = 5014, +}; + +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}}, SHIFT_EXTRA(), + [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), + [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(187), + [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(257), + [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(256), + [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(248), + [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(246), + [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(245), + [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(244), + [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(239), + [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(238), + [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(237), + [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(228), + [29] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_path_segments_repeat1, 2), + [31] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_path_segments_repeat1, 2), SHIFT_REPEAT(224), + [34] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_path_segments_repeat1, 2), + [36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_path_segments, 2), + [38] = {.entry = {.count = 1, .reusable = true}}, SHIFT(224), + [40] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_path_segments, 2), + [42] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_path_segments, 1), + [44] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_path_segments, 1), + [46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 2), + [48] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 2), + [50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 3), + [52] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 3), + [54] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [56] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_path, 1), + [58] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_path, 1), + [60] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), + [62] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(187), + [65] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(257), + [68] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(256), + [71] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(248), + [74] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(246), + [77] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(245), + [80] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(244), + [83] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(239), + [86] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(238), + [89] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(237), + [92] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(228), + [95] = {.entry = {.count = 1, .reusable = false}}, SHIFT(65), + [97] = {.entry = {.count = 1, .reusable = true}}, SHIFT(114), + [99] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), + [101] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), + [103] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), + [105] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), + [107] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), + [109] = {.entry = {.count = 1, .reusable = true}}, SHIFT(165), + [111] = {.entry = {.count = 1, .reusable = true}}, SHIFT(213), + [113] = {.entry = {.count = 1, .reusable = true}}, SHIFT(127), + [115] = {.entry = {.count = 1, .reusable = true}}, SHIFT(124), + [117] = {.entry = {.count = 1, .reusable = true}}, SHIFT(128), + [119] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), + [121] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), + [123] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), + [125] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), + [127] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_boolean, 1), + [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_boolean, 1), + [131] = {.entry = {.count = 1, .reusable = false}}, SHIFT(105), + [133] = {.entry = {.count = 1, .reusable = true}}, SHIFT(105), + [135] = {.entry = {.count = 1, .reusable = false}}, SHIFT(198), + [137] = {.entry = {.count = 1, .reusable = false}}, SHIFT(24), + [139] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_value, 1), + [141] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_value, 1), + [143] = {.entry = {.count = 1, .reusable = true}}, SHIFT(216), + [145] = {.entry = {.count = 1, .reusable = true}}, SHIFT(255), + [147] = {.entry = {.count = 1, .reusable = true}}, SHIFT(134), + [149] = {.entry = {.count = 1, .reusable = true}}, SHIFT(254), + [151] = {.entry = {.count = 1, .reusable = true}}, SHIFT(171), + [153] = {.entry = {.count = 1, .reusable = true}}, SHIFT(253), + [155] = {.entry = {.count = 1, .reusable = true}}, SHIFT(252), + [157] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 3), + [159] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 3), + [161] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_object, 1), + [163] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 1), + [165] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 2), + [167] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 2), + [169] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_prose_block, 4, .production_id = 9), + [171] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_prose_block, 4, .production_id = 9), + [173] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 5), + [175] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 5), + [177] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_override, 4), + [179] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_override, 4), + [181] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_list, 4), + [183] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_list, 4), + [185] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_range, 3), + [187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_range, 3), + [189] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_prose_block, 5, .production_id = 10), + [191] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_prose_block, 5, .production_id = 10), + [193] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_override, 5), + [195] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_override, 5), + [197] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_repeat2, 2), SHIFT_REPEAT(162), + [200] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_template_repeat2, 2), + [202] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_template_repeat2, 2), SHIFT_REPEAT(213), + [205] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_template_repeat2, 2), + [207] = {.entry = {.count = 1, .reusable = true}}, SHIFT(120), + [209] = {.entry = {.count = 1, .reusable = true}}, SHIFT(121), + [211] = {.entry = {.count = 1, .reusable = true}}, SHIFT(126), + [213] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), SHIFT_REPEAT(120), + [216] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), + [218] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), SHIFT_REPEAT(254), + [221] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), SHIFT_REPEAT(171), + [224] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), SHIFT_REPEAT(253), + [227] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_selector_node_repeat1, 2), SHIFT_REPEAT(252), + [230] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_use_declaration, 8), + [232] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_life_arc, 4, .production_id = 2), + [234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_location, 3, .production_id = 2), + [236] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 6, .production_id = 2), + [238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_life_arc, 6, .production_id = 2), + [240] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template, 7, .production_id = 2), + [242] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template, 5, .production_id = 2), + [244] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template, 6, .production_id = 2), + [246] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character, 6, .production_id = 7), + [248] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_field, 3, .production_id = 6), + [250] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_field, 3, .production_id = 6), + [252] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_field, 1), + [254] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_field, 1), + [256] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_declaration, 7, .production_id = 2), + [258] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_use_declaration, 3), + [260] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character, 4, .production_id = 3), + [262] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template, 4, .production_id = 2), + [264] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_use_declaration, 7), + [266] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_behavior, 6, .production_id = 8), + [268] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_declaration, 5, .production_id = 2), + [270] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_dotted_path, 1), + [272] = {.entry = {.count = 1, .reusable = true}}, SHIFT(247), + [274] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_institution, 3, .production_id = 2), + [276] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_species, 4, .production_id = 2), + [278] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_species, 5, .production_id = 2), + [280] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_use_declaration, 5), + [282] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 4, .production_id = 2), + [284] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_life_arc, 5, .production_id = 2), + [286] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_use_declaration, 9), + [288] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 1), + [290] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_relationship, 6, .production_id = 2), + [292] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_species, 6, .production_id = 2), + [294] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character, 5, .production_id = 4), + [296] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_behavior, 5, .production_id = 5), + [298] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 5, .production_id = 2), + [300] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_character, 3, .production_id = 1), + [302] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_relationship, 5, .production_id = 2), + [304] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_enum_declaration, 6, .production_id = 2), + [306] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), + [308] = {.entry = {.count = 1, .reusable = true}}, SHIFT(82), + [310] = {.entry = {.count = 1, .reusable = false}}, SHIFT(162), + [312] = {.entry = {.count = 1, .reusable = true}}, SHIFT(183), + [314] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), + [316] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), + [318] = {.entry = {.count = 1, .reusable = false}}, SHIFT(215), + [320] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), + [322] = {.entry = {.count = 1, .reusable = false}}, SHIFT(204), + [324] = {.entry = {.count = 1, .reusable = true}}, SHIFT(200), + [326] = {.entry = {.count = 1, .reusable = false}}, SHIFT(23), + [328] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), + [330] = {.entry = {.count = 1, .reusable = false}}, SHIFT(229), + [332] = {.entry = {.count = 1, .reusable = false}}, SHIFT(133), + [334] = {.entry = {.count = 1, .reusable = true}}, SHIFT(162), + [336] = {.entry = {.count = 1, .reusable = true}}, SHIFT(80), + [338] = {.entry = {.count = 1, .reusable = true}}, SHIFT(241), + [340] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), + [342] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), + [344] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), + [346] = {.entry = {.count = 1, .reusable = true}}, SHIFT(54), + [348] = {.entry = {.count = 1, .reusable = true}}, SHIFT(70), + [350] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_override_repeat1, 2), SHIFT_REPEAT(162), + [353] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_override_repeat1, 2), + [355] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_override_repeat1, 2), SHIFT_REPEAT(229), + [358] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_override_repeat1, 2), SHIFT_REPEAT(133), + [361] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_override_repeat1, 2), SHIFT_REPEAT(213), + [364] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), + [366] = {.entry = {.count = 1, .reusable = true}}, SHIFT(185), + [368] = {.entry = {.count = 1, .reusable = true}}, SHIFT(68), + [370] = {.entry = {.count = 1, .reusable = true}}, SHIFT(235), + [372] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_comparison, 3, .production_id = 13), + [374] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_comparison, 3, .production_id = 13), + [376] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_and_expression, 3), + [378] = {.entry = {.count = 1, .reusable = false}}, SHIFT(25), + [380] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), + [382] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_primary_expression, 1), + [384] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_primary_expression, 1), + [386] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_not_expression, 2), + [388] = {.entry = {.count = 1, .reusable = true}}, SHIFT(236), + [390] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), + [392] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), + [394] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expression, 1), + [396] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expression, 1), + [398] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_field_access, 3), + [400] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_field_access, 3), + [402] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_or_expression, 3), + [404] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), + [406] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), + [408] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), + [410] = {.entry = {.count = 1, .reusable = true}}, SHIFT(77), + [412] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_relationship_repeat1, 2), SHIFT_REPEAT(4), + [415] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_relationship_repeat1, 2), + [417] = {.entry = {.count = 1, .reusable = true}}, SHIFT(76), + [419] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_node, 1), + [421] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), + [423] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sequence_node, 4), + [425] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_subtree_node, 2), + [427] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_node, 4), + [429] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_node, 3), + [431] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_template_repeat1, 2), + [433] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_template_repeat1, 2), + [435] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_template_repeat1, 2), SHIFT_REPEAT(215), + [438] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_selector_node, 4), + [440] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_node, 5), + [442] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_node, 6), + [444] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_repeat_node, 4), + [446] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_participant, 1), + [448] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_participant, 1), + [450] = {.entry = {.count = 1, .reusable = false}}, SHIFT(231), + [452] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_behavior_node, 1), + [454] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_override_op, 1), + [456] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_override_op, 1), + [458] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_dotted_path, 1), + [460] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), + [462] = {.entry = {.count = 1, .reusable = true}}, SHIFT(251), + [464] = {.entry = {.count = 1, .reusable = true}}, SHIFT(214), + [466] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_override_op, 2), + [468] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_override_op, 2), + [470] = {.entry = {.count = 1, .reusable = true}}, SHIFT(176), + [472] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), + [474] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_schedule_repeat1, 2), + [476] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_schedule_repeat1, 2), SHIFT_REPEAT(241), + [479] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_include, 2), + [481] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_include, 2), + [483] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_on_enter, 3), + [485] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_on_enter, 3), + [487] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_arc_state_repeat1, 2), + [489] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_arc_state_repeat1, 2), SHIFT_REPEAT(23), + [492] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), + [494] = {.entry = {.count = 1, .reusable = true}}, SHIFT(204), + [496] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_life_arc_repeat1, 2), + [498] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_life_arc_repeat1, 2), SHIFT_REPEAT(204), + [501] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), + [503] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_use_declaration_repeat1, 2), + [505] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_use_declaration_repeat1, 2), SHIFT_REPEAT(243), + [508] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_participant, 4), + [510] = {.entry = {.count = 2, .reusable = true}}, REDUCE(sym_path_segments, 2), SHIFT(224), + [513] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), + [515] = {.entry = {.count = 1, .reusable = true}}, SHIFT(189), + [517] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83), + [519] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), + [521] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_participant, 2), + [523] = {.entry = {.count = 1, .reusable = true}}, SHIFT(179), + [525] = {.entry = {.count = 1, .reusable = true}}, SHIFT(240), + [527] = {.entry = {.count = 2, .reusable = true}}, REDUCE(sym_path_segments, 1), SHIFT(224), + [530] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_dotted_path_repeat1, 2), + [532] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_dotted_path_repeat1, 2), SHIFT_REPEAT(247), + [535] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), SHIFT_REPEAT(20), + [538] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_list_repeat1, 2), + [540] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), + [542] = {.entry = {.count = 1, .reusable = true}}, SHIFT(123), + [544] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_clause, 3), + [546] = {.entry = {.count = 1, .reusable = true}}, SHIFT(175), + [548] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_dotted_path, 2), + [550] = {.entry = {.count = 1, .reusable = true}}, SHIFT(190), + [552] = {.entry = {.count = 1, .reusable = true}}, SHIFT(222), + [554] = {.entry = {.count = 1, .reusable = true}}, SHIFT(174), + [556] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), + [558] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_clause, 2), + [560] = {.entry = {.count = 1, .reusable = true}}, SHIFT(182), + [562] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_action_node_repeat1, 2), SHIFT_REPEAT(14), + [565] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_action_node_repeat1, 2), + [567] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), + [569] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), + [571] = {.entry = {.count = 1, .reusable = true}}, SHIFT(161), + [573] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_template_clause, 4), + [575] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arc_state, 7, .production_id = 2), + [577] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_transition, 4, .production_id = 12), + [579] = {.entry = {.count = 1, .reusable = false}}, SHIFT_EXTRA(), + [581] = {.entry = {.count = 1, .reusable = false}}, SHIFT(221), + [583] = {.entry = {.count = 1, .reusable = false}}, SHIFT(219), + [585] = {.entry = {.count = 1, .reusable = true}}, SHIFT(205), + [587] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule_block, 6, .production_id = 11), + [589] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arc_state, 4, .production_id = 2), + [591] = {.entry = {.count = 1, .reusable = true}}, SHIFT(210), + [593] = {.entry = {.count = 1, .reusable = true}}, SHIFT(211), + [595] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arc_state, 6, .production_id = 2), + [597] = {.entry = {.count = 1, .reusable = true}}, SHIFT(159), + [599] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), + [601] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_param, 1), + [603] = {.entry = {.count = 1, .reusable = true}}, SHIFT(184), + [605] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), + [607] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action_param, 3), + [609] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_arc_state, 5, .production_id = 2), + [611] = {.entry = {.count = 1, .reusable = true}}, SHIFT(95), + [613] = {.entry = {.count = 1, .reusable = true}}, SHIFT(225), + [615] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19), + [617] = {.entry = {.count = 1, .reusable = true}}, SHIFT(234), + [619] = {.entry = {.count = 1, .reusable = true}}, SHIFT(74), + [621] = {.entry = {.count = 1, .reusable = true}}, SHIFT(135), + [623] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), + [625] = {.entry = {.count = 1, .reusable = true}}, SHIFT(98), + [627] = {.entry = {.count = 1, .reusable = true}}, SHIFT(227), + [629] = {.entry = {.count = 1, .reusable = true}}, SHIFT(168), + [631] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), + [633] = {.entry = {.count = 1, .reusable = true}}, SHIFT(100), + [635] = {.entry = {.count = 1, .reusable = true}}, SHIFT(178), + [637] = {.entry = {.count = 1, .reusable = true}}, SHIFT(170), + [639] = {.entry = {.count = 1, .reusable = true}}, SHIFT(142), + [641] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), + [643] = {.entry = {.count = 1, .reusable = true}}, SHIFT(169), + [645] = {.entry = {.count = 1, .reusable = true}}, SHIFT(129), + [647] = {.entry = {.count = 1, .reusable = true}}, SHIFT(35), + [649] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), + [651] = {.entry = {.count = 1, .reusable = false}}, SHIFT(242), + [653] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), + [655] = {.entry = {.count = 1, .reusable = true}}, SHIFT(217), + [657] = {.entry = {.count = 1, .reusable = true}}, SHIFT(5), + [659] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), + [661] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), + [663] = {.entry = {.count = 1, .reusable = true}}, SHIFT(196), + [665] = {.entry = {.count = 1, .reusable = true}}, SHIFT(223), + [667] = {.entry = {.count = 1, .reusable = true}}, SHIFT(137), + [669] = {.entry = {.count = 1, .reusable = true}}, SHIFT(94), + [671] = {.entry = {.count = 1, .reusable = true}}, SHIFT(191), + [673] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), + [675] = {.entry = {.count = 1, .reusable = true}}, SHIFT(209), + [677] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86), + [679] = {.entry = {.count = 1, .reusable = true}}, SHIFT(109), + [681] = {.entry = {.count = 1, .reusable = true}}, SHIFT(177), + [683] = {.entry = {.count = 1, .reusable = true}}, SHIFT(230), + [685] = {.entry = {.count = 1, .reusable = true}}, SHIFT(199), + [687] = {.entry = {.count = 1, .reusable = true}}, SHIFT(206), + [689] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), + [691] = {.entry = {.count = 1, .reusable = true}}, SHIFT(233), + [693] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), + [695] = {.entry = {.count = 1, .reusable = true}}, SHIFT(202), + [697] = {.entry = {.count = 1, .reusable = true}}, SHIFT(207), + [699] = {.entry = {.count = 1, .reusable = true}}, SHIFT(208), + [701] = {.entry = {.count = 1, .reusable = true}}, SHIFT(197), + [703] = {.entry = {.count = 1, .reusable = true}}, SHIFT(212), + [705] = {.entry = {.count = 1, .reusable = true}}, SHIFT(96), + [707] = {.entry = {.count = 1, .reusable = true}}, SHIFT(79), + [709] = {.entry = {.count = 1, .reusable = true}}, SHIFT(143), + [711] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73), + [713] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), + [715] = {.entry = {.count = 1, .reusable = true}}, SHIFT(85), + [717] = {.entry = {.count = 1, .reusable = true}}, SHIFT(201), + [719] = {.entry = {.count = 1, .reusable = true}}, SHIFT(136), +}; + +#ifdef __cplusplus +extern "C" { +#endif +#ifdef _WIN32 +#define extern __declspec(dllexport) +#endif + +extern const TSLanguage *tree_sitter_storybook(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, + .field_names = ts_field_names, + .field_map_slices = ts_field_map_slices, + .field_map_entries = ts_field_map_entries, + .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, + .keyword_lex_fn = ts_lex_keywords, + .keyword_capture_token = sym_identifier, + .primary_state_ids = ts_primary_state_ids, + }; + return &language; +} +#ifdef __cplusplus +} +#endif diff --git a/tree-sitter-storybook/src/scanner.c b/tree-sitter-storybook/src/scanner.c new file mode 100644 index 0000000..c3a32ef --- /dev/null +++ b/tree-sitter-storybook/src/scanner.c @@ -0,0 +1,157 @@ +/** + * External scanner for Storybook Tree-sitter grammar + * + * This scanner handles prose blocks (---tag content ---) which require + * stateful scanning to properly match opening and closing delimiters. + */ + +#include +#include +#include + +enum TokenType { + PROSE_BLOCK_CONTENT, + PROSE_BLOCK_END, +}; + +typedef struct { + bool in_prose_block; +} Scanner; + +void *tree_sitter_storybook_external_scanner_create() { + Scanner *scanner = (Scanner *)malloc(sizeof(Scanner)); + scanner->in_prose_block = false; + return scanner; +} + +void tree_sitter_storybook_external_scanner_destroy(void *payload) { + Scanner *scanner = (Scanner *)payload; + free(scanner); +} + +unsigned tree_sitter_storybook_external_scanner_serialize( + void *payload, + char *buffer +) { + Scanner *scanner = (Scanner *)payload; + buffer[0] = scanner->in_prose_block ? 1 : 0; + return 1; +} + +void tree_sitter_storybook_external_scanner_deserialize( + void *payload, + const char *buffer, + unsigned length +) { + Scanner *scanner = (Scanner *)payload; + scanner->in_prose_block = (length > 0 && buffer[0] == 1); +} + +/** + * Check if we're at the start of a line (only whitespace before) + */ +static bool at_line_start(TSLexer *lexer) { + // Look back to see if there's only whitespace since last newline + // For simplicity, we'll assume --- at start of content is line-start + return true; // Tree-sitter will handle this check via grammar +} + +/** + * Scan prose block content + * + * Returns true if we successfully scanned content, false otherwise + */ +static bool scan_prose_content(Scanner *scanner, TSLexer *lexer) { + bool has_content = false; + + // Consume characters until we see --- at line start + for (;;) { + // Check for end-of-file + if (lexer->eof(lexer)) { + // If we have content, return it; otherwise error + if (has_content) { + lexer->result_symbol = PROSE_BLOCK_CONTENT; + scanner->in_prose_block = false; + return true; + } + return false; + } + + // Check for closing --- + if (lexer->lookahead == '-') { + // Look ahead to see if it's --- + lexer->mark_end(lexer); + lexer->advance(lexer, false); + + if (lexer->lookahead == '-') { + lexer->advance(lexer, false); + if (lexer->lookahead == '-') { + // Found closing ---, stop here + // Mark end before the --- + scanner->in_prose_block = false; + if (has_content) { + lexer->result_symbol = PROSE_BLOCK_CONTENT; + return true; + } + // No content, scan the closing marker + lexer->result_symbol = PROSE_BLOCK_END; + lexer->advance(lexer, false); // Consume final - + return true; + } + } + // Not a closing marker, continue with content + has_content = true; + continue; + } + + // Regular content character + lexer->advance(lexer, false); + has_content = true; + } +} + +/** + * Scan for closing prose block marker (---) + */ +static bool scan_prose_end(Scanner *scanner, TSLexer *lexer) { + // We should be at --- + if (lexer->lookahead == '-') { + lexer->advance(lexer, false); + if (lexer->lookahead == '-') { + lexer->advance(lexer, false); + if (lexer->lookahead == '-') { + lexer->advance(lexer, false); + lexer->result_symbol = PROSE_BLOCK_END; + scanner->in_prose_block = false; + return true; + } + } + } + return false; +} + +bool tree_sitter_storybook_external_scanner_scan( + void *payload, + TSLexer *lexer, + const bool *valid_symbols +) { + Scanner *scanner = (Scanner *)payload; + + // Skip whitespace at the start + while (iswspace(lexer->lookahead)) { + lexer->advance(lexer, true); + } + + // If we're looking for prose content + if (valid_symbols[PROSE_BLOCK_CONTENT]) { + scanner->in_prose_block = true; + return scan_prose_content(scanner, lexer); + } + + // If we're looking for prose end + if (valid_symbols[PROSE_BLOCK_END]) { + return scan_prose_end(scanner, lexer); + } + + return false; +} diff --git a/tree-sitter-storybook/src/tree_sitter/alloc.h b/tree-sitter-storybook/src/tree_sitter/alloc.h new file mode 100644 index 0000000..1abdd12 --- /dev/null +++ b/tree-sitter-storybook/src/tree_sitter/alloc.h @@ -0,0 +1,54 @@ +#ifndef TREE_SITTER_ALLOC_H_ +#define TREE_SITTER_ALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR + +extern void *(*ts_current_malloc)(size_t size); +extern void *(*ts_current_calloc)(size_t count, size_t size); +extern void *(*ts_current_realloc)(void *ptr, size_t size); +extern void (*ts_current_free)(void *ptr); + +#ifndef ts_malloc +#define ts_malloc ts_current_malloc +#endif +#ifndef ts_calloc +#define ts_calloc ts_current_calloc +#endif +#ifndef ts_realloc +#define ts_realloc ts_current_realloc +#endif +#ifndef ts_free +#define ts_free ts_current_free +#endif + +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ALLOC_H_ diff --git a/tree-sitter-storybook/src/tree_sitter/array.h b/tree-sitter-storybook/src/tree_sitter/array.h new file mode 100644 index 0000000..e99918e --- /dev/null +++ b/tree-sitter-storybook/src/tree_sitter/array.h @@ -0,0 +1,347 @@ +#ifndef TREE_SITTER_ARRAY_H_ +#define TREE_SITTER_ARRAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./alloc.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#define Array(T) \ + struct { \ + T *contents; \ + uint32_t size; \ + uint32_t capacity; \ + } + +/// Initialize an array. +#define array_init(self) \ + ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) + +/// Create an empty array. +#define array_new() \ + { NULL, 0, 0 } + +/// Get a pointer to the element at a given `index` in the array. +#define array_get(self, _index) \ + (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) + +/// Get a pointer to the first element in the array. +#define array_front(self) array_get(self, 0) + +/// Get a pointer to the last element in the array. +#define array_back(self) array_get(self, (self)->size - 1) + +/// Clear the array, setting its size to zero. Note that this does not free any +/// memory allocated for the array's contents. +#define array_clear(self) ((self)->size = 0) + +/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is +/// less than the array's current capacity, this function has no effect. +#define array_reserve(self, new_capacity) \ + ((self)->contents = _array__reserve( \ + (void *)(self)->contents, &(self)->capacity, \ + array_elem_size(self), new_capacity) \ + ) + +/// Free any memory allocated for this array. Note that this does not free any +/// memory allocated for the array's contents. +#define array_delete(self) _array__delete((self), (void *)(self)->contents, sizeof(*self)) + +/// Push a new `element` onto the end of the array. +#define array_push(self, element) \ + do { \ + (self)->contents = _array__grow( \ + (void *)(self)->contents, (self)->size, &(self)->capacity, \ + 1, array_elem_size(self) \ + ); \ + (self)->contents[(self)->size++] = (element); \ + } while(0) + +/// Increase the array's size by `count` elements. +/// New elements are zero-initialized. +#define array_grow_by(self, count) \ + do { \ + if ((count) == 0) break; \ + (self)->contents = _array__grow( \ + (self)->contents, (self)->size, &(self)->capacity, \ + count, array_elem_size(self) \ + ); \ + memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ + (self)->size += (count); \ + } while (0) + +/// Append all elements from one array to the end of another. +#define array_push_all(self, other) \ + array_extend((self), (other)->size, (other)->contents) + +/// Append `count` elements to the end of the array, reading their values from the +/// `contents` pointer. +#define array_extend(self, count, other_contents) \ + (self)->contents = _array__splice( \ + (void*)(self)->contents, &(self)->size, &(self)->capacity, \ + array_elem_size(self), (self)->size, 0, count, other_contents \ + ) + +/// Remove `old_count` elements from the array starting at the given `index`. At +/// the same index, insert `new_count` new elements, reading their values from the +/// `new_contents` pointer. +#define array_splice(self, _index, old_count, new_count, new_contents) \ + (self)->contents = _array__splice( \ + (void *)(self)->contents, &(self)->size, &(self)->capacity, \ + array_elem_size(self), _index, old_count, new_count, new_contents \ + ) + +/// Insert one `element` into the array at the given `index`. +#define array_insert(self, _index, element) \ + (self)->contents = _array__splice( \ + (void *)(self)->contents, &(self)->size, &(self)->capacity, \ + array_elem_size(self), _index, 0, 1, &(element) \ + ) + +/// Remove one element from the array at the given `index`. +#define array_erase(self, _index) \ + _array__erase((void *)(self)->contents, &(self)->size, array_elem_size(self), _index) + +/// Pop the last element off the array, returning the element by value. +#define array_pop(self) ((self)->contents[--(self)->size]) + +/// Assign the contents of one array to another, reallocating if necessary. +#define array_assign(self, other) \ + (self)->contents = _array__assign( \ + (void *)(self)->contents, &(self)->size, &(self)->capacity, \ + (const void *)(other)->contents, (other)->size, array_elem_size(self) \ + ) + +/// Swap one array with another +#define array_swap(self, other) \ + do { \ + struct Swap swapped_contents = _array__swap( \ + (void *)(self)->contents, &(self)->size, &(self)->capacity, \ + (void *)(other)->contents, &(other)->size, &(other)->capacity \ + ); \ + (self)->contents = swapped_contents.self_contents; \ + (other)->contents = swapped_contents.other_contents; \ + } while (0) + +/// Get the size of the array contents +#define array_elem_size(self) (sizeof *(self)->contents) + +/// Search a sorted array for a given `needle` value, using the given `compare` +/// callback to determine the order. +/// +/// If an existing element is found to be equal to `needle`, then the `index` +/// out-parameter is set to the existing value's index, and the `exists` +/// out-parameter is set to true. Otherwise, `index` is set to an index where +/// `needle` should be inserted in order to preserve the sorting, and `exists` +/// is set to false. +#define array_search_sorted_with(self, compare, needle, _index, _exists) \ + _array__search_sorted(self, 0, compare, , needle, _index, _exists) + +/// Search a sorted array for a given `needle` value, using integer comparisons +/// of a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_with`. +#define array_search_sorted_by(self, field, needle, _index, _exists) \ + _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) + +/// Insert a given `value` into a sorted array, using the given `compare` +/// callback to determine the order. +#define array_insert_sorted_with(self, compare, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +/// Insert a given `value` into a sorted array, using integer comparisons of +/// a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_by`. +#define array_insert_sorted_by(self, field, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +// Private + +// Pointers to individual `Array` fields (rather than the entire `Array` itself) +// are passed to the various `_array__*` functions below to address strict aliasing +// violations that arises when the _entire_ `Array` struct is passed as `Array(void)*`. +// +// The `Array` type itself was not altered as a solution in order to avoid breakage +// with existing consumers (in particular, parsers with external scanners). + +/// This is not what you're looking for, see `array_delete`. +static inline void _array__delete(void *self, void *contents, size_t self_size) { + if (contents) ts_free(contents); + if (self) memset(self, 0, self_size); +} + +/// This is not what you're looking for, see `array_erase`. +static inline void _array__erase(void* self_contents, uint32_t *size, + size_t element_size, uint32_t index) { + assert(index < *size); + char *contents = (char *)self_contents; + memmove(contents + index * element_size, contents + (index + 1) * element_size, + (*size - index - 1) * element_size); + (*size)--; +} + +/// This is not what you're looking for, see `array_reserve`. +static inline void *_array__reserve(void *contents, uint32_t *capacity, + size_t element_size, uint32_t new_capacity) { + void *new_contents = contents; + if (new_capacity > *capacity) { + if (contents) { + new_contents = ts_realloc(contents, new_capacity * element_size); + } else { + new_contents = ts_malloc(new_capacity * element_size); + } + *capacity = new_capacity; + } + return new_contents; +} + +/// This is not what you're looking for, see `array_assign`. +static inline void *_array__assign(void* self_contents, uint32_t *self_size, uint32_t *self_capacity, + const void *other_contents, uint32_t other_size, size_t element_size) { + void *new_contents = _array__reserve(self_contents, self_capacity, element_size, other_size); + *self_size = other_size; + memcpy(new_contents, other_contents, *self_size * element_size); + return new_contents; +} + +struct Swap { + void *self_contents; + void *other_contents; +}; + +/// This is not what you're looking for, see `array_swap`. +// static inline void _array__swap(Array *self, Array *other) { +static inline struct Swap _array__swap(void *self_contents, uint32_t *self_size, uint32_t *self_capacity, + void *other_contents, uint32_t *other_size, uint32_t *other_capacity) { + void *new_self_contents = other_contents; + uint32_t new_self_size = *other_size; + uint32_t new_self_capacity = *other_capacity; + + void *new_other_contents = self_contents; + *other_size = *self_size; + *other_capacity = *self_capacity; + + *self_size = new_self_size; + *self_capacity = new_self_capacity; + + struct Swap out = { + .self_contents = new_self_contents, + .other_contents = new_other_contents, + }; + return out; +} + +/// This is not what you're looking for, see `array_push` or `array_grow_by`. +static inline void *_array__grow(void *contents, uint32_t size, uint32_t *capacity, + uint32_t count, size_t element_size) { + void *new_contents = contents; + uint32_t new_size = size + count; + if (new_size > *capacity) { + uint32_t new_capacity = *capacity * 2; + if (new_capacity < 8) new_capacity = 8; + if (new_capacity < new_size) new_capacity = new_size; + new_contents = _array__reserve(contents, capacity, element_size, new_capacity); + } + return new_contents; +} + +/// This is not what you're looking for, see `array_splice`. +static inline void *_array__splice(void *self_contents, uint32_t *size, uint32_t *capacity, + size_t element_size, + uint32_t index, uint32_t old_count, + uint32_t new_count, const void *elements) { + uint32_t new_size = *size + new_count - old_count; + uint32_t old_end = index + old_count; + uint32_t new_end = index + new_count; + assert(old_end <= *size); + + void *new_contents = _array__reserve(self_contents, capacity, element_size, new_size); + + char *contents = (char *)new_contents; + if (*size > old_end) { + memmove( + contents + new_end * element_size, + contents + old_end * element_size, + (*size - old_end) * element_size + ); + } + if (new_count > 0) { + if (elements) { + memcpy( + (contents + index * element_size), + elements, + new_count * element_size + ); + } else { + memset( + (contents + index * element_size), + 0, + new_count * element_size + ); + } + } + *size += new_count - old_count; + + return new_contents; +} + +/// A binary search routine, based on Rust's `std::slice::binary_search_by`. +/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. +#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ + do { \ + *(_index) = start; \ + *(_exists) = false; \ + uint32_t size = (self)->size - *(_index); \ + if (size == 0) break; \ + int comparison; \ + while (size > 1) { \ + uint32_t half_size = size / 2; \ + uint32_t mid_index = *(_index) + half_size; \ + comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ + if (comparison <= 0) *(_index) = mid_index; \ + size -= half_size; \ + } \ + comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ + if (comparison == 0) *(_exists) = true; \ + else if (comparison < 0) *(_index) += 1; \ + } while (0) + +/// Helper macro for the `_sorted_by` routines below. This takes the left (existing) +/// parameter by reference in order to work with the generic sorting function above. +#define _compare_int(a, b) ((int)*(a) - (int)(b)) + +#ifdef _MSC_VER +#pragma warning(pop) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ARRAY_H_ diff --git a/tree-sitter-storybook/src/tree_sitter/parser.h b/tree-sitter-storybook/src/tree_sitter/parser.h new file mode 100644 index 0000000..2b14ac1 --- /dev/null +++ b/tree-sitter-storybook/src/tree_sitter/parser.h @@ -0,0 +1,224 @@ +#ifndef TREE_SITTER_PARSER_H_ +#define TREE_SITTER_PARSER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#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_ diff --git a/tree-sitter-storybook/test/corpus/basic.txt b/tree-sitter-storybook/test/corpus/basic.txt new file mode 100644 index 0000000..1476cd8 --- /dev/null +++ b/tree-sitter-storybook/test/corpus/basic.txt @@ -0,0 +1,58 @@ +================== +Simple character +================== + +character Alice { + age: 7 +} + +--- + +(source_file + (declaration + (character + name: (identifier) + body: (block + (field + name: (dotted_path (identifier)) + value: (value (integer))))))) + +================== +Use declaration +================== + +use schema::core::Item; + +--- + +(source_file + (declaration + (use_declaration + (path_segments + (identifier) + (identifier) + (identifier))))) + +================== +Prose block +================== + +character Bob { + ---backstory + This is Bob's story. + --- +} + +--- + +(source_file + (declaration + (character + name: (identifier) + body: (block + (field + (prose_block + marker: (prose_marker) + tag: (identifier) + content: (prose_content) + end: (prose_marker))))))) diff --git a/tree-sitter-storybook/test/corpus/behaviors.txt b/tree-sitter-storybook/test/corpus/behaviors.txt new file mode 100644 index 0000000..c8262d4 --- /dev/null +++ b/tree-sitter-storybook/test/corpus/behaviors.txt @@ -0,0 +1,180 @@ +================== +Simple Behavior +================== + +behavior SimpleBehavior { + walk_around +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (action_node (identifier)))))) + +================== +Selector Behavior +================== + +behavior SelectorBehavior { + ? { + try_option_a + try_option_b + fallback + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (selector_node + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier)))))))) + +================== +Sequence Behavior +================== + +behavior SequenceBehavior { + > { + check_energy + move_to_location + perform_action + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (sequence_node + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier)))))))) + +================== +Nested Behavior +================== + +behavior NestedBehavior { + > { + ? { + check_condition_a + check_condition_b + } + perform_action + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (sequence_node + (behavior_node + (selector_node + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier))))) + (behavior_node (action_node (identifier)))))))) + +================== +Repeat Behavior +================== + +behavior RepeatBehavior { + * { + patrol + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (repeat_node + (behavior_node (action_node (identifier)))))))) + +================== +Behavior with Subtree +================== + +behavior WithSubtree { + > { + @helpers::check_preconditions + main_action + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (sequence_node + (behavior_node + (subtree_node + (path + (path_segments + (identifier) + (identifier))))) + (behavior_node (action_node (identifier)))))))) + +================== +Complex Nested Behavior +================== + +behavior ComplexBehavior { + ? { + > { + check_threat + flee_to_safety + } + > { + check_resources + gather_resources + } + * { + idle + } + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (selector_node + (behavior_node + (sequence_node + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier))))) + (behavior_node + (sequence_node + (behavior_node (action_node (identifier))) + (behavior_node (action_node (identifier))))) + (behavior_node + (repeat_node + (behavior_node (action_node (identifier)))))))))) + diff --git a/tree-sitter-storybook/test/corpus/declarations.txt b/tree-sitter-storybook/test/corpus/declarations.txt new file mode 100644 index 0000000..6f1f551 --- /dev/null +++ b/tree-sitter-storybook/test/corpus/declarations.txt @@ -0,0 +1,577 @@ +================== +Use declaration - simple +================== + +use schema::core::Item; + +--- + +(source_file + (declaration + (use_declaration + (path_segments + (identifier) + (identifier) + (identifier))))) + +================== +Use declaration - grouped import +================== + +use schema::core::{Item1, Item2, Item3}; + +--- + +(source_file + (declaration + (use_declaration + (path_segments + (identifier) + (identifier)) + (identifier) + (identifier) + (identifier)))) + +================== +Use declaration - wildcard +================== + +use schema::beings::*; + +--- + +(source_file + (declaration + (use_declaration + (path_segments + (identifier) + (identifier))))) + +================== +Character - full featured +================== + +character Alice: Human from Curious { + age: 7 + height: 4.2 + name: "Alice Liddell" + curious: true + age_range: 5..10 + + ---backstory + A curious young girl. + --- +} + +--- + +(source_file + (declaration + (character + name: (identifier) + species: (identifier) + template: (template_clause (identifier)) + body: (block + (field + name: (dotted_path (identifier)) + value: (value (integer))) + (field + name: (dotted_path (identifier)) + value: (value (float))) + (field + name: (dotted_path (identifier)) + value: (value (string))) + (field + name: (dotted_path (identifier)) + value: (value (boolean))) + (field + name: (dotted_path (identifier)) + value: (value (range (integer) (integer)))) + (field + (prose_block + marker: (prose_marker) + tag: (identifier) + content: (prose_content) + end: (prose_marker))))))) + +================== +Template with includes +================== + +template BaseCharacter strict { + include Physical + include Mental + + age: 0 + name: "" +} + +--- + +(source_file + (declaration + (template + name: (identifier) + (include (identifier)) + (include (identifier)) + (field + name: (dotted_path (identifier)) + value: (value (integer))) + (field + name: (dotted_path (identifier)) + value: (value (string)))))) + +================== +Life arc with states and transitions +================== + +life_arc Journey { + ---description + The character's journey. + --- + + state young { + on enter { + age: 5 + } + + on age >= 18 -> adult + } + + state adult { + on retire is true -> retired + } + + state retired { + } +} + +--- + +(source_file + (declaration + (life_arc + name: (identifier) + (field + (prose_block + marker: (prose_marker) + tag: (identifier) + content: (prose_content) + end: (prose_marker))) + (arc_state + name: (identifier) + (on_enter + (block + (field + name: (dotted_path (identifier)) + value: (value (integer))))) + (transition + condition: (expression + (comparison + (expression (primary_expression (path (path_segments (identifier))))) + (expression (primary_expression (integer))))) + target: (identifier))) + (arc_state + name: (identifier) + (transition + condition: (expression + (comparison + (expression (primary_expression (path (path_segments (identifier))))) + (expression (primary_expression (boolean))))) + target: (identifier))) + (arc_state + name: (identifier))))) + +================== +Schedule with time blocks +================== + +schedule DailyRoutine { + 08:00 -> 09:00: breakfast { + location: kitchen + } + + 09:00 -> 12:00: work { + duration: 3h + } +} + +--- + +(source_file + (declaration + (schedule + name: (identifier) + (schedule_block + start: (time) + end: (time) + activity: (identifier) + (block + (field + name: (dotted_path (identifier)) + value: (value (path (path_segments (identifier))))))) + (schedule_block + start: (time) + end: (time) + activity: (identifier) + (block + (field + name: (dotted_path (identifier)) + value: (value (duration)))))))) + +================== +Behavior tree - all node types +================== + +behavior GuardBehavior { + ? { + patrol + > { + detect_threat + alert(priority: high, "Guard duty") + } + * { + watch + } + @base::behaviors::Idle + } +} + +--- + +(source_file + (declaration + (behavior + name: (identifier) + root: (behavior_node + (selector_node + (behavior_node (action_node (identifier))) + (behavior_node + (sequence_node + (behavior_node (action_node (identifier))) + (behavior_node + (action_node + (identifier) + (action_param + (dotted_path (identifier)) + (value (path (path_segments (identifier))))) + (action_param + (value (string))))))) + (behavior_node + (repeat_node + (behavior_node (action_node (identifier))))) + (behavior_node + (subtree_node + (path + (path_segments + (identifier) + (identifier) + (identifier)))))))))) + +================== +Institution +================== + +institution Wonderland { + type: "fantasy_realm" + ruler: "Queen of Hearts" +} + +--- + +(source_file + (declaration + (institution + name: (identifier) + (block + (field + name: (dotted_path (identifier)) + value: (value (string))) + (field + name: (dotted_path (identifier)) + value: (value (string))))))) + +================== +Relationship with participants +================== + +relationship Friendship { + Alice { + bond_strength: 5 + } + + WhiteRabbit as friend { + trust: 0.8 + } + + Caterpillar +} + +--- + +(source_file + (declaration + (relationship + name: (identifier) + (participant + (path (path_segments (identifier))) + (block + (field + name: (dotted_path (identifier)) + value: (value (integer))))) + (participant + (path (path_segments (identifier))) + (identifier) + (block + (field + name: (dotted_path (identifier)) + value: (value (float))))) + (participant + (path (path_segments (identifier))))))) + +================== +Location +================== + +location TeaParty { + description: "A mad tea party" + capacity: 10 +} + +--- + +(source_file + (declaration + (location + name: (identifier) + (block + (field + name: (dotted_path (identifier)) + value: (value (string))) + (field + name: (dotted_path (identifier)) + value: (value (integer))))))) + +================== +Species with includes +================== + +species Cat { + include Mammal + + purrs: true + lives: 9 +} + +--- + +(source_file + (declaration + (species + name: (identifier) + (include (identifier)) + (field + name: (dotted_path (identifier)) + value: (value (boolean))) + (field + name: (dotted_path (identifier)) + value: (value (integer)))))) + +================== +Enum declaration +================== + +enum EmotionalState { + happy, sad, angry, confused, curious +} + +--- + +(source_file + (declaration + (enum_declaration + name: (identifier) + (identifier) + (identifier) + (identifier) + (identifier) + (identifier)))) + +================== +Override syntax +================== + +character SpecialAlice { + base: @Alice { + remove backstory + append age_category: "child" + curious: false + } +} + +--- + +(source_file + (declaration + (character + name: (identifier) + body: (block + (field + name: (dotted_path (identifier)) + value: (value + (override + (path (path_segments (identifier))) + (override_op (identifier)) + (override_op + (field + name: (dotted_path (identifier)) + value: (value (string)))) + (override_op + (field + name: (dotted_path (identifier)) + value: (value (boolean))))))))))) + +================== +Complex expressions in conditions +================== + +life_arc ComplexLogic { + state test { + on self.age > 18 and other.trust >= 0.5 -> trusted + on not self.valid or self.expired is true -> invalid + } + + state trusted { + } + + state invalid { + } +} + +--- + +(source_file + (declaration + (life_arc + name: (identifier) + (arc_state + name: (identifier) + (transition + condition: (expression + (and_expression + (expression + (comparison + (expression + (field_access + (expression (primary_expression)) + (identifier))) + (expression (primary_expression (integer))))) + (expression + (comparison + (expression + (field_access + (expression (primary_expression)) + (identifier))) + (expression (primary_expression (float))))))) + target: (identifier)) + (transition + condition: (expression + (or_expression + (expression + (not_expression + (expression + (field_access + (expression (primary_expression)) + (identifier))))) + (expression + (comparison + (expression + (field_access + (expression (primary_expression)) + (identifier))) + (expression (primary_expression (boolean))))))) + target: (identifier))) + (arc_state + name: (identifier)) + (arc_state + name: (identifier))))) + +================== +List and object values +================== + +character DataRich { + tags: ["smart", "brave", "curious"] + stats: { + strength: 10 + intelligence: 15 + } + matrix: [[1, 2], [3, 4]] +} + +--- + +(source_file + (declaration + (character + name: (identifier) + body: (block + (field + name: (dotted_path (identifier)) + value: (value + (list + (value (string)) + (value (string)) + (value (string))))) + (field + name: (dotted_path (identifier)) + value: (value + (object + (block + (field + name: (dotted_path (identifier)) + value: (value (integer))) + (field + name: (dotted_path (identifier)) + value: (value (integer))))))) + (field + name: (dotted_path (identifier)) + value: (value + (list + (value + (list + (value (integer)) + (value (integer)))) + (value + (list + (value (integer)) + (value (integer))))))))))) + +================== +Dotted field paths +================== + +character Nested { + appearance.hair.color: "blonde" + stats.mental.intelligence: 15 +} + +--- + +(source_file + (declaration + (character + name: (identifier) + body: (block + (field + name: (dotted_path + (identifier) + (identifier) + (identifier)) + value: (value (string))) + (field + name: (dotted_path + (identifier) + (identifier) + (identifier)) + value: (value (integer))))))) diff --git a/tree-sitter-storybook/tree-sitter.json b/tree-sitter-storybook/tree-sitter.json new file mode 100644 index 0000000..fc93f20 --- /dev/null +++ b/tree-sitter-storybook/tree-sitter.json @@ -0,0 +1,24 @@ +{ + "grammars": [ + { + "name": "storybook", + "path": ".", + "scope": "source.storybook", + "file-types": ["sb"], + "highlights": ["queries/highlights.scm"], + "injections": ["queries/injections.scm"] + } + ], + "bindings": { + "c": {}, + "node": {}, + "python": {}, + "rust": {}, + "go": {}, + "swift": {} + }, + "metadata": { + "version": "0.1.0", + "license": "MIT" + } +}