Skip to content

Commit

Permalink
Revert "feat: introduce raw strings (#113)"
Browse files Browse the repository at this point in the history
This reverts commit b10a7b9.
  • Loading branch information
fdncred authored Sep 24, 2024
1 parent b10a7b9 commit 742979b
Show file tree
Hide file tree
Showing 18 changed files with 427,997 additions and 434,973 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- main
jobs:
main:
name: setup, lint and test
name: install

runs-on: ${{ matrix.os }}
strategy:
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let package = Package(
],
sources: [
"src/parser.c",
"src/scanner.c",
// NOTE: if your language has an external scanner, add it here.
],
resources: [
.copy("queries")
Expand Down
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"sources": [
"bindings/node/binding.cc",
"src/parser.c",
"src/scanner.c"
# NOTE: if your language has an external scanner, add it here.
],
"conditions": [
["OS!='win'", {
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tree_sitter_nu

// #cgo CFLAGS: -std=c11 -fPIC
// #include "../../src/parser.c"
// #include "../../src/scanner.c"
// // NOTE: if your language has an external scanner, add it here.
import "C"

import "unsafe"
Expand Down
2 changes: 2 additions & 0 deletions bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ fn main() {
// 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());
Expand Down
18 changes: 4 additions & 14 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ module.exports = grammar({

extras: ($) => [/\s/, $.comment],

externals: ($) => [
$.raw_string_begin,
$.raw_string_content,
$.raw_string_end,
],
// externals: $ => [
// $.long_flag_equals_value
// ],

conflicts: ($) => [
[$._declaration, $._declaration_last],
Expand Down Expand Up @@ -1011,15 +1009,7 @@ module.exports = grammar({
),

val_string: ($) =>
choice(
$._str_double_quotes,
$._str_single_quotes,
$._str_back_ticks,
$._raw_str,
),

_raw_str: ($) =>
seq($.raw_string_begin, $.raw_string_content, $.raw_string_end),
choice($._str_double_quotes, $._str_single_quotes, $._str_back_ticks),

_str_double_quotes: ($) =>
seq(
Expand Down
2 changes: 1 addition & 1 deletion installation/neovim.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.nu = {
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c", "src/scanner.c" },
files = { "src/parser.c" },
branch = "main",
},
filetype = "nu",
Expand Down
5 changes: 1 addition & 4 deletions nurfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
def "nur build" [] {
def "nur run" [] {
tree-sitter generate
}

def "nur test" [] {
tree-sitter test
}

55 changes: 26 additions & 29 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "The Nushell Contributors",
"license": "MIT",
"dependencies": {
"node-addon-api": "^8.1.0",
"node-gyp-build": "^4.8.2"
"node-addon-api": "^8.0.0",
"node-gyp-build": "^4.8.0"
},
"peerDependencies": {
"tree-sitter": "^0.21.0"
Expand All @@ -25,9 +25,9 @@
}
},
"devDependencies": {
"prettier": "3.3.3",
"tree-sitter-cli": "^0.23.0",
"prebuildify": "^6.0.1"
"prettier": "3.2.5",
"tree-sitter-cli": "^0.22.5",
"prebuildify": "^6.0.0"
},
"tree-sitter": [
{
Expand Down
18 changes: 8 additions & 10 deletions plugin/init.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
vim.filetype.add({ extension = { nu = "nu" }, filename = { ["nurfile"] = "nu" } })

vim.api.nvim_create_autocmd("FileType", {
pattern = "nu",
callback = function(event)
vim.bo[event.buf].commentstring = "# %s"
end,
pattern = "nu",
callback = function(event) vim.bo[event.buf].commentstring = "# %s" end,
})

require("nvim-treesitter.parsers").get_parser_configs().nu = {
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
filetype = "nu",
install_info = {
url = "https://github.com/nushell/tree-sitter-nu",
files = { "src/parser.c" },
branch = "main",
},
filetype = "nu",
}
4 changes: 0 additions & 4 deletions queries/nu/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ file_path: (val_string) @variable.parameter
(escaped_interpolated_content) @string
(expr_interpolated ["(" ")"] @variable.parameter)

(raw_string_begin) @string
(raw_string_content) @string
(raw_string_end) @string

;;; ---
;;; operators
(expr_binary [
Expand Down
Loading

0 comments on commit 742979b

Please sign in to comment.