Commit Graph

51 Commits

Author SHA1 Message Date
adelaett
5e46253140
removed one remaning debuging print, and updating all the tests 2023-04-14 17:59:08 +02:00
Denis Merigoux
e80143b3ca
Last linting pass and update tests 2023-03-31 17:56:45 +02:00
Denis Merigoux
3d86a12261
Update error messages 2023-03-31 14:01:04 +02:00
Louis Gesbert
47502335aa Refactor the parser to use priorities
Define a single expression rule with disambiguation using token priorities
instead of the many layers of intermediate rules with explicit sub-terms.

Also replaces `in` for collection operations (`x+1 for foo in [1;2]`) with
`among` which helps a lot.
2022-12-19 15:12:53 +01:00
Louis Gesbert
c92fe5e72d Fix underline of code errors when code contains utf8 2022-11-28 16:38:09 +01:00
Louis Gesbert
af2f5dbe19 Tweak error message location printing 2022-11-28 16:38:09 +01:00
Louis Gesbert
4d4dac6727 Some fancy unicode for error outlines
Normally I would make sure this is not by default, or at leat disableable; but
here the code we print may contain utf8 anyway, so the terminal really needs to
support it. Anyway, it's just a little fancier, doesn't add much.
2022-11-07 14:13:01 +01:00
Louis Gesbert
429911024c Add parseable line-column info to error messages
a quick fix for now, ideally we want an option for editor-friendly output.
But for now this is a very cheap way to at least have clickable error messages
which are a big time-saver.
2022-11-07 14:03:38 +01:00
Louis Gesbert
1b3a1f7219 Update test results
These are just variable renumberings, and type error message changes but still
pointing to the same information; the latter are slightly better in general,
pointing to actual expressions rather than scope declarations.
2022-10-04 14:50:37 +02:00
Louis Gesbert
c18de3b980 Tweak the order in which typing is done 2022-09-26 14:11:25 +02:00
Louis Gesbert
8c1696d0ff Inline tests: cleanup trailing whitespace 2022-09-23 16:56:21 +02:00
Louis Gesbert
0c0ef1ae1a Add test return codes
Simply re-generated with 'make tests CLERK_OPTS=--reset'
2022-09-23 14:50:02 +02:00
Louis Gesbert
0ab7a0f9ce Turn all existing tests to inline tests
Done using
```bash
process() { FILE=$1; awk 'match($0, /^```catala-test *{ *id *= *"(.*)" *}/, a) {print "```catala-test-inline"; f="'"$(dirname $FILE)/output/$(basename $FILE)"'." a[1]; getline; print "$ " $0; while ((getline<f) > 0) print; next} {print}' $FILE >$FILE.new; mv $FILE.new $FILE; }
for f in tests/test_*/*/*.catala_* examples/**/*.catala_*; do process $f; git add $f; done
for d in $(find -name output -type d); do git rm -r $d; done
```
2022-09-23 14:45:10 +02:00
Louis Gesbert
2e5050481d Register all existing tests through the new engine
I removed the '.out' extension for now to preserve the test output file names and avoid a million file renames.

This makes the patch easier to read, and we can do the rename easily in another patch afterwards, without mixing with semantic changes.

(beautiful script àlarrache:
```bash
for f in */*/output/*; do
  target_base=${f##*/}
  target_base=${target_base%%.*}
  echo $f | awk -F. '{
    f=$1"."$2; if ($4 == "") { mode=$3; id=$3 } else { scope="-s "$3; mode=$4; id=$3"."$4}
    printf "\n```catala-test {id=\"%s\"}\ncatala %s %s\n```\n",id,mode,scope;
  }' >> $(dirname $f)/../${target_base}.*; done
```
2022-07-08 17:06:20 +02:00
Denis Merigoux
3f49824150
Merge branch 'master' into c_backend 2022-04-04 18:02:33 +02:00
Denis Merigoux
ce7e756af1
Nice error messages for empty structs and enums 2022-03-28 14:43:38 +02:00
Denis Merigoux
2263dd7dab
Update syntax highlighting and test suite [skip ci] 2022-02-07 12:04:48 +01:00
Denis Merigoux
b2a5551961
Test folders, nice doc and messages 2022-01-11 12:51:34 +01:00
Denis Merigoux
2b6e7c8b98
Working prototype of clerk, the new build system for Catala 2022-01-10 17:57:58 +01:00
Denis Merigoux
56baf91923
Remove prefixes to each line in messages, keep only first line 2021-11-06 23:04:12 +01:00
EmileRolley
1597f43a1a refactor(compiler): unreachable match case error change to warning 2021-06-03 16:43:04 +02:00
EmileRolley
3c385e41a6 fix(tests): replace wildcard keyword with the right syntax 2021-06-03 15:47:07 +02:00
EmileRolley
5060565ed2 fix: update all syntax highlighting in order to match widlcard keywords 2021-06-03 15:33:40 +02:00
EmileRolley
ed51544a10 feat(compiler): improve error messages for not ending wildcards 2021-06-03 12:24:12 +02:00
EmileRolley
846c85a9a6 test(compiler): add unit tests for wildcard in patterns 2021-06-03 12:24:12 +02:00
EmileRolley
71d92aeef1 feat(compiler): start to add wildcard in patterns 2021-06-03 12:24:12 +02:00
EmileRolley
0ffbb9b266 refactor(tests)!: migrate test file from the abbreviated syntax to the english one 2021-05-26 21:16:29 +02:00
Denis Merigoux
3c8d187be0
Big refactoring of the literate programming structure
Partially fixes #120
Removes the distinction between headers and articles, streamlines the surface AST
Changes affects lexers and parser
2021-05-15 01:16:08 +02:00
Denis Merigoux
896a83db4a
Fix test output 2021-03-17 19:43:36 +01:00
EmileRolley
3f88dbe2ae fix(tests): modify some of the expected test outputs because of removed trailling whitespaces 2021-03-09 22:08:55 +01:00
EmileRolley
c0a9344eca refactor(tests): update tests based on the abbreviated english lexer 2021-03-09 22:07:31 +01:00
Denis Merigoux
3dcba2fede Speed up compilation using batch let bindings 2021-02-01 23:35:15 +01:00
Denis Merigoux
d88ccc38f6 Switched scope functions input to struct instead of many arguments 2021-02-01 15:57:19 +01:00
Aymeric Fromherz
fec4334b49 Allow fully qualified enum names in matches 2021-01-26 11:41:20 -05:00
Aymeric Fromherz
2e71cc503c Fix typo in grammar 2021-01-26 10:47:48 -05:00
Aymeric Fromherz
f154ec15ad Add support for fully qualified enum elements 2021-01-26 10:38:10 -05:00
Aymeric Fromherz
ba03d2db78 Move tests to appropriate folders 2021-01-25 01:16:46 -05:00
Aymeric Fromherz
483400ea19 Move tests to their appropriate directory 2021-01-23 20:49:17 -05:00
Denis Merigoux
3e57fe0276 Enhanced log with explanations of which definition is taken 2021-01-20 19:58:48 +01:00
Denis Merigoux
4d1d3a2e1c Reset tests 2021-01-20 19:21:02 +01:00
Denis Merigoux
19a6a171bd Fixes #65 2021-01-18 16:21:55 +01:00
Denis Merigoux
267baea28d Fixes #58 2021-01-14 00:17:24 +01:00
Denis Merigoux
44d7b616a4 Improve type error messages 2021-01-13 12:04:14 +01:00
Denis Merigoux
9c795b5010 Fixed typing error 2021-01-06 18:42:22 +01:00
Nicolas Chataing
5aa0e391ff Add a fail test 2021-01-06 17:23:58 +01:00
Nicolas Chataing
5038b75da1 Implement quick pattern check desugaring 2021-01-06 17:04:46 +01:00
Denis Merigoux
ebf14f6121 Added assertions, starting to execute section132 2020-12-10 18:11:43 +01:00
Denis Merigoux
5ff7d78a9e Fixed various edge cases of enums 2020-12-09 10:36:09 +01:00
Denis Merigoux
5abb73157f Fix content/type lexer issue in nv 2020-12-06 18:09:48 +01:00
Denis Merigoux
15247aa28a Pass simple test with enums 2020-12-06 17:56:06 +01:00