-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from vcfxb/rework-parser
Rework parser - largely restart the project.
- Loading branch information
Showing
59 changed files
with
1,425 additions
and
964 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
on: | ||
push: | ||
branches: | ||
pull_request: | ||
branches: | ||
- "main" | ||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
name: codecov.io Code Coverage | ||
jobs: | ||
coverage: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install LLVM | ||
# See: https://apt.llvm.org/ | ||
# Last line: https://gitlab.com/taricorp/llvm-sys.rs/-/issues/13 | ||
run: | | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 17 | ||
sudo apt install libpolly-17-dev libz-dev | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Run tests | ||
run: cargo test --verbose | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
|
||
- name: rust-grcov | ||
# You may pin to the exact commit or the version. | ||
# uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248 | ||
uses: actions-rs/[email protected] | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: vcfxb/wright-lang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
on: ["push", "pull_request"] | ||
|
||
name: Code Coverage | ||
name: coveralls Code Coverage | ||
|
||
jobs: | ||
coverage: | ||
|
@@ -19,18 +19,17 @@ jobs: | |
with: | ||
toolchain: nightly | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features --no-fail-fast | ||
- name: Run tests | ||
run: cargo test --verbose | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
- id: coverage | ||
- name: rust-grcov | ||
id: coverage | ||
uses: actions-rs/[email protected] | ||
- name: Coveralls upload | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ${{ steps.coverage.outputs.report }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! Lexer benchmarks. | ||
use criterion::{black_box, criterion_group, criterion_main, Bencher, Criterion}; | ||
use wright::parser::lexer::Lexer; | ||
|
||
fn bench_symbol_tokens(c: &mut Criterion) { | ||
// Make a benchmark group. | ||
let mut group = c.benchmark_group("lexer symbol benchmarks"); | ||
|
||
// Function to make a lexer and get a token from it. | ||
fn make_lexer_and_get_token(b: &mut Bencher, input: &str) { | ||
b.iter(|| black_box(Lexer::new(input).next_token())); | ||
} | ||
|
||
let inputs = ["+", "+=", "*", "@", "?"]; | ||
|
||
for i in inputs { | ||
group.bench_with_input(format!("lexer {i}"), i, make_lexer_and_get_token); | ||
} | ||
} | ||
|
||
fn bench_block_doc_comment(c: &mut Criterion) { | ||
c.bench_function("lexer block style doc comment", move |b: &mut Bencher| { | ||
b.iter(move || { | ||
black_box(Lexer::new("/*! \n this is a block-style comment \n\n */").next_token()) | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, bench_symbol_tokens, bench_block_doc_comment); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.