mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 23:04:08 +00:00
Added syntax highlighting for JS types.
This commit is contained in:
1 parent
d2de021dae
commit
2b7aa3467f
1 file changed
+8
@@ -14,6 +14,7 @@ public class TextContainer {
|
||||
//public final Pattern regexString = Pattern.compile("\"(.*?(?<![\\\\])(\\s)*?)*?\"");
|
||||
public final Pattern regexString = Pattern.compile("([\"'])(?:(?=(\\\\?))\\2.)*?\\1", Pattern.MULTILINE);
|
||||
public final Pattern regexFunction = Pattern.compile("\\b(if|else|switch|with|for|while|in|var|const|let|throw|then|function|continue|break|foreach|return|try|catch|finally|do|this|typeof|instanceof|new)(?=[^\\w])");
|
||||
public final Pattern regexType = Pattern.compile("\\b(Array|Date|eval|hasOwnProperty|Infinity|isFinite|isNaN|isPrototypeOf|Math|NaN|Number|Object|prototype|String|toString|undefined|valueOf)(?=[^\\w])");
|
||||
public final Pattern regexWord = Pattern.compile("[\\p{L}-]+|\\n|$");
|
||||
public final Pattern regexNumber = Pattern.compile("\\b-?(?:0[xX][\\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?(?:[fFbBdDlLsS])?|NaN|null|Infinity|unidentified|true|false)\\b");
|
||||
public final Pattern regexComment = Pattern.compile("\\/\\*[\\s\\S]*?(?:\\*\\/|$)|\\/\\/.*|#.*");
|
||||
@@ -88,6 +89,13 @@ public class TextContainer {
|
||||
markup = markup2;
|
||||
}
|
||||
}
|
||||
matcher = regexType.matcher(s);
|
||||
if(matcher.find()){
|
||||
MarkUp markup2 = new MarkUp(matcher.start(), matcher.end(), '3', 0);
|
||||
if(compareMarkUps(markup, markup2)) {
|
||||
markup = markup2;
|
||||
}
|
||||
}
|
||||
matcher = regexString.matcher(s);
|
||||
if(matcher.find()){
|
||||
MarkUp markup2 = new MarkUp(matcher.start(), matcher.end(), '4', 7);
|
||||
|
||||
Reference in new issue
Block a user