Skip to content

Commit

Permalink
rename grammar to t-s-ssh-client-config
Browse files Browse the repository at this point in the history
This aligns its name with other grammars like git-config

Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Mar 21, 2023
1 parent bc8a266 commit f4f4a4a
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/
target/
.nyc_output/
crash.txt
fuzz/afl.rs/out
fuzz/aflplusplus/out
/.build/
test/upstream/options
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"targets": [
{
"target_name": "tree_sitter_sshclientconfig_binding",
"target_name": "tree_sitter_ssh_client_config_binding",
"include_dirs": [
"<!(node -e \"require('nan')\")",
"src"
Expand Down
8 changes: 4 additions & 4 deletions bindings/node/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace v8;

extern "C" TSLanguage * tree_sitter_sshclientconfig();
extern "C" TSLanguage * tree_sitter_ssh_client_config();

namespace {

Expand All @@ -17,12 +17,12 @@ void Init(Local<Object> exports, Local<Object> module) {

Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked();
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_sshclientconfig());
Nan::SetInternalFieldPointer(instance, 0, tree_sitter_ssh_client_config());

Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("sshclientconfig").ToLocalChecked());
Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("ssh-client-config").ToLocalChecked());
Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
}

NODE_MODULE(tree_sitter_sshclientconfig_binding, Init)
NODE_MODULE(tree_sitter_ssh_client_config_binding, Init)

} // namespace
4 changes: 2 additions & 2 deletions bindings/node/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
try {
module.exports = require("../../build/Release/tree_sitter_sshclientconfig_binding");
module.exports = require("../../build/Release/tree_sitter_ssh_client_config_binding");
} catch (error1) {
if (error1.code !== 'MODULE_NOT_FOUND') {
throw error1;
}
try {
module.exports = require("../../build/Debug/tree_sitter_sshclientconfig_binding");
module.exports = require("../../build/Debug/tree_sitter_ssh_client_config_binding");
} catch (error2) {
if (error2.code !== 'MODULE_NOT_FOUND') {
throw error2;
Expand Down
10 changes: 5 additions & 5 deletions bindings/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! This crate provides sshclientconfig language support for the [tree-sitter][] parsing library.
//! This crate provides ssh-client-config 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_sshclientconfig::language()).expect("Error loading sshclientconfig grammar");
//! parser.set_language(tree_sitter_ssh_client_config::language()).expect("Error loading ssh-client-config grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!
Expand All @@ -18,14 +18,14 @@
use tree_sitter::Language;

extern "C" {
fn tree_sitter_sshclientconfig() -> Language;
fn tree_sitter_ssh_client_config() -> 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_sshclientconfig() }
unsafe { tree_sitter_ssh_client_config() }
}

/// The content of the [`node-types.json`][] file for this grammar.
Expand All @@ -47,6 +47,6 @@ mod tests {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading sshclientconfig language");
.expect("Error loading ssh-client-config language");
}
}
8 changes: 4 additions & 4 deletions bindings/swift/TreeSitterSSHClientConfig/sshclientconfig.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef TREE_SITTER_SSHCLIENTCONFIG_H_
#define TREE_SITTER_SSHCLIENTCONFIG_H_
#ifndef TREE_SITTER_SSH_CLIENT_CONFIG_H_
#define TREE_SITTER_SSH_CLIENT_CONFIG_H_

typedef struct TSLanguage TSLanguage;

#ifdef __cplusplus
extern "C" {
#endif

extern TSLanguage *tree_sitter_sshclientconfig();
extern TSLanguage *tree_sitter_ssh_client_config();

#ifdef __cplusplus
}
#endif

#endif // TREE_SITTER_SSHCLIENTCONFIG_H_
#endif // TREE_SITTER_SSH_CLIENT_CONFIG_H_
4 changes: 2 additions & 2 deletions fuzz/aflplusplus/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ use encoding_rs::UTF_8;
use encoding_rs_io::DecodeReaderBytesBuilder;

extern "C" {
fn tree_sitter_sshclientconfig() -> Language;
fn tree_sitter_ssh_client_config() -> Language;
}

fn main() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();
let filename = &args[1];

let language = unsafe { tree_sitter_sshclientconfig() };
let language = unsafe { tree_sitter_ssh_client_config() };
let mut parser = Parser::new();
parser.set_language(language).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = grammar({
name: 'sshclientconfig',
name: 'ssh_client_config',

extras: $ => [
$.comment,
Expand Down
19 changes: 0 additions & 19 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
"contributors": [],
"license": "CC0-1.0",
"dependencies": {
"nan": "^2.17.0"
"nan": "2.17.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.7"
"tree-sitter-cli": "0.20.7"
},
"tree-sitter": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sshclientconfig",
"name": "ssh_client_config",
"rules": {
"client_config": {
"type": "REPEAT",
Expand Down
2 changes: 1 addition & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -112397,7 +112397,7 @@ extern "C" {
#define extern __declspec(dllexport)
#endif

extern const TSLanguage *tree_sitter_sshclientconfig(void) {
extern const TSLanguage *tree_sitter_ssh_client_config(void) {
static const TSLanguage language = {
.version = LANGUAGE_VERSION,
.symbol_count = SYMBOL_COUNT,
Expand Down

0 comments on commit f4f4a4a

Please sign in to comment.