Skip to content
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

quint/grammar: add support for optional leading hashbang line #1522

Merged
merged 7 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- `quint verify` has the option `--apalache-version` to pull a custom version (#1521)
- Grammar updated with support for an optional leading hashbang (`#!`) line (#1522)

### Changed
### Deprecated
Expand Down
12 changes: 12 additions & 0 deletions quint/cli-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,15 @@ Regression test for [#1108](https://github.com/informalsystems/quint/issues/1108

<!-- !test check 1108 -->
quint parse testFixture/_1052one.qnt

### OK on typecheck SuperSpec via Unix hashbang

See [#1500](https://github.com/informalsystems/quint/issues/1500).

<!-- !test exit 0 -->
<!-- !test check typecheck SuperSpec via Unix hashbang -->
```
if [ `uname -s` == 'Linux' -o `uname -s` == 'Darwin' ]; then
./testFixture/SuperSpec.qnt
fi
```
7 changes: 5 additions & 2 deletions quint/src/generated/Quint.g4
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ grammar Quint;
import { quintErrorToString } from '../quintError'

}

// entry point for the parser
modules : module+ EOF;
modules : HASHBANG_LINE? module+ EOF;

module : DOCCOMMENT* 'module' qualId '{' documentedDeclaration* '}';
documentedDeclaration : DOCCOMMENT* declaration;
Expand Down Expand Up @@ -310,7 +311,9 @@ LOW_ID : ([a-z][a-zA-Z0-9_]*|[_][a-zA-Z0-9_]+) ;
// An identifier starting with uppercase
CAP_ID : ([A-Z][a-zA-Z0-9_]*|[_][a-zA-Z0-9_]+) ;

DOCCOMMENT : '///' .*? '\n';
// Unix script prefix, only valid as the first line of a file
HASHBANG_LINE : '#!' .*? '\n';
DOCCOMMENT : '///' .*? '\n';

// comments and whitespaces
LINE_COMMENT : '//' .*? '\n' -> skip ;
Expand Down
4 changes: 3 additions & 1 deletion quint/src/generated/Quint.interp

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions quint/src/generated/Quint.tokens

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

5 changes: 4 additions & 1 deletion quint/src/generated/QuintLexer.interp

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions quint/src/generated/QuintLexer.tokens

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

452 changes: 229 additions & 223 deletions quint/src/generated/QuintLexer.ts

Large diffs are not rendered by default.

Loading
Loading