Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new attribute shorthand #173

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bindings/node/binding_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="node" />

const assert = require("node:assert");
const { test } = require("node:test");

test("can load grammar", () => {
const parser = new (require("tree-sitter"))();
assert.doesNotThrow(() => parser.setLanguage(require(".")));
});
11 changes: 11 additions & 0 deletions bindings/python/tests/test_binding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from unittest import TestCase

import tree_sitter, tree_sitter_just


class TestLanguage(TestCase):
def test_can_load_grammar(self):
try:
tree_sitter.Language(tree_sitter_just.language())
except Exception:
self.fail("Error loading Just grammar")
12 changes: 12 additions & 0 deletions bindings/swift/TreeSitterJustTests/TreeSitterJustTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest
import SwiftTreeSitter
import TreeSitterJust

final class TreeSitterJustTests: XCTestCase {
func testCanLoadGrammar() throws {
let parser = Parser()
let language = Language(language: tree_sitter_just())
XCTAssertNoThrow(try parser.setLanguage(language),
"Error loading Just grammar")
}
}
8 changes: 2 additions & 6 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,8 @@ module.exports = grammar({
comma_sep1(
choice(
$.identifier,
seq(
$.identifier,
"(",
field("argument", comma_sep1($.string)),
")",
),
seq($.identifier, "(", field("argument", comma_sep1($.string)), ")"),
seq($.identifier, ":", field("argument", $.string)),
),
),
"]",
Expand Down
42 changes: 42 additions & 0 deletions src/grammar.json

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

2 changes: 1 addition & 1 deletion src/node-types.json

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

Loading
Loading