catala/compiler/surface/tokens.mly
Louis Gesbert 98ebc36343 Add all missing parser error messages
... that's one less thing to do

Two notes:

- Updated the syntax errors in
  examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en ; those
  probably aren't expected though, but fixing them is outside my purpose here

- There is consensus on keeping the error messages in English; however, here,
  the error messages include hints on the syntax to use, which are only valid
  for users of the English syntax.
  * A possible solution would be to apply cppo on parser.messages, using the
    macros already defined in lexer_LANG.cppo.ml. However, we would then need to
    tweak (or duplicate!) the parser to use the messages for the correct language.
    Furthermore, updating and merging the file on parser updates would need
    special care.
  * Another, maybe easier solution would be manual processing, using a custom
    escape in the parser messages and rewriting that at runtime when printing
    the message. We would need to extract a runtime version of the macro
    definitions though.
2023-02-13 10:51:42 +01:00

61 lines
2.0 KiB
OCaml

(*
This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules.
Copyright (C) 2020 Inria, contributors: Denis Merigoux <denis.merigoux@inria.fr>,
Emile Rolley <emile.rolley@tuta.io>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
%{
open Ast
%}
%token EOF
%token<string * string option * bool * int> LAW_HEADING
%token BEGIN_DIRECTIVE END_DIRECTIVE LAW_INCLUDE
%token<int> AT_PAGE
%token<string> DIRECTIVE_ARG
%token<string> LAW_TEXT
%token<string> UIDENT LIDENT
%token<string> END_CODE
%token<string> INT_LITERAL
%token<int * int * int> DATE_LITERAL
%token TRUE FALSE
%token<string * string> DECIMAL_LITERAL
%token<string * string> MONEY_AMOUNT
%token BEGIN_CODE TEXT
%token COLON ALT DATA
%token OF INTEGER COLLECTION CONTAINS AMONG
%token RULE CONDITION DEFINED_AS
%token<Ast.op_kind> LESSER GREATER LESSER_EQUAL GREATER_EQUAL
%token LET EXISTS IN SUCH THAT COMMA
%token DOT AND OR XOR LPAREN RPAREN EQUAL
%token CARDINAL ASSERTION FIXED BY YEAR MONTH DAY
%token<Ast.op_kind> PLUS MINUS MULT DIV
%token PLUSPLUS
%token MATCH WITH VARIES WITH_V WILDCARD
%token FOR ALL WE_HAVE INCREASING DECREASING
%token NOT BOOLEAN PERCENT DURATION
%token SCOPE FILLED NOT_EQUAL DEFINITION STATE
%token STRUCT CONTENT IF THEN DEPENDS DECLARATION
%token CONTEXT INPUT OUTPUT INTERNAL ENUM ELSE DATE SUM
%token BEGIN_METADATA MONEY DECIMAL
%token UNDER_CONDITION CONSEQUENCE LBRACE RBRACE
%token LABEL EXCEPTION LBRACKET RBRACKET SEMICOLON
%token MAXIMUM MINIMUM IS EMPTY
%%