aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--bindings/rust/lib.rs6
-rw-r--r--example.api19
-rw-r--r--package.json2
4 files changed, 25 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 3ed407b..46c2966 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,12 +1,12 @@
[package]
name = "tree-sitter-api-notation"
description = "api-notation grammar for the tree-sitter parsing library"
-version = "1.0.0"
+version = "0.0.1"
keywords = ["incremental", "parsing", "api-notation"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-api-notation"
edition = "2018"
-license = "Apache-2.0"
+license = "MIT"
build = "bindings/rust/build.rs"
include = [
diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs
index 7bc923a..0bbddda 100644
--- a/bindings/rust/lib.rs
+++ b/bindings/rust/lib.rs
@@ -1,4 +1,4 @@
-//! This crate provides api-notation language support for the [tree-sitter][] parsing library.
+//! This crate provides api_notation 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:
@@ -6,7 +6,7 @@
//! ```
//! let code = "";
//! let mut parser = tree_sitter::Parser::new();
-//! parser.set_language(tree_sitter_api_notation::language()).expect("Error loading api-notation grammar");
+//! parser.set_language(tree_sitter_api_notation::language()).expect("Error loading api_notation grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!
@@ -47,6 +47,6 @@ mod tests {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
- .expect("Error loading api-notation language");
+ .expect("Error loading api_notation language");
}
}
diff --git a/example.api b/example.api
new file mode 100644
index 0000000..37e08d8
--- /dev/null
+++ b/example.api
@@ -0,0 +1,19 @@
+Forum.Models.Post
+ +glyphs <Array<String>>
+ -id <UUID>
+ -created_at <Date>
+ -parent_id <UUID>
+ -text <String>
+ -author <Author>
+ // Comments are also
+ // Allowed in the middle
+ ~>textUpdated(text <String>)
+ ->authorUpdated(author <Author>)
+ <~textWillUpdate(text <String>)
+ <-postWillRender(post <Forum.Models.Post>)
+ +>authorUpdated(author <Author>)
+ <+textWillUpdate(text <String>)
+ ::getAll(parent_id <UUID>) => Promise<Array<Forum.Models.Post>> #> NotFoundError,DisplayError
+ ::get(id <UUID>) => Promise<Forum.Models.Post>
+ #update(text <String>) => Promise<void>
+ #transform([transformer] <Function<T>(T) => boolean>)
diff --git a/package.json b/package.json
index de62554..5169fca 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"tree-sitter-cli": "^0.20.8"
},
"scripts": {
- "build": "tree-sitter generate && node-gyp build",
+ "build": "tree-sitter generate",
"parse": "tree-sitter parse",
"test": "tree-sitter test"
},