-
Notifications
You must be signed in to change notification settings - Fork 10
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 #56 from matthijsgroen/bugfix/use-proper-height-do…
…wn-for-choice Bugfix/use proper height down for choice
Showing
39 changed files
with
909 additions
and
709 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x, 18.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
- name: Install Dependencies | ||
run: yarn install --immutable | ||
- name: Linting | ||
run: yarn lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
|
||
- name: Install Dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Run unit tests | ||
run: yarn test --coverage |
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
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 |
---|---|---|
@@ -1,36 +1,38 @@ | ||
const { NodeTypes } = require("../ebnf-transform"); | ||
|
||
module.exports = { | ||
[NodeTypes.Optional]: current => { | ||
[NodeTypes.Optional]: (current) => { | ||
if (!current.optional || !current.optional.choice) { | ||
return current; | ||
} | ||
return { | ||
choice: [{ skip: true }].concat( | ||
current.optional.choice | ||
.filter(node => !node.skip) | ||
.map(node => (node.repetition ? { ...node, skippable: false } : node)) | ||
) | ||
.filter((node) => !node.skip) | ||
.map((node) => | ||
node.repetition ? { ...node, skippable: false } : node | ||
) | ||
), | ||
}; | ||
}, | ||
[NodeTypes.Choice]: current => { | ||
[NodeTypes.Choice]: (current) => { | ||
if (!current.choice) { | ||
return current; | ||
} | ||
const hasSkippableRepetition = current.choice.some( | ||
node => node.repetition && node.skippable | ||
(node) => node.repetition && node.skippable | ||
); | ||
if (hasSkippableRepetition) { | ||
return { | ||
choice: [{ skip: true }].concat( | ||
current.choice | ||
.filter(node => !node.skip) | ||
.map( | ||
node => (node.repetition ? { ...node, skippable: false } : node) | ||
.filter((node) => !node.skip) | ||
.map((node) => | ||
node.repetition ? { ...node, skippable: false } : node | ||
) | ||
) | ||
), | ||
}; | ||
} | ||
return current; | ||
} | ||
}, | ||
}; |
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
Oops, something went wrong.