Skip to content

Commit

Permalink
Merge pull request #61 from kaleidawave/parser-position-improvements
Browse files Browse the repository at this point in the history
Tokens use start positions rather than Spans
  • Loading branch information
kaleidawave authored Sep 22, 2023
2 parents 8edad7e + c1aebac commit 88fc8e4
Show file tree
Hide file tree
Showing 119 changed files with 3,581 additions and 2,834 deletions.
84 changes: 38 additions & 46 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
Expand All @@ -45,6 +46,19 @@ jobs:
- name: Check binary
run: cargo check --bin ezno

- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: [email protected]
- name: Check binary WASM
run: |
rustup target add wasm32-unknown-unknown
npm run check
working-directory: src/js-cli-and-library

- name: Check parser without extras
run:
cargo check -p ezno-parser --no-default-features

formating:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -89,7 +103,12 @@ jobs:
- name: Run parser tests
if: steps.changes.outputs.parser == 'true'
run: cargo test
run: |
cargo test
# TODO test other big libraries
curl https://esm.sh/v128/[email protected]/es2022/react-dom.mjs > react.js
cargo run -p ezno-parser --example parse react.js
working-directory: parser

- name: Run checker specification
Expand All @@ -100,6 +119,24 @@ jobs:
- name: Run base tests
run: cargo test

- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: [email protected]

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build and test WASM
run: |
rustup target add wasm32-unknown-unknown
npm ci
npm run test
node ./dist/cli.cjs info
deno run -A ./dist/cli.mjs info
working-directory: src/js-cli-and-library
shell: bash

fuzzing:
needs: validity
runs-on: ubuntu-latest
Expand Down Expand Up @@ -159,51 +196,6 @@ jobs:
- name: Lint code with clippy
run: cargo clippy

wasm-test:
needs: validity
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: [email protected]

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build
run: |
rustup target add wasm32-unknown-unknown
npm ci
npm run build
working-directory: src/js-cli-and-library
shell: bash

- name: Test modules
run: |
node test.mjs
deno run -A test.mjs
node test.cjs
working-directory: src/js-cli-and-library
shell: bash

- name: Check CLI works
run: |
node ./dist/cli.cjs info
deno run -A ./dist/cli.mjs info
working-directory: src/js-cli-and-library
shell: bash

publish-ability:
runs-on: ubuntu-latest
steps:
Expand Down
80 changes: 54 additions & 26 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ members = [
"parser/generator",
"checker",
"checker/binary-serialize-derive",
# "lsp/server",
# "checker/specification"
]

[package]
Expand Down Expand Up @@ -44,6 +46,8 @@ codespan-reporting = "0.11.1"
argh = "0.1.6"
base64 = "0.13.0"
enum-variants-strings = "0.2.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.107"

[dependencies.parser]
path = "./parser"
Expand All @@ -53,8 +57,8 @@ package = "ezno-parser"

[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen = "=0.2.87"
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.5.0"
console_error_panic_hook = "0.1.7"
js-sys = "0.3"

[target.'cfg(not(target_family = "wasm"))'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default = []
ezno-parser = ["parser"]

[dependencies]
source-map = { version = "0.13", features = ["span-serialize"] }
source-map = { version = "0.14.2", features = ["serde-serialize"] }

binary-serialize-derive = { path = "./binary-serialize-derive", version = "0.0.1" }

Expand Down
3 changes: 2 additions & 1 deletion checker/definitions/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ interface Math {
}

interface string {
toUppercase(): string performs const uppercase;
toUpperCase(): string performs const uppercase;
toLowerCase(): string performs const lowercase;
}

interface Console {
Expand Down
2 changes: 1 addition & 1 deletion checker/specification/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ const z: false = true || 4
#### String operations

```ts
"hi".toUppercase() satisfies number
"hi".toUpperCase() satisfies number
```

- Expected number, found "HI"
Expand Down
13 changes: 4 additions & 9 deletions checker/specification/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ fn check_errors(
code: &'static str,
expected_diagnostics: &[&'static str],
) {
let mut fs = parser::source_map::MapFileStore::default();
let mut fs = parser::source_map::MapFileStore::<parser::source_map::NoPathMap>::default();
let source =
parser::source_map::FileSystem::new_source_id(&mut fs, PathBuf::default(), code.to_owned());
let module = parser::Module::from_string(
code.to_owned(),
parser::ParseOptions::default(),
source,
None,
Vec::new(),
)
.unwrap();
let module =
parser::Module::from_string(code.to_owned(), parser::ParseOptions::default(), source, None)
.unwrap();

// let global_buffer = Arc::new(Mutex::new(String::new()));
// let old_panic_hook = panic::take_hook();
Expand Down
Loading

0 comments on commit 88fc8e4

Please sign in to comment.