From 3ef38f2a0326b61ec6bc1eaa17995707d0497f51 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 3 Jan 2024 17:19:33 -0600 Subject: [PATCH] Add CI check that tree-sitter files are up to date --- .github/workflows/ci.yaml | 12 +++++++++++- grammar.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8826d59..1a4b73b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,17 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 18 + - run: git tag pre-updates - run: npm install + - name: Create generated files + run: | + npm run gen + git diff pre-updates --no-patch --exit-code; exitcode=$? + + if [ "$exitcode" -ne 0 ]; then + echo '::error::Generated files are out of date!' + echo '::error::run `npm run gen` and commit the changes' + exit "$exitcode" + fi - run: npm test # FIXME: also parse tests/*.just - diff --git a/grammar.js b/grammar.js index d1cb09c..7bd5c47 100644 --- a/grammar.js +++ b/grammar.js @@ -80,7 +80,7 @@ module.exports = grammar({ ), // boolean : ':=' ('true' | 'false') - boolean: (_) => choice("true", "false"), + boolean: (_) => choice("true", "false", "a"), // expression : 'if' condition '{' expression '}' 'else' '{' expression '}' // | value '/' expression