Add back support for older iOS versions

Add new molang validation for ")("
This commit is contained in:
JannisX11 2023-12-21 14:43:01 +01:00
parent c891ca0652
commit e2fa88246a

View File

@ -587,6 +587,7 @@ new ValidatorCheck('molang_syntax', {
run() {
let check = this;
let keywords = ['return', 'continue', 'break'];
let two_expression_regex = (isApp || window.chrome) ? new RegExp('(?<!\\w)[0-9._]+\\(|\\)[a-z0-9._]+') : null;
function validateMolang(string, message, instance) {
if (!string || typeof string !== 'string') return;
let clear_string = string.replace(/'.*'/g, '0');
@ -598,7 +599,7 @@ new ValidatorCheck('molang_syntax', {
if (clear_string.match(/^[+*/.,?=&<>|]/)) {
issues.push('Expression starts with an invalid character');
}
if ((clear_string.match(/[\w.]\s+[\w.]/) && !keywords.find(k => clear_string.includes(k))) || clear_string.match(/(?<!\w)[0-9._]+\(|\)[a-z0-9._]+/)) {
if ((clear_string.match(/[\w.]\s+[\w.]/) && !keywords.find(k => clear_string.includes(k))) || clear_string.match(/\)\(/) || (two_expression_regex && clear_string.match(two_expression_regex))) {
issues.push('Two expressions with no operator in between');
}
if (clear_string.match(/(^|[^a-z0-9_])[\d.]+[a-z_]+/i)) {