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 : $ => "*",
|
star : $ => "*",
|
||||||
square : $ => choice('□', '[]'),
|
square : $ => choice('□', '[]'),
|
||||||
sort : $ => choice($.star, $.square, seq($.square, /[0-9]+/)),
|
sort : $ => choice($.star, $.square, seq($.square, /[0-9₀₁₂₃₄₅₆₇₈₉]+/)),
|
||||||
|
|
||||||
labs : $ => seq(
|
labs : $ => seq(
|
||||||
choice('λ', 'fun'),
|
choice('λ', 'fun'),
|
||||||
|
|
|
||||||
2
src/grammar.json
generated
2
src/grammar.json
generated
|
|
@ -114,7 +114,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"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') ||
|
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||||
lookahead == ' ') SKIP(0);
|
lookahead == ' ') SKIP(0);
|
||||||
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(52);
|
if (('0' <= lookahead && lookahead <= '9') ||
|
||||||
|
(0x2080 <= lookahead && lookahead <= 0x2089)) ADVANCE(52);
|
||||||
END_STATE();
|
END_STATE();
|
||||||
case 1:
|
case 1:
|
||||||
if (lookahead == '\n') SKIP(1);
|
if (lookahead == '\n') SKIP(1);
|
||||||
|
|
@ -581,7 +582,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||||
);
|
);
|
||||||
if (('\t' <= lookahead && lookahead <= '\r') ||
|
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||||
lookahead == ' ') SKIP(2);
|
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') ||
|
if (('A' <= lookahead && lookahead <= 'Z') ||
|
||||||
lookahead == '_' ||
|
lookahead == '_' ||
|
||||||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
||||||
|
|
@ -596,7 +598,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||||
if (lookahead == 0x25a1) ADVANCE(50);
|
if (lookahead == 0x25a1) ADVANCE(50);
|
||||||
if (('\t' <= lookahead && lookahead <= '\r') ||
|
if (('\t' <= lookahead && lookahead <= '\r') ||
|
||||||
lookahead == ' ') SKIP(3);
|
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') ||
|
if (('A' <= lookahead && lookahead <= 'Z') ||
|
||||||
lookahead == '_' ||
|
lookahead == '_' ||
|
||||||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
('a' <= lookahead && lookahead <= 'z')) ADVANCE(44);
|
||||||
|
|
@ -822,7 +825,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||||
END_STATE();
|
END_STATE();
|
||||||
case 52:
|
case 52:
|
||||||
ACCEPT_TOKEN(aux_sym_sort_token1);
|
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();
|
END_STATE();
|
||||||
case 53:
|
case 53:
|
||||||
ACCEPT_TOKEN(anon_sym_u03bb);
|
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