fix: several small fixes

This commit is contained in:
TopchetoEU 2023-11-05 19:43:53 +02:00
parent f885d4349f
commit af31b1ab79
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,6 @@ package me.topchetoeu.jscript.lib;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.function.Function;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import me.topchetoeu.jscript.engine.Context; import me.topchetoeu.jscript.engine.Context;
@ -290,6 +289,7 @@ import me.topchetoeu.jscript.interop.NativeGetter;
if (flags.contains("s")) this.flags |= Pattern.DOTALL; if (flags.contains("s")) this.flags |= Pattern.DOTALL;
if (flags.contains("u")) this.flags |= Pattern.UNICODE_CHARACTER_CLASS; if (flags.contains("u")) this.flags |= Pattern.UNICODE_CHARACTER_CLASS;
if (pattern.equals("{(\\d+)}")) pattern = "\\{([0-9]+)\\}";
this.pattern = Pattern.compile(pattern.replace("\\d", "[0-9]"), this.flags); this.pattern = Pattern.compile(pattern.replace("\\d", "[0-9]"), this.flags);
var matcher = NAMED_PATTERN.matcher(source); var matcher = NAMED_PATTERN.matcher(source);

View File

@ -257,7 +257,7 @@ public class Parsing {
} }
break; break;
case CURR_LITERAL: case CURR_LITERAL:
if (isAlphanumeric(c) || c == '_') { if (isAlphanumeric(c) || c == '_' || c == '$') {
currToken.append(c); currToken.append(c);
continue; continue;
} }