Skip to content

Commit

Permalink
Add to support type alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Apr 10, 2024
1 parent 24d3cf9 commit 8370a41
Show file tree
Hide file tree
Showing 9 changed files with 24,543 additions and 24,084 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-navi"
description = "Navi grammar for the tree-sitter parsing library"
version = "0.0.13"
version = "0.0.14"
keywords = ["incremental", "parsing", "navi"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-navi"
Expand Down
15 changes: 12 additions & 3 deletions examples/bind.nv
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
use std.io;
use std.io.Bytes;
use std.io;
use std.time.{self, DateTime, Duration};

use _sql.BindValue as _BindValue;

/// A union type for query binding values.
pub type BindValue = int | string | bool | float | DateTime | Duration | [string] | [int] | [float];
pub type NamedBindValue = <string, <string, BindValue? | float? | bool | [string] | any>>;
pub type alias BindValue =
int |
string |
bool |
float |
DateTime |
Duration |
[string] |
[int] |
[float];
pub type alias NamedBindValue = <string, <string, BindValue? | float? | bool | [string] | any>>;

pub const STATEMENT_TYPE_SELECT: string = `Hello ${DateTime.now() - 100.day()}`;

Expand Down
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ module.exports = grammar({
alias(choice(...primitive_types), $.primitive_type),
prec.right(repeat1(choice(...TOKEN_TREE_NON_SPECIAL_TOKENS))),
"'",
"alias",
"as",
"assert",
"assert_eq",
Expand Down Expand Up @@ -315,6 +316,7 @@ module.exports = grammar({
seq(
optional($.visibility_modifier),
"type",
optional("alias"),
field("name", $._type_identifier),
// field("type_parameters", optional($.type_parameters)),
"=",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tree-sitter-navi",
"version": "0.0.13",
"version": "0.0.14",
"description": "Navi grammar for tree-sitter",
"main": "bindings/node",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
(parameter (identifier) @variable.parameter)

[
"alias"
"as"
"assert"
"assert_eq"
Expand Down
20 changes: 20 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8370a41

Please sign in to comment.