-
Notifications
You must be signed in to change notification settings - Fork 2
Implement SplitNTermLevels transform with tests #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlanPietrasz
wants to merge
20
commits into
fram-lang:master
Choose a base branch
from
AlanPietrasz:feature/8-split-nterm-levels
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a98519c
Implement SplitNTermLevels transform with tests
AlanPietrasz 21e3d49
Use map for SplitNTermLevels IdTable
AlanPietrasz 4eecc71
Use TC_False for level forwarding productions
AlanPietrasz 28285b9
Address Level matching review comments
AlanPietrasz cf2e3c0
Use map to collect production levels
AlanPietrasz 5531137
Avoid append when collecting levels
AlanPietrasz cd5cc6e
Fix tag forwarding conditions in SplitNTermLevels
AlanPietrasz f1c2f06
Preserve empty non-terminals in SplitNTermLevels
AlanPietrasz 075c687
Fail on invalid split level lookup
AlanPietrasz 72d643e
Deduplicate forwarded tags
AlanPietrasz 2aaa4e0
Use map to collect forwarded tags
AlanPietrasz 4431143
Validate test suite path
AlanPietrasz 0803137
Scope test runner flags locally
AlanPietrasz 2bd5c74
Keep original non-terminal id for base level
AlanPietrasz f88dee0
Use active productions in SplitNTermLevels tests
AlanPietrasz a662d8f
Forward tags through split level chains
AlanPietrasz 37b3c9f
Use map for split level productions
AlanPietrasz a06b561
Index productions by level in SplitNTermLevels
AlanPietrasz 5733e1e
Remove redundant split level check
AlanPietrasz 70dc913
Report invalid split levels via onError
AlanPietrasz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,72 @@ | ||
| #!/usr/bin/env bash | ||
| set -u | ||
|
|
||
| if [ $# -ne 1 ]; then | ||
| echo "USAGE: ./test.sh TEST_SUITE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "$1" ]; then | ||
| echo "ERROR: test suite file not found: $1" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -r "$1" ]; then | ||
| echo "ERROR: test suite file is not readable: $1" | ||
| exit 1 | ||
| fi | ||
|
|
||
| binary="${DBL:-dbl}" | ||
| if ! command -v "$binary" > /dev/null; then | ||
| echo "ERROR: dbl executable not found in PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${DBL_LIB:-}" ]; then | ||
| dbl_path=$(command -v "$binary") | ||
| dbl_prefix=$(dirname "$(dirname "$dbl_path")") | ||
| if [ -d "$dbl_prefix/lib/dbl/stdlib" ]; then | ||
| export DBL_LIB="$dbl_prefix/lib/dbl/stdlib" | ||
| else | ||
| echo "ERROR: DBL_LIB is not set and DBL stdlib was not found next to '$dbl_path'" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| flags="" | ||
| total_tests=0 | ||
| passed_tests=0 | ||
|
|
||
| function simple_test { | ||
| total_tests=$((total_tests + 1)) | ||
|
|
||
| local file="$1" | ||
| local cmd=("$binary") | ||
| if [ -n "$flags" ]; then | ||
| # shellcheck disable=SC2206 | ||
| cmd+=($flags) | ||
| fi | ||
| cmd+=("$file") | ||
|
|
||
| echo "${cmd[*]}" | ||
| if "${cmd[@]}"; then | ||
| passed_tests=$((passed_tests + 1)) | ||
| else | ||
| echo "Test file failed: $file" | ||
| fi | ||
| } | ||
|
|
||
| function run_with_flags { | ||
| local flags="$2" | ||
| "$1" | ||
| } | ||
|
|
||
| source "$1" | ||
|
AlanPietrasz marked this conversation as resolved.
|
||
|
|
||
| echo "Passed: ${passed_tests}/${total_tests}" | ||
|
|
||
| if [ "$passed_tests" -eq "$total_tests" ]; then | ||
| exit 0 | ||
| else | ||
| exit 1 | ||
| fi | ||
This file contains hidden or 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 @@ | ||
| import TransformTests/SplitNTermLevels |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.