Update syntax highlighting and test suite [skip ci]

This commit is contained in:
Denis Merigoux 2022-02-07 12:04:48 +01:00
parent e3b5d2d0b6
commit 2263dd7dab
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
71 changed files with 255 additions and 208 deletions

View File

@ -274,10 +274,10 @@ let rec translate_expr (ctx : ctx) (e : Ast.expr Pos.marked) : Dcalc.Ast.expr Po
with Not_found ->
Errors.raise_spanned_error
(Format.asprintf
"The variable %a.%a cannot be used here,\n\
as subscope %a's results will not have been computed yet" Ast.SubScopeName.format_t
(Pos.unmark s) Ast.ScopeVar.format_t (Pos.unmark a) Ast.SubScopeName.format_t
(Pos.unmark s))
"The variable %a.%a cannot be used here, as it is not part subscope %a's results. \
Maybe you forgot to qualify it as an output?"
Ast.SubScopeName.format_t (Pos.unmark s) Ast.ScopeVar.format_t (Pos.unmark a)
Ast.SubScopeName.format_t (Pos.unmark s))
(Pos.get_position e))
| EIfThenElse (cond, et, ef) ->
Bindlib.box_apply3

View File

@ -1,6 +1,6 @@
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR CONTENT TEXT YEAR
##
## Ends in an error in state: 348.
## Ends in an error in state: 349.
##
## nonempty_list(enum_decl_line) -> enum_decl_line . [ SCOPE END_CODE DECLARATION ]
## nonempty_list(enum_decl_line) -> enum_decl_line . nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ]
@ -13,7 +13,7 @@ expected another enum case, or a new declaration or scope use
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR CONTENT YEAR
##
## Ends in an error in state: 343.
## Ends in an error in state: 344.
##
## enum_decl_line_payload -> CONTENT . typ [ SCOPE END_CODE DECLARATION ALT ]
##
@ -25,7 +25,7 @@ expected a content type
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT CONSTRUCTOR YEAR
##
## Ends in an error in state: 342.
## Ends in an error in state: 343.
##
## enum_decl_line -> ALT constructor . option(enum_decl_line_payload) [ SCOPE END_CODE DECLARATION ALT ]
##
@ -37,7 +37,7 @@ expected a payload for your enum case, or another case or declaration
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON ALT YEAR
##
## Ends in an error in state: 341.
## Ends in an error in state: 342.
##
## enum_decl_line -> ALT . constructor option(enum_decl_line_payload) [ SCOPE END_CODE DECLARATION ALT ]
##
@ -49,7 +49,7 @@ expected the name of an enum case
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR COLON YEAR
##
## Ends in an error in state: 340.
## Ends in an error in state: 341.
##
## code_item -> DECLARATION ENUM constructor COLON . nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ]
##
@ -61,7 +61,7 @@ expected an enum case
source_file: BEGIN_CODE DECLARATION ENUM CONSTRUCTOR YEAR
##
## Ends in an error in state: 339.
## Ends in an error in state: 340.
##
## code_item -> DECLARATION ENUM constructor . COLON nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ]
##
@ -73,7 +73,7 @@ expected a colon
source_file: BEGIN_CODE DECLARATION ENUM YEAR
##
## Ends in an error in state: 338.
## Ends in an error in state: 339.
##
## code_item -> DECLARATION ENUM . constructor COLON nonempty_list(enum_decl_line) [ SCOPE END_CODE DECLARATION ]
##
@ -130,7 +130,7 @@ source_file: BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEP
##
## Ends in an error in state: 303.
##
## typ -> collection_marked . typ [ SCOPE INTERNAL INPUT END_CODE DEPENDS DECLARATION DATA CONTEXT CONDITION ALT ]
## typ -> collection_marked . typ [ SCOPE OUTPUT INTERNAL INPUT IDENT END_CODE DEPENDS DECLARATION DATA CONTEXT CONDITION ALT ]
##
## The known suffix of the stack is as follows:
## collection_marked
@ -154,7 +154,7 @@ source_file: BEGIN_CODE DECLARATION STRUCT CONSTRUCTOR COLON CONDITION IDENT DEP
##
## Ends in an error in state: 307.
##
## struct_scope_func -> DEPENDS . typ [ SCOPE INTERNAL INPUT END_CODE DECLARATION DATA CONTEXT CONDITION ]
## struct_scope_func -> DEPENDS . typ [ SCOPE OUTPUT INTERNAL INPUT IDENT END_CODE DECLARATION DATA CONTEXT CONDITION ]
##
## The known suffix of the stack is as follows:
## DEPENDS
@ -1867,7 +1867,7 @@ expected the name of the scope being used
source_file: BEGIN_CODE YEAR
##
## Ends in an error in state: 366.
## Ends in an error in state: 367.
##
## source_file_item -> BEGIN_CODE . code END_CODE [ LAW_TEXT LAW_HEADING EOF BEGIN_METADATA BEGIN_DIRECTIVE BEGIN_CODE ]
##

View File

@ -498,7 +498,6 @@ struct_scope:
scope_decl_item_attribute_input:
| CONTEXT { Context, Pos.from_lpos $sloc }
| INPUT { Input, Pos.from_lpos $sloc }
| INTERNAL { Internal, Pos.from_lpos $sloc }
scope_decl_item_attribute_output:
| OUTPUT { true, Pos.from_lpos $sloc }
@ -509,9 +508,22 @@ scope_decl_item_attribute:
output = scope_decl_item_attribute_output {
{
scope_decl_context_io_input = input;
scope_decl_context_io_output = output
scope_decl_context_io_output = output
}
}
| INTERNAL {
{
scope_decl_context_io_input = (Internal, Pos.from_lpos $sloc);
scope_decl_context_io_output = (false, Pos.from_lpos $sloc)
}
}
| OUTPUT {
{
scope_decl_context_io_input = (Internal, Pos.from_lpos $sloc);
scope_decl_context_io_output = (true, Pos.from_lpos $sloc)
}
}
scope_decl_item:
| attr = scope_decl_item_attribute i = ident CONTENT t = typ func_typ = option(struct_scope_func) { (ContextData ({
@ -527,7 +539,7 @@ scope_decl_item:
}, Pos.from_lpos $sloc);
}), Pos.from_lpos $sloc)
}
| INTERNAL i = ident SCOPE c = constructor {
| i = ident SCOPE c = constructor {
(ContextScope({
scope_decl_context_scope_name = i;
scope_decl_context_scope_sub_scope = c;

View File

@ -63,9 +63,9 @@ ace.define(
regex: "(\\s*\\#.*$)",
},
{
token: ["keyword.other", "text", "entity.name.function"],
token: ["keyword.other", "text", "keyword.other", "text", "entity.name.function"],
regex:
"(context|input|output|internal)(\\s+)([a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00ea\u0153\u00e7][a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00ea\u0153\u00e7A-Z\u00c9\u00c8\u00c0\u00c2\u00d9\u00ce\u00ca\u0152\u00c70-9_\\']*)",
"(context|input|output|internal)(\\s*)(|output)(\\s+)(\\s+)([a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00ea\u0153\u00e7][a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00ea\u0153\u00e7A-Z\u00c9\u00c8\u00c0\u00c2\u00d9\u00ce\u00ca\u0152\u00c70-9_\\']*)",
},
{
token: "keyword.control",

View File

@ -101,7 +101,7 @@
'name' : 'comment.line.catala_en'
}
{
'match' : '(context|input|output|internal)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'match' : '(context|input|output|internal)(\\s*)(|output)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'captures' : {
'1' : {
'name' : 'keyword.other.catala_en'
@ -110,6 +110,12 @@
'name' : 'text.catala_en'
}
'3' : {
'name' : 'keyword.other.catala_en'
}
'4' : {
'name' : 'text.catala_en'
}
'5' : {
'name' : 'entity.name.function.catala_en'
}
}

View File

@ -193,8 +193,8 @@ code : context {
}
: pattern {
regex \= (context|input|output|internal)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .sc_id_def;
regex \= (context|input|output|internal)(\s*)(|output)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .keyword_rule, .whitespace, .sc_id_def;
}
: pattern {

View File

@ -25,8 +25,8 @@ class CatalaEnLexer(RegexLexer):
'code': [
(u'(```)', bygroups(Text), 'root'),
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
(u'(context|input|output|internal)(\\s+)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)',
bygroups(Keyword.Declaration, Text, Name.Variable)),
(u'(context|input|output|internal)(\\s*)(|output)(\\s+)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xca\u0152\xc70-9_\\\']*)',
bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Name.Variable)),
(u'\\b(match|with\\s+pattern|fixed|by|decreasing|increasing|varies|with|we\\s+have|in|such\\s+that|exists|for|all|of|if|then|else|initial)\\b',
bygroups(Keyword.Reserved)),
(u'\\b(scope|depends\\s+on|declaration|includes|collection|content|optional|structure|enumeration|context|input|output|internal|rule|under\\s+condition|condition|data|consequence|fulfilled|equals|assertion|definition|label|exception|anything)\\b',

View File

@ -34,7 +34,7 @@ syn match punctuation contained "\(--\|\;\|\.\|,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Type contained integer boolean date duration money text decimal number sum
syn region ctxt contained
\ matchgroup=Keyword start="\<context\|input\|output\|internal"
\ matchgroup=Keyword start="\<\(context\|input\|output\|internal\)\(\|\s\+output\)"
\ matchgroup=sc_id_def end="\s\+\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region cc_id_dot_sc_id contained contains=punctuation

View File

@ -162,7 +162,7 @@
</dict>
<dict>
<key>match</key>
<string>(context|input|output|internal)(\s+)([a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00ea}\x{0153}\x{00e7}][a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00ea}\x{0153}\x{00e7}A-Z\x{00c9}\x{00c8}\x{00c0}\x{00c2}\x{00d9}\x{00ce}\x{00ca}\x{0152}\x{00c7}0-9_\&apos;]*)</string>
<string>(context|input|output|internal)(\s*)(|output)(\s+)([a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00ea}\x{0153}\x{00e7}][a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00ea}\x{0153}\x{00e7}A-Z\x{00c9}\x{00c8}\x{00c0}\x{00c2}\x{00d9}\x{00ce}\x{00ca}\x{0152}\x{00c7}0-9_\&apos;]*)</string>
<key>captures</key>
<dict>
<key>1</key>
@ -176,6 +176,16 @@
<string>text.catala_en</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>keyword.other.catala_en</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>text.catala_en</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>entity.name.function.catala_en</string>

View File

@ -63,9 +63,9 @@ ace.define(
regex: "(\\s*\\#.*$)",
},
{
token: ["keyword.other", "text", "entity.name.function"],
token: ["keyword.other", "text", "keyword.other", "text", "entity.name.function"],
regex:
"(contexte|entr\u00e9e|sortie|interne)(\\s+)([a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00f4\u00ea\u0153\u00e7][a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00f4\u00ea\u0153\u00e7A-Z\u00c9\u00c8\u00c0\u00c2\u00d9\u00ce\u00d4\u00ca\u0152\u00c70-9_\\']*)",
"(contexte|entr\u00e9e|sortie|interne)(\\s*)(|sortie)(\\s+)([a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00f4\u00ea\u0153\u00e7][a-z\u00e9\u00e8\u00e0\u00e2\u00f9\u00ee\u00f4\u00ea\u0153\u00e7A-Z\u00c9\u00c8\u00c0\u00c2\u00d9\u00ce\u00d4\u00ca\u0152\u00c70-9_\\']*)",
},
{
token: "keyword.control",

View File

@ -101,7 +101,7 @@
'name' : 'comment.line.catala_fr'
}
{
'match' : '(contexte|entr\\x{00e9}e|sortie|interne)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00f4}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00f4}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00d4}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'match' : '(contexte|entr\\x{00e9}e|sortie|interne)(\\s*)(|sortie)(\\s+)([a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00f4}\\x{00ea}\\x{0153}\\x{00e7}][a-z\\x{00e9}\\x{00e8}\\x{00e0}\\x{00e2}\\x{00f9}\\x{00ee}\\x{00f4}\\x{00ea}\\x{0153}\\x{00e7}A-Z\\x{00c9}\\x{00c8}\\x{00c0}\\x{00c2}\\x{00d9}\\x{00ce}\\x{00d4}\\x{00ca}\\x{0152}\\x{00c7}0-9_\\\']*)'
'captures' : {
'1' : {
'name' : 'keyword.other.catala_fr'
@ -110,6 +110,12 @@
'name' : 'text.catala_fr'
}
'3' : {
'name' : 'keyword.other.catala_fr'
}
'4' : {
'name' : 'text.catala_fr'
}
'5' : {
'name' : 'entity.name.function.catala_fr'
}
}

View File

@ -193,8 +193,8 @@ code : context {
}
: pattern {
regex \= (contexte|entrée|sortie|interne)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .sc_id_def;
regex \= (contexte|entrée|sortie|interne)(\s*)(|sortie)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .keyword_rule, .whitespace, .sc_id_def;
}
: pattern {

View File

@ -26,8 +26,8 @@ class CatalaFrLexer(RegexLexer):
'code': [
(u'(```)', bygroups(Text), 'root'),
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
(u'(contexte|entr\xe9e|sortie|interne)(\\s+)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)',
bygroups(Keyword.Declaration, Text, Name.Variable)),
(u'(contexte|entr\xe9e|sortie|interne)(\\s*)(|sortie)(\\s+)([a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7][a-z\xe9\xe8\xe0\xe2\xf9\xee\xf4\xea\u0153\xe7A-Z\xc9\xc8\xc0\xc2\xd9\xce\xd4\xca\u0152\xc70-9_\\\']*)',
bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Name.Variable)),
(u'\\b(selon|sous\\s+forme|fix\xe9|par|d\xe9croissante|croissante|varie|avec|on\\s+a|dans|tel\\s+que|existe|pour|tout|de|si|alors|sinon|initial)\\b',
bygroups(Keyword.Reserved)),
(u'\\b(champ\\s+d\'application|si\\s+et\\s+seulement\\s+si|d\xe9pend\\s+de|d\xe9claration|inclus|collection|contenu|optionnel|structure|\xe9num\xe9ration|contexte|entr\xe9e|sortie|interne|r\xe8gle|sous\\s+condition|condition|donn\xe9e|cons\xe9quence|rempli|\xe9gal\\s+\xe0|assertion|d\xe9finition|\xe9tiquette|exception|n\'importe\\s+quel)\\b',

View File

@ -36,7 +36,7 @@ syn match punctuation contained "\(--\|\;\|\.\|,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Type contained entier booléen date durée argent texte décimal décret loi nombre somme
syn region ctxt contained
\ matchgroup=Keyword start="\<contexte\|entrée\|sortie\|interne"
\ matchgroup=Keyword start="\<\(contexte\|entrée\|sortie\|interne\)\(|\s\+sortie\)"
\ matchgroup=sc_id_def end="\s\+\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region cc_id_dot_sc_id contained contains=punctuation

View File

@ -162,7 +162,7 @@
</dict>
<dict>
<key>match</key>
<string>(contexte|entrée|sortie|interne)(\s+)([a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00f4}\x{00ea}\x{0153}\x{00e7}][a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00f4}\x{00ea}\x{0153}\x{00e7}A-Z\x{00c9}\x{00c8}\x{00c0}\x{00c2}\x{00d9}\x{00ce}\x{00d4}\x{00ca}\x{0152}\x{00c7}0-9_\&apos;]*)</string>
<string>(contexte|entrée|sortie|interne)(\s*)(|sortie)(\s+)([a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00f4}\x{00ea}\x{0153}\x{00e7}][a-z\x{00e9}\x{00e8}\x{00e0}\x{00e2}\x{00f9}\x{00ee}\x{00f4}\x{00ea}\x{0153}\x{00e7}A-Z\x{00c9}\x{00c8}\x{00c0}\x{00c2}\x{00d9}\x{00ce}\x{00d4}\x{00ca}\x{0152}\x{00c7}0-9_\&apos;]*)</string>
<key>captures</key>
<dict>
<key>1</key>
@ -176,6 +176,16 @@
<string>text.catala_fr</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>keyword.other.catala_fr</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>text.catala_fr</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>entity.name.function.catala_fr</string>

View File

@ -71,7 +71,7 @@
'name' : 'comment.line.catala_pl'
}
{
'match' : '(kontekst|wejście|wyjście|wewnętrzny)(\\s+)([a-z\\x{0105}\\x{0107}\\x{0119}\\x{0142}\\x{0144}\\x{00f3}\\x{015b}\\x{017c}\\x{017a}][a-z\\x{0105}\\x{0107}\\x{0119}\\x{0142}\\x{0144}\\x{00f3}\\x{015b}\\x{017c}\\x{017a}A-Z\\x{0104}\\x{0106}\\x{0118}\\x{0141}\\x{0143}\\x{00d3}\\x{015a}\\x{017b}\\x{0179}0-9_\\\']*)'
'match' : '(kontekst|wejście|wyjście|wewnętrzny)(\\s*)(|wyjście)(\\s+)([a-z\\x{0105}\\x{0107}\\x{0119}\\x{0142}\\x{0144}\\x{00f3}\\x{015b}\\x{017c}\\x{017a}][a-z\\x{0105}\\x{0107}\\x{0119}\\x{0142}\\x{0144}\\x{00f3}\\x{015b}\\x{017c}\\x{017a}A-Z\\x{0104}\\x{0106}\\x{0118}\\x{0141}\\x{0143}\\x{00d3}\\x{015a}\\x{017b}\\x{0179}0-9_\\\']*)'
'captures' : {
'1' : {
'name' : 'keyword.other.catala_pl'
@ -80,6 +80,12 @@
'name' : 'text.catala_pl'
}
'3' : {
'name' : 'keyword.other.catala_pl'
}
'4' : {
'name' : 'text.catala_pl'
}
'5' : {
'name' : 'entity.name.function.catala_pl'
}
}

View File

@ -193,8 +193,8 @@ code : context {
}
: pattern {
regex \= (kontekst|wejście|wyjście|wewnętrzny)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .sc_id_def;
regex \= (kontekst|wejście|wyjście|wewnętrzny)(\s*)(|wyjście)(\s+)($${__SC_ID})
styles [] = .keyword_rule, .whitespace, .keyword_rule, .whitespace, .sc_id_def;
}
: pattern {

View File

@ -24,7 +24,7 @@ class CatalaPlLexer(RegexLexer):
'code' : [
(u'(```)', bygroups(Text), 'root'),
(u'(\\s*\\#.*$)', bygroups(Comment.Single)),
(u'(kontekst|wej\u015bcie|wyj\u015bcie|wewn\u0119trzny)(\\s+)([a-z\u0105\u0107\u0119\u0142\u0144\xf3\u015b\u017c\u017a][a-z\u0105\u0107\u0119\u0142\u0144\xf3\u015b\u017c\u017aA-Z\u0104\u0106\u0118\u0141\u0143\xd3\u015a\u017b\u01790-9_\\\']*)', bygroups(Keyword.Declaration, Text, Name.Variable)),
(u'(kontekst|wej\u015bcie|wyj\u015bcie|wewn\u0119trzny)(\\s*)(|wyj\u015bcie)(\\s+)([a-z\u0105\u0107\u0119\u0142\u0144\xf3\u015b\u017c\u017a][a-z\u0105\u0107\u0119\u0142\u0144\xf3\u015b\u017c\u017aA-Z\u0104\u0106\u0118\u0141\u0143\xd3\u015a\u017b\u01790-9_\\\']*)', bygroups(Keyword.Declaration, Text, Keyword.Declaration, Text, Name.Variable)),
(u'\\b(pasuje|ze\\s+wzorem|staloprzecinkowa|przez|malejacy|rosnacy|rozna|wraz z|mamy|w|takich ze|istnieje|dla|wszystkie|z|jezeli|wtedy|inaczej|poczatkowy)\\b', bygroups(Keyword.Reserved)),
(u'\\b(zakres|zalezy\\s+od|deklaracja|kolekcja|typu|opcjonalny|struktura|enumeracja|kontekst|wej\u015bcie|wyj\u015bcie|wewn\u0119trzny|zasada|pod\\s+warunkuem|czas|konsekwencja|spelnione|wynosi|asercja|definicja|etykieta|wyj\u0105tek|cokolwiek)\\b', bygroups(Keyword.Declaration)),
(u'(\\|[0-9]+\\-[0-9]+\\-[0-9]+\\|)', bygroups(Number.Integer)),

View File

@ -35,7 +35,7 @@ syn match punctuation contained "\(--\|\;\|\.\|,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Type contained calkowita zerojedynkowy czas trwania pieniądze warunek tekst dziesiętny suma
syn region ctxt contained
\ matchgroup=Keyword start="\<kontekst\|wejście\|wyjście\|wewnętrzny"
\ matchgroup=Keyword start="\<\(kontekst\|wejście\|wyjście\|wewnętrzny\)\(\|\s\+wyjście\)"
\ matchgroup=sc_id_def end="\s\+\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region cc_id_dot_sc_id contained contains=punctuation

View File

@ -2,17 +2,17 @@
```catala
declaration scope A:
context x content collection money
output x content collection money
scope A:
definition x equals [$0; $4 +$ $5; $8 *$ 0.65]
declaration scope B:
context a scope A
context max content money
context min content money
context y content money
context z content integer
a scope A
output max content money
output min content money
output y content money
output z content integer
scope B:
definition max equals maximum money initial $0 for m in a.x of m *$ 2.0

View File

@ -6,7 +6,7 @@ declaration structure S:
data income content money
declaration scope A:
context x content collection S
context output x content collection S
scope A:
definition x equals [
@ -16,9 +16,9 @@ scope A:
]
declaration scope B:
context a scope A
context argmax content S
context argmin content S
a scope A
output argmax content S
output argmin content S
scope B:
definition argmax equals content maximum money initial S { -- id: -1 --income: $0 } for m in a.x of (m.income *$ 2.0)

View File

@ -2,8 +2,8 @@
```catala
declaration scope A:
context x content collection integer
context y content collection integer
output x content collection integer
output y content collection integer
scope A:
definition x equals [0; 1; 2] ++ [3; 4; 5; 6]

View File

@ -2,15 +2,15 @@
```catala
declaration scope A:
context x content collection money
output x content collection money
scope A:
definition x equals [$0; $4 +$ $5; $8 *$ 0.65]
declaration scope B:
context a scope A
context y content collection money
context z content collection boolean
a scope A
output y content collection money
output z content collection boolean
scope B:
definition y equals filter for m in a.x of (m >=$ $4.95)

View File

@ -2,17 +2,17 @@
```catala
declaration scope A:
context x content collection integer
output x content collection integer
scope A:
definition x equals [0; 4+5; 8*8]
declaration scope B:
context a scope A
context v content integer
context w content boolean
context y content boolean
context z content boolean
a scope A
output v content integer
output w content boolean
output y content boolean
output z content boolean
scope B:
definition v equals number of a.x

View File

@ -1,4 +1,4 @@
let scope TestBool (foo: bool|input|output) (bar: integer|input|output) =
let scope TestBool (foo: bool|context|output) (bar: integer|context|output) =
let bar : integer =
reentrant or by default
⟨⟨true ⊢ ⟨⟨true ⊢ 1⟩ | false ⊢ ∅ ⟩⟩ |

View File

@ -2,8 +2,8 @@
```catala
declaration scope TestBool:
context foo content boolean
context bar content integer
context output foo content boolean
context output bar content integer
scope TestBool:
definition bar equals 1

View File

@ -2,7 +2,7 @@
```catala
declaration scope TestBool:
context foo content boolean
context output foo content boolean
scope TestBool:
definition foo equals true and not false and false = false

View File

@ -2,10 +2,10 @@
```catala
declaration scope TestXor:
context t_xor_t content boolean
context t_xor_f content boolean
context f_xor_t content boolean
context f_xor_f content boolean
context output t_xor_t content boolean
context output t_xor_f content boolean
context output f_xor_t content boolean
context output f_xor_f content boolean
scope TestXor:
definition t_xor_t equals true xor true

View File

@ -2,13 +2,13 @@
```catala
declaration scope A:
context x content date
context y content date
context z content boolean
context z2 content boolean
context z3 content duration
context d content decimal
context d2 content decimal
context output x content date
context output y content date
context output z content boolean
context output z2 content boolean
context output z3 content duration
context output d content decimal
context output d2 content decimal
scope A:
definition x equals |2019-01-01|

View File

@ -2,9 +2,9 @@
```catala
declaration scope A:
context x content date
context y content date
context z content duration
context output x content date
context output y content date
context output z content duration
scope A:
definition x equals |2019-01-01|

View File

@ -2,10 +2,10 @@
```catala
declaration scope A:
context x content decimal
context y content decimal
context z content decimal
context a content decimal
context output x content decimal
context output y content decimal
context output z content decimal
context output a content decimal
scope A:
definition x equals 84.64866565265689623

View File

@ -2,9 +2,9 @@
```catala
declaration scope A:
context x content decimal
context y content decimal
context z content decimal
context output x content decimal
context output y content decimal
context output z content decimal
scope A:
definition x equals 84.648665

View File

@ -6,8 +6,8 @@ declaration enumeration E:
-- Case2
declaration scope A:
context x content E
context y content integer
context output x content E
context output y content integer
scope A:
definition x equals Case1

View File

@ -9,9 +9,9 @@ declaration enumeration F:
-- Case2
declaration scope A:
context e content E
context f content F
context x content integer
context output e content E
context output f content F
context output x content integer
scope A:
definition e equals E.Case1

View File

@ -6,9 +6,9 @@ declaration enumeration E:
-- Case2
declaration scope A:
context x content E
context y content boolean
context z content boolean
context output x content E
context output y content boolean
context output z content boolean
scope A:
definition x equals Case1 content 2

View File

@ -6,8 +6,8 @@ declaration enumeration E:
-- Case2
declaration scope A:
context x content E
context y content integer
context output x content E
context output y content integer
scope A:
definition x equals Case1 content 2

View File

@ -11,8 +11,8 @@ declaration enumeration E:
```catala
declaration scope Simple_case:
context x content E
context y content integer
context output x content E
context output y content integer
scope Simple_case:
definition x equals Case1 content 2
@ -25,8 +25,8 @@ scope Simple_case:
```catala
declaration scope Simple_case_2:
context x content E
context y content integer
context output x content E
context output y content integer
scope Simple_case_2:
definition x equals Case3

View File

@ -2,8 +2,8 @@
```catala
declaration scope A:
context x content integer
context y content integer
context output x content integer
context output y content integer
scope A:
label base_x

View File

@ -2,7 +2,7 @@
```catala
declaration scope A:
context x content integer
context output x content integer
scope A:
label base_x

View File

@ -2,7 +2,7 @@
```catala
declaration scope A:
context x content integer
context output x content integer
scope A:
label base_x

View File

@ -5,8 +5,8 @@ declaration structure Person:
data disabled content boolean
declaration scope Benefit:
context person content Person
context benefit content money
context output person content Person
context output benefit content money
scope Benefit:
definition person equals Person {

View File

@ -2,9 +2,9 @@
```catala
declaration scope A:
context x content integer
context y content integer
context z content integer
context output x content integer
context output y content integer
context output z content integer
scope A:
label base

View File

@ -2,7 +2,7 @@
```catala
declaration scope A:
context x content integer
context output x content integer
scope A:
definition x equals 0

View File

@ -2,8 +2,8 @@
```catala
declaration scope A:
context x content integer
context y content integer
context output x content integer
context output y content integer
scope A:
definition x equals 0

View File

@ -2,7 +2,7 @@
```catala
declaration scope A:
context x content integer
context output x content integer
scope A:
definition x equals 0

View File

@ -2,8 +2,8 @@
```catala
declaration scope A:
context x content integer
context y content integer
context output x content integer
context output y content integer
scope A:
exception

View File

@ -4,11 +4,11 @@
declaration scope S:
context f content integer depends on integer
context b content boolean
context out content integer
context output out content integer
declaration scope R:
context s scope S
context r content integer
s scope S
context output r content integer
scope S:
definition f of x under condition (x >= x) consequence equals x + x

View File

@ -4,11 +4,11 @@
declaration scope S:
context f content integer depends on integer
context b content boolean
context out content integer
context output out content integer
declaration scope R:
context s scope S
context r content integer
s scope S
context output r content integer
scope S:
definition f of x under condition (x >= x) consequence equals x + x

View File

@ -15,7 +15,7 @@ let () = print_endline "Hello world!"
```catala
declaration scope A:
context literate_parsing_is_ok content boolean
context output literate_parsing_is_ok content boolean
scope A:
definition literate_parsing_is_ok equals true

View File

@ -15,7 +15,7 @@ let () = print_endline "Hello world!"
```catala
déclaration champ d'application A:
contexte literate_parsing_is_ok contenu booléen
contexte sortie literate_parsing_is_ok contenu booléen
champ d'application A:
définition literate_parsing_is_ok égal à vrai

View File

@ -15,7 +15,7 @@ let () = print_endline "Hello world!"
```catala
deklaracja zakres A:
kontekst literate_parsing_is_ok typu zerojedynkowy
kontekst wyjście literate_parsing_is_ok typu zerojedynkowy
zakres A:
definicja literate_parsing_is_ok wynosi prawda

View File

@ -6,14 +6,14 @@ declaration enumeration E:
-- B
declaration scope S:
context a content E
context output a content E
```
Some law text...
```catala-metadata
declaration scope S2:
context b content E
context output b content E
```
## PROGRAM

View File

@ -2,9 +2,9 @@
```catala
declaration scope A:
context x content money
context y content money
context z content money
context output x content money
context output y content money
context output z content money
scope A:
definition x equals $123.54

View File

@ -2,8 +2,8 @@
```catala
declaration scope S:
context a content A
context b content B
context output a content A
context output b content B
declaration structure A:
data x content integer

View File

@ -10,8 +10,6 @@ The solver generated the following counterexample to explain the faulty behavior
[RESULT] [Amount.amount] No two exceptions to ever overlap for this variable
[RESULT] [Amount.correct_amount] This variable never returns an empty error
[RESULT] [Amount.correct_amount] No two exceptions to ever overlap for this variable
[RESULT] [Amount.eligibility.is_eligible_correct] No two exceptions to ever overlap for this variable
[RESULT] [Amount.eligibility.is_eligible] No two exceptions to ever overlap for this variable
[RESULT] [Amount.eligibility.is_professor] No two exceptions to ever overlap for this variable
[RESULT] [Amount.eligibility.is_student] No two exceptions to ever overlap for this variable
[RESULT] [Amount.number_of_advisors] This variable never returns an empty error
@ -23,8 +21,8 @@ The solver generated the following counterexample to explain the faulty behavior
[ERROR] [Eligibility.is_eligible] This variable might return an empty error:
--> tests/test_proof/bad/prolala_motivating_example.catala_en
|
11 | context is_eligible content boolean
| ^^^^^^^^^^^
11 | output is_eligible content boolean
| ^^^^^^^^^^^
+ ProLaLa 2022 Super Cash Bonus
+-+ Eligibility
The solver generated the following counterexample to explain the faulty behavior:
@ -32,8 +30,8 @@ The solver generated the following counterexample to explain the faulty behavior
[ERROR] [Eligibility.is_eligible] At least two exceptions overlap for this variable:
--> tests/test_proof/bad/prolala_motivating_example.catala_en
|
11 | context is_eligible content boolean
| ^^^^^^^^^^^
11 | output is_eligible content boolean
| ^^^^^^^^^^^
+ ProLaLa 2022 Super Cash Bonus
+-+ Eligibility
The solver generated the following counterexample to explain the faulty behavior:

View File

@ -8,8 +8,8 @@ Demo: https://asciinema.org/a/461790
declaration scope Eligibility:
context is_student content boolean
context is_professor content boolean
context is_eligible content boolean
context is_eligible_correct condition
output is_eligible content boolean
output is_eligible_correct condition
scope Eligibility:
definition is_student equals true
@ -53,7 +53,7 @@ scope Eligibility:
```catala-metadata
declaration scope Amount:
context eligibility scope Eligibility
eligibility scope Eligibility
context is_student content boolean
context is_professor content boolean
context number_of_advisors content integer

View File

@ -2,18 +2,18 @@
```catala
declaration scope A:
context x content integer
context u content boolean
context output x content integer
context output u content boolean
declaration scope B:
context a1 scope A
context a2 scope A
context y content integer
a1 scope A
a2 scope A
context output y content integer
declaration scope C:
context a scope A
context b scope B
context z content integer
a scope A
b scope B
context output z content integer
scope A:
definition x equals 0

View File

@ -2,12 +2,12 @@
```catala
declaration scope A:
context b scope B
context x content integer
b scope B
context output x content integer
declaration scope B:
context a scope A
context y content integer
a scope A
context output y content integer
scope A:
definition x equals b.y

View File

@ -10,8 +10,8 @@ Cycle variable B, declared:
Used here in the definition of another cycle variable A:
--> tests/test_scope/bad/cyclic_scopes.catala_en
|
5 | context b scope B
| ^
5 | b scope B
| ^
+ Article
Cycle variable A, declared:
@ -24,6 +24,6 @@ Cycle variable A, declared:
Used here in the definition of another cycle variable B:
--> tests/test_scope/bad/cyclic_scopes.catala_en
|
9 | context a scope A
| ^
9 | a scope A
| ^
+ Article

View File

@ -2,11 +2,11 @@
```catala
declaration scope A:
context x content boolean
context y content integer
context output x content boolean
context output y content integer
declaration scope B:
context a scope A
a scope A
scope B:
definition a.x equals true

View File

@ -2,17 +2,17 @@
```catala
declaration scope A:
context x content integer
context output x content integer
declaration scope B:
context a scope A
context y1 content integer
context y2 content integer
a scope A
context output y1 content integer
context output y2 content integer
declaration scope C:
context b scope B
context z1 content integer
context z2 content integer
b scope B
context output z1 content integer
context output z2 content integer
scope A:

View File

@ -2,15 +2,15 @@
```catala
declaration scope A:
context a content integer
context b content boolean
context a_base content integer
context output a content integer
context output b content boolean
context output a_base content integer
declaration scope B:
context a content integer
context b content boolean
context scopeA scope A
context scopeAbis scope A
context output a content integer
context output b content boolean
scopeA scope A
scopeAbis scope A
scope A:
definition a_base equals 1

View File

@ -2,18 +2,18 @@
```catala
declaration scope A:
context x content integer
context u content boolean
context output x content integer
context output u content boolean
declaration scope B:
context a1 scope A
context a2 scope A
context y content integer
a1 scope A
a2 scope A
context output y content integer
declaration scope C:
context a scope A
context b scope B
context z content integer
a scope A
b scope B
context output z content integer
scope A:
definition x equals 0

View File

@ -3,11 +3,11 @@
```catala
declaration scope Callee:
context input_v content integer depends on boolean
context output_v content integer
context output output_v content integer
declaration scope Caller:
context sub scope Callee
context y content integer
sub scope Callee
context output y content integer
scope Callee:
definition input_v of b equals if b then 0 else 1

View File

@ -4,10 +4,10 @@
declaration scope Callee:
context function condition depends on integer
context input_v content integer
context output_v condition
context output output_v condition
declaration scope Caller:
context callee scope Callee
callee scope Callee
scope Callee:

View File

@ -10,12 +10,12 @@ declaration structure T:
data b content S
declaration scope A:
context t content T
context output t content T
declaration scope B:
context t content T
context a scope A
context out content integer
context output t content T
a scope A
context output out content integer
scope A:
definition t equals T {

View File

@ -8,8 +8,8 @@ declaration structure Bar:
data f content integer
declaration scope A:
context x content Foo
context y content integer
context output x content Foo
context output y content integer
scope A:
definition x equals Foo { -- f: 1 }

View File

@ -6,8 +6,8 @@ declaration structure S:
data y content integer
declaration scope A:
context s content S
context z content integer
context output s content S
context output z content integer
scope A:
definition s equals S {

View File

@ -21,4 +21,4 @@ let A =
⟨⟨true ⊢ ⟨⟨true ⊢ b_12 + d_13⟩ | false ⊢ ∅ ⟩⟩ |
true ⊢ ⟨⟨false ⊢ ∅ ⟩ | false ⊢ ∅ ⟩⟩
in
A_out {"a_out"= a_11; "c_out"= c_14}
A_out {"c_out"= c_14}

View File

@ -1,18 +1,17 @@
let B =
λ (B_in_18: B_in{}) →
let a.a_19 : unit → integer = λ (__20: unit) → ∅
in
let a.b_21 : unit → integer =
λ (__22: unit) →
λ (B_in_15: B_in{}) →
let a.b_16 : unit → integer =
λ (__17: unit) →
⟨⟨true ⊢ ⟨⟨true ⊢ 2⟩ | false ⊢ ∅ ⟩⟩ | true ⊢
⟨⟨false ⊢ ∅ ⟩ | false ⊢ ∅ ⟩⟩
in
let result_23 : A_out{"a_out": integer; "c_out": integer} =
A_2 (A_in {"a_in"= a.a_19; "b_in"= a.b_21})
let result_18 : A_out{"c_out": integer} =
A_2
(A_in
{"a_in"= λ (__19: unit) → ∅ ; "b_in"= a.b_16; "c_in"=
λ (__20: unit) → ∅ ; "d_in"= λ (__21: unit) → ∅ })
in
let a.a_24 : integer = result_23."a_out"
let a.c_22 : integer = result_18."c_out"
in
let a.c_25 : integer = result_23."c_out"
in
let __26 : unit = assert (a.c_25 = 1) in
let __23 : unit = assert (a.c_22 = 1) in
B_out {}

View File

@ -8,7 +8,7 @@ declaration scope A:
internal d content integer
declaration scope B:
context a scope A
a scope A
scope A:
definition a equals 0