Fix pattern defs for pascaligo

This commit is contained in:
Kirill Andreev 2020-08-24 14:17:53 +04:00
parent f554551f75
commit 5533b07270
No known key found for this signature in database
GPG Key ID: CF7DA79DE4785A47
4 changed files with 8 additions and 5 deletions

View File

@ -733,7 +733,7 @@ module.exports = grammar({
_core_pattern: $ => _core_pattern: $ =>
choice( choice(
$.Name, $.var_pattern,
'_', '_',
$.Int, $.Int,
$.Nat, $.Nat,
@ -743,6 +743,8 @@ module.exports = grammar({
$._constr_pattern, $._constr_pattern,
), ),
var_pattern: $ => field("name", $.Name),
_list_pattern: $ => _list_pattern: $ =>
choice( choice(
$.list_pattern, $.list_pattern,

View File

@ -115,6 +115,7 @@ recognise = descent (error "Reasonligo.recognise") $ map usingScope
"nil" -> return $ IsList [] "nil" -> return $ IsList []
"list_pattern" -> IsList <$> fields "element" "list_pattern" -> IsList <$> fields "element"
"cons_pattern" -> IsCons <$> field "head" <*> field "tail" "cons_pattern" -> IsCons <$> field "head" <*> field "tail"
"var_pattern" -> IsVar <$> field "name"
_ -> fallthrough _ -> fallthrough
-- Alt -- Alt