impredicative/predicative split
This commit is contained in:
parent
973acd4151
commit
bed94f3d41
4 changed files with 82 additions and 6 deletions
|
|
@ -33,7 +33,7 @@ module.exports = grammar({
|
|||
|
||||
star : $ => "*",
|
||||
square : $ => choice('□', '[]'),
|
||||
sort : $ => choice($.star, $.square, seq($.square, /[0-9]+/)),
|
||||
sort : $ => choice($.star, $.square, seq($.square, /[0-9₀₁₂₃₄₅₆₇₈₉]+/)),
|
||||
|
||||
labs : $ => seq(
|
||||
choice('λ', 'fun'),
|
||||
|
|
|
|||
2
src/grammar.json
generated
2
src/grammar.json
generated
|
|
@ -114,7 +114,7 @@
|
|||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[0-9]+"
|
||||
"value": "[0-9₀₁₂₃₄₅₆₇₈₉]+"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
12
src/parser.c
generated
12
src/parser.c
generated
|
|
@ -555,7 +555,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
|||
);
|
||||
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||
lookahead == ' ') SKIP(0);
|
||||
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52);
|
||||
if (('0' <= lookahead && lookahead <= '9') ||
|
||||
(0x2080 <= lookahead && lookahead <= 0x2089)) ADVANCE(52);
|
||||
END_STATE();
|
||||
case 1:
|
||||
if (lookahead == '\n') SKIP(1);
|
||||
|
|
@ -581,7 +582,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
|||
);
|
||||
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||
lookahead == ' ') SKIP(2);
|
||||
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52);
|
||||
if (('0' <= lookahead && lookahead <= '9') ||
|
||||
(0x2080 <= lookahead && lookahead <= 0x2089)) ADVANCE(52);
|
||||
if (('A' <= lookahead && lookahead <= 'Z') ||
|
||||
lookahead == '_' ||
|
||||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
||||
|
|
@ -596,7 +598,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
|||
if (lookahead == 0x25a1) ADVANCE(50);
|
||||
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||
lookahead == ' ') SKIP(3);
|
||||
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52);
|
||||
if (('0' <= lookahead && lookahead <= '9') ||
|
||||
(0x2080 <= lookahead && lookahead <= 0x2089)) ADVANCE(52);
|
||||
if (('A' <= lookahead && lookahead <= 'Z') ||
|
||||
lookahead == '_' ||
|
||||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
||||
|
|
@ -822,7 +825,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
|||
END_STATE();
|
||||
case 52:
|
||||
ACCEPT_TOKEN(aux_sym_sort_token1);
|
||||
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52);
|
||||
if (('0' <= lookahead && lookahead <= '9') ||
|
||||
(0x2080 <= lookahead && lookahead <= 0x2089)) ADVANCE(52);
|
||||
END_STATE();
|
||||
case 53:
|
||||
ACCEPT_TOKEN(anon_sym_u03bb);
|
||||
|
|
|
|||
72
test/corpus/sorts.txt
Normal file
72
test/corpus/sorts.txt
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
=====
|
||||
Sorts
|
||||
=====
|
||||
|
||||
def foo (A : *) (B : □) (C : □₁) (D : []) (E : []1) (F : □1) (G : □₁₂₃) := A;
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(definition
|
||||
(identifier)
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(star)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(param_block
|
||||
(identifier)
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(sort
|
||||
(square)))))))
|
||||
(expr
|
||||
(app_term
|
||||
(app
|
||||
(term
|
||||
(identifier)))))))
|
||||
Loading…
Reference in a new issue