2021-08-19 19:26:06 +03:00
|
|
|
(* -*- coding: iso-latin-1 -*- *)
|
|
|
|
|
|
|
|
(* 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. *)
|
|
|
|
|
|
|
|
(* Defining the lexer macros for Polish *)
|
|
|
|
|
|
|
|
(* Tokens and their corresponding sedlex regexps *)
|
|
|
|
|
|
|
|
#define MS_SCOPE "zakres"
|
|
|
|
#define MS_CONSEQUENCE "konsekwencja"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_DATA "dane"
|
|
|
|
#define MS_DEPENDS "zależy od"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_DEPENDS "zale", 0x017C, "y", space_plus, "od"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_DECLARATION "deklaracja"
|
|
|
|
#define MS_CONTEXT "kontekst"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_DECREASING "malejący"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_DECREASING "malej", 0x0105, ",cy"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_INCREASING "rosnący"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_INCREASING "rosn", 0x0105, "cy"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_OF "z"
|
|
|
|
#define MS_COLLECTION "kolekcja"
|
2022-07-28 11:34:37 +03:00
|
|
|
#define MS_CONTAINS "zawiera"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_ENUM "enumeracja"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_INTEGER "całkowita"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_INTEGER "ca", 0x0142, "kowita"
|
2022-01-28 13:09:44 +03:00
|
|
|
#define MS_MONEY "pieniądze"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MR_MONEY "pieni", 0x0105, "dze"
|
|
|
|
#define MS_TEXT "tekst"
|
2022-01-28 13:09:44 +03:00
|
|
|
#define MS_DECIMAL "dziesiętny"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MR_DECIMAL "dziesi", 0x0119, "tny"
|
|
|
|
#define MS_DATE "czas"
|
|
|
|
#define MS_DURATION "czas trwania"
|
|
|
|
#define MR_DURATION "czas", space_plus, "trwania"
|
|
|
|
#define MS_BOOLEAN "zerojedynkowy"
|
|
|
|
#define MS_SUM "suma"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_FILLED "spełnione"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_FILLED "spe", 0x0142, "nione"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_DEFINITION "definicja"
|
2022-02-28 16:33:07 +03:00
|
|
|
#define MS_STATE "stan"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_LABEL "etykieta"
|
2022-01-28 13:09:44 +03:00
|
|
|
#define MS_EXCEPTION "wyjątek"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MR_EXCEPTION "wyj", 0x0105, "tek"
|
|
|
|
#define MS_DEFINED_AS "wynosi"
|
|
|
|
#define MS_MATCH "pasuje"
|
|
|
|
#define MS_WILDCARD "cokolwiek"
|
|
|
|
#define MS_WITH "ze wzorem"
|
|
|
|
#define MR_WITH "ze", space_plus, "wzorem"
|
|
|
|
#define MS_UNDER_CONDITION "pod warunkiem"
|
|
|
|
#define MR_UNDER_CONDITION "pod", space_plus, "warunkiem"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_IF "jeżeli"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_IF "je", 0x017C, "eli"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_THEN "wtedy"
|
|
|
|
#define MS_ELSE "inaczej"
|
|
|
|
#define MS_CONDITION "warunek"
|
|
|
|
#define MS_CONTENT "typu"
|
|
|
|
#define MS_STRUCT "struktura"
|
|
|
|
#define MS_ASSERTION "asercja"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_VARIES "różna"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_VARIES "r", 0xf3, 0x017C, "na"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_WITH_V "wraz z"
|
|
|
|
#define MR_WITH_V "wraz", space_plus, "z"
|
|
|
|
#define MS_FOR "dla"
|
|
|
|
#define MS_ALL "wszystkie"
|
|
|
|
#define MS_WE_HAVE "mamy"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_FIXED "stałoprzecinkowa"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_FIXED "sta", 0x0142, "oprzecinkowa"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_BY "przez"
|
|
|
|
#define MS_RULE "zasada"
|
2022-07-26 14:40:43 +03:00
|
|
|
#define MS_LET "niech"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_EXISTS "istnieje"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_IN "w"
|
2022-12-14 17:45:13 +03:00
|
|
|
#define MS_AMONG "wśród"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MR_AMONG "w", 0x15B, "r", 0xf3, "d"
|
|
|
|
#define MS_SUCH "takie że"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_SUCH "takie", space_plus, 0x017C, "e"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_THAT "to"
|
|
|
|
#define MS_AND "i"
|
|
|
|
#define MS_OR "lub"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_XOR "albo"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_NOT "nie"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_MAXIMUM "maksimum"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_MINIMUM "minimum"
|
2022-12-12 18:02:07 +03:00
|
|
|
#define MS_IS "jest"
|
|
|
|
#define MS_EMPTY "pusty"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_CARDINAL "liczba"
|
|
|
|
#define MS_YEAR "rok"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_MONTH "miesiąc"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_MONTH "miesi", 0x0105, "c"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_DAY "dzień"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_DAY "dzie", 0x0144
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MS_TRUE "prawda"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_FALSE "fałsz"
|
2023-09-13 15:14:47 +03:00
|
|
|
#define MR_FALSE "fa", 0x0142, "sz"
|
2022-01-28 13:09:44 +03:00
|
|
|
#define MS_INPUT "wejście"
|
|
|
|
#define MR_INPUT "wej", 0x15B, "cie"
|
|
|
|
#define MS_OUTPUT "wyjście"
|
|
|
|
#define MR_OUTPUT "wyj", 0x15B, "cie"
|
|
|
|
#define MS_INTERNAL "wewnętrzny"
|
|
|
|
#define MR_INTERNAL "wewn", 0x0119, "trzny"
|
2021-08-19 19:26:06 +03:00
|
|
|
|
2021-08-19 21:32:23 +03:00
|
|
|
(* Specific delimiters *)
|
|
|
|
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MS_MONEY_OP_SUFFIX "PLN"
|
2021-08-20 15:23:10 +03:00
|
|
|
#define MC_DECIMAL_SEPARATOR '.'
|
|
|
|
#define MR_MONEY_PREFIX ""
|
|
|
|
#define MR_MONEY_DELIM ','
|
|
|
|
#define MR_MONEY_SUFFIX Star hspace, "PLN"
|
2021-08-19 19:26:06 +03:00
|
|
|
|
|
|
|
(* Builtins *)
|
|
|
|
|
2022-12-13 15:28:01 +03:00
|
|
|
#define MS_Round "zaokrąglony"
|
2023-08-17 13:15:25 +03:00
|
|
|
#define MR_Round "zaokr", 0x0105, "glony"
|
2022-01-28 13:09:44 +03:00
|
|
|
#define MS_GetDay "dostęp_dzień"
|
|
|
|
#define MR_GetDay "dost", 0x0119, "p_dzie", 0x144
|
|
|
|
#define MS_GetMonth "dostęp_miesiąc"
|
|
|
|
#define MR_GetMonth "dost", 0x0119, "p_miesi", 0x0105, "c"
|
|
|
|
#define MS_GetYear "dostęp_rok"
|
|
|
|
#define MR_GetYear "dost", 0x0119, "p_rok"
|
2022-07-21 15:11:56 +03:00
|
|
|
#define MS_FirstDayOfMonth "pierwszy_dzień_miesiąca"
|
|
|
|
#define MR_FirstDayOfMonth "pierwszy_dzie", 0x144, "_miesi", 0x0105, "ca"
|
|
|
|
#define MS_LastDayOfMonth "ostatni_dzień_miesiąca"
|
|
|
|
#define MR_LastDayOfMonth "ostatni_dzie", 0x144, "_miesi", 0x0105, "ca"
|
2021-08-19 19:26:06 +03:00
|
|
|
|
|
|
|
(* Directives *)
|
|
|
|
|
|
|
|
#define MR_LAW_INCLUDE "Include"
|
2023-09-05 16:00:55 +03:00
|
|
|
#define MR_MODULE_DEF "Module"
|
|
|
|
#define MR_MODULE_USE "Using"
|
|
|
|
#define MR_MODULE_ALIAS "as"
|
2023-12-01 17:24:54 +03:00
|
|
|
#define MR_EXTERNAL "external"
|
2021-08-19 19:26:06 +03:00
|
|
|
#define MX_AT_PAGE \
|
|
|
|
'@', Star hspace, "p.", Star hspace, Plus digit -> \
|
|
|
|
let s = Utf8.lexeme lexbuf in \
|
|
|
|
let i = String.index s '.' in \
|
|
|
|
AT_PAGE (int_of_string (String.trim (String.sub s i (String.length s - i))))
|