Skip to content

Commit 492c034

Browse files
committed
feat: Initial commit
0 parents  commit 492c034

32 files changed

+25462
-0
lines changed

.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
'env': {
3+
'commonjs': true,
4+
'es2021': true,
5+
},
6+
'extends': 'google',
7+
'overrides': [
8+
],
9+
'parserOptions': {
10+
'ecmaVersion': 'latest',
11+
'sourceType': 'module',
12+
},
13+
'rules': {
14+
'indent': ['error', 2, {'SwitchCase': 1}],
15+
'max-len': [
16+
'error',
17+
{'code': 120, 'ignoreComments': true, 'ignoreUrls': true, 'ignoreStrings': true},
18+
],
19+
},
20+
};

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/src/** linguist-vendored
2+
/examples/* linguist-vendored
3+
4+
src/grammar.json linguist-generated
5+
src/node-types.json linguist-generated
6+
src/parser.c linguist-generated
7+
8+
src/grammar.json -diff
9+
src/node-types.json -diff
10+
src/parser.c -diff
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Bug Report
2+
description: File a bug or issue
3+
title: "bug: "
4+
labels: [bug]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
**Before** reporting an issue, make sure to search [existing issues](https://github.com/amaanq/tree-sitter-linkerscript/issues). Usage questions such as ***"How do I...?"*** either belong in [Discussions](https://github.com/tree-sitter/tree-sitter/discussions) upstream or in our [Discord server](https://discord.gg/w7nTvsVJhm) and will be closed.
10+
If your issue is related to a bug in your editor-experience because your editor *leverages* tree-sitter and this parser, then it is likely your issue does *NOT* belong here and belongs in the relevant editor's repository.
11+
- type: checkboxes
12+
attributes:
13+
label: Did you check existing issues?
14+
description: Make sure you've checked all of the below before submitting an issue
15+
options:
16+
- label: I have read all the [tree-sitter docs](https://tree-sitter.github.io/tree-sitter/using-parsers) if it relates to using the parser
17+
required: false
18+
- label: I have searched the existing issues of tree-sitter-linkerscript
19+
required: true
20+
- type: input
21+
attributes:
22+
label: "Tree-Sitter CLI Version, if relevant (output of `tree-sitter --version`)"
23+
placeholder: "tree-sitter 0.20.8 (6bbb50bef8249e6460e7d69e42cc8146622fa4fd)"
24+
validations:
25+
required: false
26+
- type: textarea
27+
attributes:
28+
label: Describe the bug
29+
description: A clear and concise description of what the bug is. Please include any related errors you see such as parsing errors or tree-sitter cli errors.
30+
validations:
31+
required: true
32+
- type: textarea
33+
attributes:
34+
label: Steps To Reproduce/Bad Parse Tree
35+
description: Steps to reproduce the behavior. If you have a bad parse tree, please include it here. You can get this by running `tree-sitter parse <path-to-file>` and copying the output.
36+
placeholder: |
37+
1.
38+
2.
39+
3.
40+
validations:
41+
required: true
42+
- type: textarea
43+
attributes:
44+
label: Expected Behavior/Parse Tree
45+
description: A concise description of what you expected to happen, or in the case of a bad parse tree, the expected parse tree.
46+
validations:
47+
required: true
48+
- type: textarea
49+
attributes:
50+
label: Repro
51+
description: Minimal code to reproduce this issue. Ideally this should be reproducible with the C library or the tree-sitter cli, do not suggest an editor or external tool.
52+
value: |
53+
// Example code that causes the issue
54+
SECTIONS {
55+
// Code that fails to parse, or causes an error
56+
}
57+
render: Linker Script
58+
validations:
59+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Feature Request
2+
description: Suggest a new feature
3+
title: "feature: "
4+
labels: [enhancement]
5+
body:
6+
- type: checkboxes
7+
attributes:
8+
label: Did you check the tree-sitter docs?
9+
description: Make sure you read all the docs before submitting a feature request
10+
options:
11+
- label: I have read all the [tree-sitter docs](https://tree-sitter.github.io/tree-sitter/using-parsers) if it relates to using the parser
12+
required: false
13+
- type: textarea
14+
validations:
15+
required: true
16+
attributes:
17+
label: Is your feature request related to a problem? Please describe.
18+
description: A clear and concise description of what the problem is. Ex. I think the grammar models this rule incorrectly and can be improved, or Linkerscript has officially added a new feature that should be added to the grammar.
19+
- type: textarea
20+
validations:
21+
required: true
22+
attributes:
23+
label: Describe the solution you'd like
24+
description: A clear and concise description of what you want to happen.
25+
- type: textarea
26+
validations:
27+
required: true
28+
attributes:
29+
label: Describe alternatives you've considered
30+
description: A clear and concise description of any alternative solutions or features you've considered.
31+
- type: textarea
32+
validations:
33+
required: false
34+
attributes:
35+
label: Additional context
36+
description: Add any other context or screenshots about the feature request here. If your feature request is related to a new Linkerscript feature, please include a link to the relevant **official** Linkerscript documentation.

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [macos-latest, ubuntu-latest, windows-latest]
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 18
19+
- run: npm install
20+
- run: npm test

.github/workflows/lint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install modules
17+
run: npm install
18+
- name: Run ESLint
19+
run: npm run lint

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
17+
steps:
18+
- uses: google-github-actions/release-please-action@v3
19+
id: release
20+
with:
21+
release-type: node
22+
package-name: tree-sitter-linkerscript
23+
24+
- uses: actions/checkout@v4
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Update Rust version
29+
run: |
30+
git fetch origin release-please--branches--master--components--tree-sitter-linkerscript
31+
git checkout release-please--branches--master--components--tree-sitter-linkerscript
32+
33+
git config user.name github-actions[bot]
34+
git config user.email github-actions[bot]@users.noreply.github.com
35+
36+
repo_name="${{ github.repository }}"
37+
repo_name="${repo_name##*/}"
38+
version=$(grep -o '"version": *"[^"]*"' package.json | sed 's/"version": "\(.*\)"/\1/')
39+
40+
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml
41+
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md
42+
43+
git add Cargo.toml bindings/rust/README.md
44+
git commit --amend --no-edit
45+
git push -f
46+
47+
- name: Setup Node
48+
if: ${{ steps.release.outputs.release_created }}
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: 18
52+
registry-url: "https://registry.npmjs.org"
53+
- name: Publish to NPM
54+
if: ${{ steps.release.outputs.release_created }}
55+
env:
56+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
57+
run: npm publish
58+
59+
- name: Setup Rust
60+
if: ${{ steps.release.outputs.release_created }}
61+
uses: actions-rs/toolchain@v1
62+
with:
63+
profile: minimal
64+
toolchain: stable
65+
override: true
66+
- name: Publish to Crates.io
67+
if: ${{ steps.release.outputs.release_created }}
68+
uses: katyo/publish-crates@v2
69+
with:
70+
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
71+
72+
- name: Tag stable versions
73+
if: ${{ steps.release.outputs.release_created }}
74+
run: |
75+
git checkout master
76+
git config user.name github-actions[bot]
77+
git config user.email github-actions[bot]@users.noreply.github.com
78+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
79+
git tag -d stable || true
80+
git push origin :stable || true
81+
git tag -a stable -m "Last Stable Release"
82+
git push origin stable

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Cargo.lock
2+
node_modules
3+
build
4+
package-lock.json
5+
/target/
6+
.build/

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/test
2+
/examples
3+
/build
4+
/script
5+
/target

0 commit comments

Comments
 (0)