Optimise type assumption syntax

This commit is contained in:
Moritz Dieing 2021-07-02 14:47:25 +02:00
parent dc69e14c04
commit f928b2bae3
2 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,8 @@ function modifyValue(area: HTMLInputElement) {
const value = parseBack(area.value);
const start = area.selectionStart;
const end = area.selectionEnd;
// ignore brackets, allow '>', spaces, ':', '.' or '∀' in front and '-', spaces, '.', ':' or ';' at the end of string
area.value = value.replace(/(^|\s+|\(|\)|>|∀|:|\.)t[0-9]+(?=\s+|\)|\(|-|:|\.|;|$)/ig, replacer);
// ignore brackets, allow '>', spaces, ':', '.', ',' or '∀' in front and '-', spaces, '.', ':', ',' or ';' at the end of string
area.value = value.replace(/(^|\s+|\(|\)|>|∀|:|,|\.)t[0-9]+(?=\s+|\)|\(|-|:|\.|;|,|$)/ig, replacer);
area.selectionStart = start;
area.selectionEnd = end;
}

View File

@ -23,10 +23,11 @@ root.termGrammar=\u2329Term\u232A ::= (\u2329Term\u232A) | \u2329App\u232A | \u2
\u2329Const\u232A ::= [0-9]+ | true | false
root.typeGrammar=\u2329Type\u232A ::= \u2329QuantifiedType\u232A | \u2329NormalType\u232A <br> \
\u2329QuantifiedType\u232A ::= <b>∀</b>\u2329VarType\u232A<b>.</b>\u2329NormalType\u232A <br> \
\u2329QuantifiedType\u232A ::= <b>∀</b>\u2329EnumVarType\u232A<b>.</b>\u2329NormalType\u232A <br> \
\u2329NormalType\u232A ::= (\u2329NormalType\u232A) | \u2329NamedType\u232A | \u2329VarType\u232A | \
\u2329FunctionType\u232A <br> \
\u2329NamedType\u232A ::= [a-zA-Z][a-zA-Z0-9]*&nbsp;&nbsp\\t[0-9]+ <br> \
\u2329EnumVarType\u232A ::= \u2329VarType\u232A <b>,</b> \u2329EnumVarType\u232A | \u2329VarType\u232A <br>\
\u2329VarType\u232A ::= t[0-9]+ <br> \
\u2329FunctionType\u232A ::= \u2329NormalType\u232A -> \u2329NormalType\u232A