From b5d95aa4086ea1533392b9f8804f54f2feaef197 Mon Sep 17 00:00:00 2001 From: appt2 Date: Tue, 26 Mar 2024 23:08:27 +0330 Subject: [PATCH] refactor code setThemeForJson --- .androidide/editor/openedFiles.json | 20 + .../code/utils/SetThemeForJson.java | 553 +-- .../rosemoe/sora/langs/html/HTMLAnalyzer.java | 2159 +++++----- .../sora/langs/html/HTMLTextTokenizer.java | 3518 +++++++++-------- 4 files changed, 3029 insertions(+), 3221 deletions(-) create mode 100644 .androidide/editor/openedFiles.json diff --git a/.androidide/editor/openedFiles.json b/.androidide/editor/openedFiles.json new file mode 100644 index 00000000..bb5a692c --- /dev/null +++ b/.androidide/editor/openedFiles.json @@ -0,0 +1,20 @@ +{ + "allFiles": [ + { + "file": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java", + "selection": { + "end": { + "column": 43, + "index": 7456, + "line": 177 + }, + "start": { + "column": 43, + "index": 7456, + "line": 177 + } + } + } + ], + "selectedFile": "/storage/emulated/0/AndroidIDEProjects/Ghost-web-ide/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java" +} \ No newline at end of file diff --git a/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java b/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java index 90921525..97034e72 100644 --- a/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java +++ b/app/src/main/java/Ninja/coder/Ghostemane/code/utils/SetThemeForJson.java @@ -21,412 +21,181 @@ import java.util.TimerTask; public class SetThemeForJson { - protected HashMap map = new HashMap<>(); - private Timer timer = new Timer(); - private TimerTask task; + protected HashMap map = new HashMap<>(); + private Timer timer = new Timer(); + private TimerTask task; + public SetThemeForJson() {} - public SetThemeForJson() { - } - - public SetThemeForJson(HashMap maps) { - this.map = maps; - } + public SetThemeForJson(HashMap maps) { + this.map = maps; + } - public SetThemeForJson setShowTheme() { - if (map.containsKey("Title")) { - map.put("Title", Color.parseColor("#FF84A9FF")); - } else { - map.put("Title", Color.BLUE); - } - if (map.containsKey("BackGround")) { - map.put("BackGround", Color.parseColor("#FFFF84FA")); - } else { - map.put("BackGround", Color.DKGRAY); - } - return this; + public SetThemeForJson setShowTheme() { + if (map.containsKey("Title")) { + map.put("Title", Color.parseColor("#FF84A9FF")); + } else { + map.put("Title", Color.BLUE); } - - public SetThemeForJson setThemeCodeEditor( - CodeEditor editor, HashMap imap, boolean chackHashMap, Activity x) { - - if (imap.containsKey("OPERATOR")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.OPERATOR, Color.parseColor(imap.get("OPERATOR").toString())); - - } else { - editor.getColorScheme().setColor(EditorColorScheme.OPERATOR, Color.parseColor("#ffa1aaff")); - } - if (imap.containsKey("BLOCK_LINE")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.BLOCK_LINE, Color.parseColor(imap.get("BLOCK_LINE").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.BLOCK_LINE, Color.parseColor("#ffaea2ff")); - } - if (imap.containsKey("BLOCK_LINE_CURRENT")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.BLOCK_LINE_CURRENT, - Color.parseColor(imap.get("BLOCK_LINE_CURRENT").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.BLOCK_LINE_CURRENT, Color.parseColor("#ffb9eeff")); - } - if (imap.containsKey("NON_PRINTABLE_CHAR")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.NON_PRINTABLE_CHAR, - Color.parseColor(imap.get("NON_PRINTABLE_CHAR").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.NON_PRINTABLE_CHAR, Color.parseColor("#ffb9ffcb")); - } - if (imap.containsKey("CURRENT_LINE")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.CURRENT_LINE, - Color.parseColor(imap.get("CURRENT_LINE").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.CURRENT_LINE, Color.parseColor("#20171717")); - } - if (imap.containsKey("SELECTION_INSERT")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.SELECTION_INSERT, - Color.parseColor(imap.get("SELECTION_INSERT").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.SELECTION_INSERT, Color.parseColor("#ffffffff")); - } - if (imap.containsKey("SELECTION_HANDLE")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.SELECTION_HANDLE, - Color.parseColor(imap.get("SELECTION_HANDLE").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.SELECTION_HANDLE, Color.parseColor("#ffffffff")); - } - if (imap.containsKey("LINE_NUMBER")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.LINE_NUMBER, Color.parseColor(imap.get("LINE_NUMBER").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.LINE_NUMBER, Color.parseColor("#ff748979")); - } - if (imap.containsKey("LINE_DIVIDER")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.LINE_DIVIDER, - Color.parseColor(imap.get("LINE_DIVIDER").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.LINE_DIVIDER, Color.parseColor("#FF2B2121")); - } - if (imap.containsKey("ATTRIBUTE_VALUE")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.ATTRIBUTE_VALUE, - Color.parseColor(imap.get("ATTRIBUTE_VALUE").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.ATTRIBUTE_VALUE, Color.parseColor("#ffffdcb9")); - } - if (imap.containsKey("ATTRIBUTE_NAME")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.ATTRIBUTE_NAME, - Color.parseColor(imap.get("ATTRIBUTE_NAME").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.ATTRIBUTE_NAME, Color.parseColor("#FF1B4AD7")); - } - if (imap.containsKey("HTML_TAG")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.HTML_TAG, Color.parseColor(imap.get("HTML_TAG").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.HTML_TAG, Color.parseColor("#ffffa1d9")); - } - if (imap.containsKey("TEXT_NORMAL")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.TEXT_NORMAL, Color.parseColor(imap.get("TEXT_NORMAL").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.TEXT_NORMAL, Color.parseColor("#ffebffd7")); - } - if (imap.containsKey("IDENTIFIER_NAME")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.IDENTIFIER_NAME, - Color.parseColor(imap.get("IDENTIFIER_NAME").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.IDENTIFIER_NAME, Color.parseColor("#626262")); - } - if (imap.containsKey("COMMENT")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.COMMENT, Color.parseColor(imap.get("COMMENT").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.COMMENT, Color.parseColor("#fff0be4b")); - } - //// for css and other.... - if (imap.containsKey("KEYWORD")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.KEYWORD, Color.parseColor(imap.get("KEYWORD").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.KEYWORD, Color.parseColor("#ffffa1a1")); - } - if (imap.containsKey("print")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.print, Color.parseColor(imap.get("print").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.print, Color.parseColor("#ffb4a1ff")); - } - if (imap.containsKey("Ninja")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.Ninja, Color.parseColor(imap.get("Ninja").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.Ninja, Color.parseColor("#ffffac94")); - } - if (imap.containsKey("LITERAL")) { - editor - .getColorScheme() - .setColor(EditorColorScheme.LITERAL, Color.parseColor(imap.get("LITERAL").toString())); - } else { - editor.getColorScheme().setColor(EditorColorScheme.LITERAL, Color.parseColor("#ffdea1ff")); - } - if (imap.containsKey("AUTO_COMP_PANEL_BG")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.AUTO_COMP_PANEL_BG, - Color.parseColor(imap.get("AUTO_COMP_PANEL_BG").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.AUTO_COMP_PANEL_BG, Color.parseColor("#FF281B26")); - } - if (imap.containsKey("AUTO_COMP_PANEL_CORNER")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.AUTO_COMP_PANEL_CORNER, - Color.parseColor(imap.get("AUTO_COMP_PANEL_CORNER").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.AUTO_COMP_PANEL_CORNER, Color.parseColor("#FFFCACF1")); - } - if (imap.containsKey("LINE_NUMBER_BACKGROUND")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.LINE_NUMBER_BACKGROUND, - Color.parseColor(imap.get("LINE_NUMBER_BACKGROUND").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.LINE_NUMBER_BACKGROUND, Color.parseColor("#FF281B26")); - } - if (imap.containsKey("WHOLE_BACKGROUND")) { - editor - .getColorScheme() - .setColor( - EditorColorScheme.WHOLE_BACKGROUND, - Color.parseColor(imap.get("WHOLE_BACKGROUND").toString())); - } else { - editor - .getColorScheme() - .setColor(EditorColorScheme.WHOLE_BACKGROUND, Color.parseColor("#FF281B26")); - } - - // css colors - editor.getColorScheme().setColor(EditorColorScheme.red, ColorCompat.RED); - editor.getColorScheme().setColor(EditorColorScheme.aliceblue, ColorCompat.ALICEBLUE); - //new colors - editor.getColorScheme().setColor(EditorColorScheme.antiquewhite, ColorCompat.ANTIQUEWHITE); - editor.getColorScheme().setColor(EditorColorScheme.aqua, ColorCompat.AQUA); - editor.getColorScheme().setColor(EditorColorScheme.aquamarine, ColorCompat.AQUAMARINE); - editor.getColorScheme().setColor(EditorColorScheme.azure, ColorCompat.AZURE); - editor.getColorScheme().setColor(EditorColorScheme.beige, ColorCompat.BEIGE); - editor.getColorScheme().setColor(EditorColorScheme.bisque, ColorCompat.BISQUE); - editor.getColorScheme().setColor(EditorColorScheme.black, ColorCompat.BLACK); - editor.getColorScheme().setColor(EditorColorScheme.blanchedalmond, ColorCompat.BLANCHEDALMOND); - editor.getColorScheme().setColor(EditorColorScheme.blue, ColorCompat.BLUE); - editor.getColorScheme().setColor(EditorColorScheme.blueviolet, ColorCompat.BLUEVIOLET); - editor.getColorScheme().setColor(EditorColorScheme.brown, ColorCompat.BROWN); - - //install color log - editor.getColorScheme().setColor(EditorColorScheme.COLOR_DEBUG, Color.BLUE); - editor.getColorScheme().setColor(EditorColorScheme.COLOR_ERROR, Color.RED); - editor.getColorScheme().setColor(EditorColorScheme.COLOR_WARNING, Color.YELLOW); - editor.getColorScheme().setColor(EditorColorScheme.COLOR_LOG, Color.GREEN); - editor.getColorScheme().setColor(EditorColorScheme.COLOR_TIP, Color.CYAN); - return this; + if (map.containsKey("BackGround")) { + map.put("BackGround", Color.parseColor("#FFFF84FA")); + } else { + map.put("BackGround", Color.DKGRAY); } - - public SetThemeForJson setHashMapInabel(boolean isEnabel, HashMap imap) { - if (isEnabel) { - isEnabel = true; - imap = new HashMap<>(); - } else { - isEnabel = false; - } - - return this; + return this; + } + + public SetThemeForJson setThemeCodeEditor( + CodeEditor editor, HashMap imap, boolean chackHashMap, Activity x) { + + getColor(imap, editor, "BLOCK_LINE", EditorColorScheme.BLOCK_LINE); + getColor(imap, editor, "OPERATOR", EditorColorScheme.OPERATOR); + getColor(imap, editor, "BLOCK_LINE_CURRENT", EditorColorScheme.BLOCK_LINE_CURRENT); + getColor(imap, editor, "NON_PRINTABLE_CHAR", EditorColorScheme.NON_PRINTABLE_CHAR); + getColor(imap, editor, "CURRENT_LINE", EditorColorScheme.CURRENT_LINE); + getColor(imap, editor, "SELECTION_HANDLE", EditorColorScheme.SELECTION_HANDLE); + getColor(imap, editor, "LINE_NUMBER", EditorColorScheme.LINE_NUMBER); + getColor(imap, editor, "LINE_DIVIDER", EditorColorScheme.LINE_DIVIDER); + getColor(imap, editor, "ATTRIBUTE_VALUE", EditorColorScheme.ATTRIBUTE_VALUE); + getColor(imap, editor, "ATTRIBUTE_NAME", EditorColorScheme.ATTRIBUTE_NAME); + getColor(imap, editor, "TEXT_NORMAL", EditorColorScheme.TEXT_NORMAL); + getColor(imap, editor, "IDENTIFIER_NAME", EditorColorScheme.IDENTIFIER_NAME); + getColor(imap, editor, "COMMENT", EditorColorScheme.COMMENT); + getColor(imap, editor, "KEYWORD", EditorColorScheme.KEYWORD); + getColor(imap, editor, "print", EditorColorScheme.print); + getColor(imap, editor, "Ninja", EditorColorScheme.Ninja); + getColor(imap, editor, "AUTO_COMP_PANEL_BG", EditorColorScheme.AUTO_COMP_PANEL_BG); + getColor(imap, editor, "AUTO_COMP_PANEL_CORNER", EditorColorScheme.AUTO_COMP_PANEL_CORNER); + getColor(imap, editor, "LINE_NUMBER_BACKGROUND", EditorColorScheme.LINE_NUMBER_BACKGROUND); + getColor(imap, editor, "WHOLE_BACKGROUND", EditorColorScheme.WHOLE_BACKGROUND); + getColor(imap, editor, "HTML_TAG", EditorColorScheme.HTML_TAG); + // css colors + editor.getColorScheme().setColor(EditorColorScheme.red, ColorCompat.RED); + editor.getColorScheme().setColor(EditorColorScheme.aliceblue, ColorCompat.ALICEBLUE); + // new colors + editor.getColorScheme().setColor(EditorColorScheme.antiquewhite, ColorCompat.ANTIQUEWHITE); + editor.getColorScheme().setColor(EditorColorScheme.aqua, ColorCompat.AQUA); + editor.getColorScheme().setColor(EditorColorScheme.aquamarine, ColorCompat.AQUAMARINE); + editor.getColorScheme().setColor(EditorColorScheme.azure, ColorCompat.AZURE); + editor.getColorScheme().setColor(EditorColorScheme.beige, ColorCompat.BEIGE); + editor.getColorScheme().setColor(EditorColorScheme.bisque, ColorCompat.BISQUE); + editor.getColorScheme().setColor(EditorColorScheme.black, ColorCompat.BLACK); + editor.getColorScheme().setColor(EditorColorScheme.blanchedalmond, ColorCompat.BLANCHEDALMOND); + editor.getColorScheme().setColor(EditorColorScheme.blue, ColorCompat.BLUE); + editor.getColorScheme().setColor(EditorColorScheme.blueviolet, ColorCompat.BLUEVIOLET); + editor.getColorScheme().setColor(EditorColorScheme.brown, ColorCompat.BROWN); + + // install color log + editor.getColorScheme().setColor(EditorColorScheme.COLOR_DEBUG, Color.BLUE); + editor.getColorScheme().setColor(EditorColorScheme.COLOR_ERROR, Color.RED); + editor.getColorScheme().setColor(EditorColorScheme.COLOR_WARNING, Color.YELLOW); + editor.getColorScheme().setColor(EditorColorScheme.COLOR_LOG, Color.GREEN); + editor.getColorScheme().setColor(EditorColorScheme.COLOR_TIP, Color.CYAN); + return this; + } + + protected void getColor( + HashMap imap, CodeEditor editor, String key, int colorValue) { + editor + .getColorScheme() + .setColor( + imap.containsKey(key) ? colorValue : Color.parseColor("#ffaea2ff"), + imap.containsKey(key) + ? Color.parseColor(imap.get(key).toString()) + : Color.parseColor("#ffaea2ff")); + } + + public SetThemeForJson setHashMapInabel(boolean isEnabel, HashMap imap) { + if (isEnabel) { + isEnabel = true; + imap = new HashMap<>(); + } else { + isEnabel = false; + imap = null; } - @Deprecated - private SetThemeForJson dialogError(Activity x) { + return this; + } - var di = new MaterialAlertDialogBuilder(x); - di.setTitle("شکست تم "); - di.setMessage( - "تم دچار نقص شده است ممکن است تم را دستی ویرایش کرده باشید یا یک ویژگی جدید به تم اضافه شده باشد لطفاً گزینه تعمیر را بزنید تا تم برای شما باز تولید شود"); - di.setNeutralButton( - "تعمیر", - (p, d) -> { - SketchwareUtil.showMessage(x, "شروع باز نویسی تم"); - FileUtil.deleteFile("/storage/emulated/0/GhostWebIDE/theme/GhostThemeapp.ghost"); - task = - new TimerTask() { - @Override - public void run() { - x.runOnUiThread( - () -> { - x.finishAffinity(); - }); - } - }; - timer.schedule(task, (int) (2000)); - }); - di.setCancelable(false); - di.show(); + @Deprecated + private SetThemeForJson dialogError(Activity x) { - return this; - } + return this; + } - public SetThemeForJson AddthemetoSattos(Activity a, HashMap imap) { + public SetThemeForJson AddthemetoSattos(Activity a, HashMap imap) { - if (imap.containsKey("BackgroundColorLinear")) { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - Window Hsi = a.getWindow(); - Hsi.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - Hsi.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - Hsi.setStatusBarColor(Color.parseColor(imap.get("BackgroundColorLinear").toString())); - // Hsi.setNavigationBarColor(Color.parseColor(imap.get("BackgroundColorLinear").toString())); - } - } else { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - Window Hsi = a.getWindow(); - Hsi.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); - Hsi.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - Hsi.setStatusBarColor(Color.parseColor("#FF281B26")); - // Hsi.setNavigationBarColor(Color.parseColor("#FF281B26")); - - } - } - - return this; + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { + Window Hsi = a.getWindow(); + Hsi.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + Hsi.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + Hsi.setStatusBarColor( + imap.containsKey("BackgroundColorLinear") + ? Color.parseColor(imap.get("BackgroundColorLinear").toString()) + : Color.parseColor("#FF281B26")); } - public SetThemeForJson addTextColor( - TextView id, String datatype, int color, Activity x, HashMap imap2) { - - if (imap2.containsKey(datatype)) { - id.setTextColor(Color.parseColor(imap2.get(datatype).toString())); - } else { - id.setTextColor(0xFFFFE5FC); - } - return this; + return this; + } + + public SetThemeForJson addTextColor( + TextView id, String datatype, int color, Activity x, HashMap imap2) { + id.setTextColor( + imap2.containsKey(datatype) + ? Color.parseColor(imap2.get(datatype).toString()) + : 0xFFFFE5FC); + return this; + } + + public SetThemeForJson addBackground( + Activity c, HashMap imap, String datatype, View object, int color) { + object.setBackgroundColor( + imap.containsKey(datatype) ? Color.parseColor(imap.get(datatype).toString()) : 0xFF281B26); + + return this; + } + + public SetThemeForJson addImageColor( + ImageView id, Activity c, String datatype, HashMap map, int color) { + id.setColorFilter( + map.containsKey(datatype) ? Color.parseColor(map.get(datatype).toString()) : 0xFFDE7CD1, + PorterDuff.Mode.MULTIPLY); + + return this; + } + + public SetThemeForJson mfabcolor( + Activity c, ExtendedFloatingActionButton fab, HashMap map) { + + fab.setStrokeColor( + ColorStateList.valueOf( + map.containsKey("FabColorStroker") + ? Color.parseColor(map.get("FabColorStroker").toString()) + : Color.parseColor("#ffaebdff"))); + fab.setStrokeWidth(1); + fab.setIconTint( + ColorStateList.valueOf( + map.containsKey("FabImageColor") + ? Color.parseColor(map.get("FabImageColor").toString()) + : Color.parseColor("#ffc9f2ff"))); + return this; + } + + public SetThemeForJson mfab2( + Activity c, ExtendedFloatingActionButton fab, HashMap imap) { + + if (imap.containsKey("FabBackgroundColorColor")) { + fab.setBackgroundTintList( + ColorStateList.valueOf(Color.parseColor(imap.get("FabBackgroundColorColor").toString()))); + + } else { + fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FF2B2121"))); } + return this; + } - public SetThemeForJson addBackground( - Activity c, HashMap imap, String datatype, View object, int color) { + public SetThemeForJson buildandpost() { - if (imap.containsKey(datatype)) { - object.setBackgroundColor(Color.parseColor(imap.get(datatype).toString())); - } else { - object.setBackgroundColor(0xFF281B26); - } - return this; - } - - public SetThemeForJson addImageColor( - ImageView id, Activity c, String datatype, HashMap map, int color) { - if (map.containsKey(datatype)) { - id.setColorFilter(Color.parseColor(map.get(datatype).toString()), PorterDuff.Mode.MULTIPLY); - } else { - id.setColorFilter(0xFFDE7CD1, PorterDuff.Mode.MULTIPLY); - } - - return this; - } - - public SetThemeForJson mfabcolor( - Activity c, ExtendedFloatingActionButton fab, HashMap map) { - if (map.containsKey("FabColorStroker") && map.containsKey("FabImageColor")) { - fab.setStrokeColor( - ColorStateList.valueOf(Color.parseColor(map.get("FabColorStroker").toString()))); - fab.setStrokeWidth(1); - fab.setIconTint( - ColorStateList.valueOf(Color.parseColor(map.get("FabImageColor").toString()))); - } else { - fab.setStrokeColor(ColorStateList.valueOf(Color.parseColor("#ffaebdff"))); - fab.setStrokeWidth(1); - fab.setIconTint(ColorStateList.valueOf(Color.parseColor("#ffc9f2ff"))); - } - return this; - } - - public SetThemeForJson mfab2( - Activity c, ExtendedFloatingActionButton fab, HashMap imap) { - - if (imap.containsKey("FabBackgroundColorColor")) { - fab.setBackgroundTintList( - ColorStateList.valueOf(Color.parseColor(imap.get("FabBackgroundColorColor").toString()))); - - } else { - fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FF2B2121"))); - } - return this; - } - - public SetThemeForJson buildandpost() { - - return this; - } + return this; + } } diff --git a/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLAnalyzer.java b/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLAnalyzer.java index 74ca8dc2..70a50a5b 100644 --- a/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLAnalyzer.java +++ b/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLAnalyzer.java @@ -26,1119 +26,1136 @@ */ public class HTMLAnalyzer implements CodeAnalyzer, CallBackErrorManager { - private static final Object OBJECT = new Object(); - public boolean isError = false; - protected CodeEditor editor; - private Pattern URL_PATTERN = - Pattern.compile( - "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)"); - private BasicSyntaxPullAnalyzer sin = new BasicSyntaxPullAnalyzer(); + private static final Object OBJECT = new Object(); + public boolean isError = false; + protected CodeEditor editor; + private Pattern URL_PATTERN = + Pattern.compile( + "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)"); + private BasicSyntaxPullAnalyzer sin = new BasicSyntaxPullAnalyzer(); - public HTMLAnalyzer(CodeEditor editor) { - this.editor = editor; - } + public HTMLAnalyzer(CodeEditor editor) { + this.editor = editor; + } - @Override - public void analyze( - CharSequence content, - TextAnalyzeResult result, - TextAnalyzer.AnalyzeThread.Delegate delegate) { - StringBuilder text = - content instanceof StringBuilder ? (StringBuilder) content : new StringBuilder(content); - HTMLTextTokenizer tokenizer = new HTMLTextTokenizer(text); - tokenizer.setCalculateLineColumn(false); - Token token, previous = Token.UNKNOWN; - int line = 0, column = 0; - LineNumberCalculator helper = new LineNumberCalculator(text); - IdentifierAutoComplete.Identifiers identifiers = new IdentifierAutoComplete.Identifiers(); - identifiers.begin(); - Stack stack = new Stack<>(); - List labels = new ArrayList<>(); - int maxSwitch = 1, currSwitch = 0; - // Tree to save class names and query - TrieTree classNames = new TrieTree<>(); - // Whether previous token is class name - boolean classNamePrevious = false; - // Add default class name - classNames.put("String", OBJECT); - classNames.put("Object", OBJECT); + @Override + public void analyze( + CharSequence content, + TextAnalyzeResult result, + TextAnalyzer.AnalyzeThread.Delegate delegate) { + StringBuilder text = + content instanceof StringBuilder ? (StringBuilder) content : new StringBuilder(content); + HTMLTextTokenizer tokenizer = new HTMLTextTokenizer(text); + tokenizer.setCalculateLineColumn(false); + Token token, previous = Token.UNKNOWN; + int line = 0, column = 0; + LineNumberCalculator helper = new LineNumberCalculator(text); + IdentifierAutoComplete.Identifiers identifiers = new IdentifierAutoComplete.Identifiers(); + identifiers.begin(); + Stack stack = new Stack<>(); + List labels = new ArrayList<>(); + int maxSwitch = 1, currSwitch = 0; + // Tree to save class names and query + TrieTree classNames = new TrieTree<>(); + // Whether previous token is class name + boolean classNamePrevious = false; + // Add default class name + classNames.put("String", OBJECT); + classNames.put("Object", OBJECT); - boolean first = true; - while (delegate.shouldAnalyze()) { - try { - // directNextToken() does not skip any token - token = tokenizer.directNextToken(); - } catch (RuntimeException e) { - // When a spelling input is in process, this will happen because of format mismatch - token = Token.CHARACTER_LITERAL; - } - if (token == Token.EOF) { - break; - } - // Backup values because looking ahead in function name match will change them - int thisIndex = tokenizer.getIndex(); - int thisLength = tokenizer.getTokenLength(); - int index = tokenizer.getOffset(); - switch (token) { - case WHITESPACE: - case NEWLINE: - if (first) { - isError = false; - result.addNormalIfNull(); - } - break; - case IDENTIFIER: - isError = true; + boolean first = true; + while (delegate.shouldAnalyze()) { + try { + // directNextToken() does not skip any token + token = tokenizer.directNextToken(); + } catch (RuntimeException e) { + // When a spelling input is in process, this will happen because of format mismatch + token = Token.CHARACTER_LITERAL; + } + if (token == Token.EOF) { + break; + } + // Backup values because looking ahead in function name match will change them + int thisIndex = tokenizer.getIndex(); + int thisLength = tokenizer.getTokenLength(); + int index = tokenizer.getOffset(); + switch (token) { + case WHITESPACE: + case NEWLINE: + if (first) { + isError = false; + result.addNormalIfNull(); + } + break; + case IDENTIFIER: + isError = true; - // /= - // identifiers.addIdentifier(text.substring(helper.getLine(),tokenizer.getTokenLength())); + // /= + // identifiers.addIdentifier(text.substring(helper.getLine(),tokenizer.getTokenLength())); - // Add a identifier to auto complete - identifiers.addIdentifier(text.substring(index, index + tokenizer.getTokenLength())); - // The previous so this will be the annotation's type name + // Add a identifier to auto complete + identifiers.addIdentifier(text.substring(index, index + tokenizer.getTokenLength())); + // The previous so this will be the annotation's type name - /// coloring from # - if (previous == Token.SHARP) { - result.addIfNeeded(line, column, EditorColorScheme.Ninja); - break; - } + /// coloring from # + if (previous == Token.SHARP) { + result.addIfNeeded(line, column, EditorColorScheme.Ninja); + break; + } - /// coloring from - - if (previous == Token.MINUS) { - result.addIfNeeded(line, column, EditorColorScheme.KEYWORD); - break; - } + /// coloring from - + if (previous == Token.MINUS) { + result.addIfNeeded(line, column, EditorColorScheme.KEYWORD); + break; + } - Token next = tokenizer.directNextToken(); - // The next is LPAREN,so this is function name or type name + Token next = tokenizer.directNextToken(); + // The next is LPAREN,so this is function name or type name - if (next == Token.LPAREN) { - result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); - tokenizer.pushBack(tokenizer.getTokenLength()); - break; - } + if (next == Token.LPAREN) { + result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); + tokenizer.pushBack(tokenizer.getTokenLength()); + break; + } - if (previous == Token.IMPORT) { - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - isError = false; - break; - } - if (previous == Token.FORM) { - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - isError = false; - break; - } - if (previous == Token.AT) { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle( - EditorColorScheme.AUTO_COMP_PANEL_CORNER, 0, true, false, true)); - isError = false; - classNamePrevious = false; - break; - } + if (previous == Token.IMPORT) { + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + isError = false; + break; + } + if (previous == Token.FORM) { + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + isError = false; + break; + } + if (previous == Token.AT) { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle( + EditorColorScheme.AUTO_COMP_PANEL_CORNER, 0, true, false, true)); + isError = false; + classNamePrevious = false; + break; + } - // Push back the next token - tokenizer.pushBack(tokenizer.getTokenLength()); - // This is a class definition - if (previous == Token.FUNCTION) { - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - // Add class name - classNames.put(text, thisIndex, thisLength, OBJECT); - break; - } - if (previous == Token.CLASS) { - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - // Add class name - classNames.put(text, thisIndex, thisLength, OBJECT); - break; - } - // Has class name - if (classNames.get(text, thisIndex, thisLength) == OBJECT) { - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - // Mark it - classNamePrevious = true; - isError = false; - break; - } - if (classNamePrevious) { - // Var name - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_NAME); - classNamePrevious = false; - break; - } - if (previous == Token.LET && previous == Token.VAR) { - result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); - // Mark it - classNamePrevious = true; - isError = false; - break; - } + // Push back the next token + tokenizer.pushBack(tokenizer.getTokenLength()); + // This is a class definition + if (previous == Token.FUNCTION) { + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + // Add class name + classNames.put(text, thisIndex, thisLength, OBJECT); + break; + } + if (previous == Token.CLASS) { + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + // Add class name + classNames.put(text, thisIndex, thisLength, OBJECT); + break; + } + // Has class name + if (classNames.get(text, thisIndex, thisLength) == OBJECT) { + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + // Mark it + classNamePrevious = true; + isError = false; + break; + } + if (classNamePrevious) { + // Var name + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_NAME); + classNamePrevious = false; + break; + } + if (previous == Token.LET && previous == Token.VAR) { + result.addIfNeeded(line, column, EditorColorScheme.ATTRIBUTE_VALUE); + // Mark it + classNamePrevious = true; + isError = false; + break; + } - if (next == Token.AT) { - result.addIfNeeded(line, column, EditorColorScheme.print); - break; - } + if (next == Token.AT) { + result.addIfNeeded(line, column, EditorColorScheme.print); + break; + } - result.addIfNeeded(line, column, EditorColorScheme.IDENTIFIER_NAME); - break; + result.addIfNeeded(line, column, EditorColorScheme.IDENTIFIER_NAME); + break; - case STRING: - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.HTML_TAG, 0, true, true, false)); - break; - case FLOATING_POINT_LITERAL: - case INTEGER_LITERAL: - classNamePrevious = false; - result.addIfNeeded(line, column, EditorColorScheme.COLOR_DEBUG); - break; - case A: - case ABBR: - case ACRONYM: - case ADDRESS: - case APPLET: - case ARTICLE: - case ASIDE: - case AUDIO: - case B: - case BASEFONT: - case BDI: - case BDO: - case BGSOUND: - case BIG: - case BLINK: - case BLOCKQUOTE: - case BODY: - case BUTTON: - case CANVAS: - case CAPTION: - case CENTER: - case CIRCLE: - case CITE: - case CLIPPATH: - case CODE: - case COLGROUP: - case COMMAND: - case CONTENT: - case DATALIST: - case DD: - case DEFS: - case DEL: - case DETAILS: - case DFN: - case DIALOG: - case DIR: - case DIV: - case DL: - case DT: - case ELEMENT: - case ELLIPSE: - case EM: - case FIELDSET: - case FIGCAPTION: - case FIGURE: - case FONT: - case FOOTER: - case FOREIGNOBJECT: - case FORM: - case FRAME: - case FRAMESET: - case G: - case H1: - case H2: - case H3: - case H4: - case H5: - case H6: - case HEAD: - case HEADER: - case HGROUP: - case HTML: - case I: - case IFRAME: - case IMAGE: - case INS: - case ISINDEX: - case KBD: - case LABEL: - case LEGEND: - case LI: - case LINE: - case LINEARGRADIENT: - case LISTING: - case MAIN: - case MAP: - case MARK: - case MARQUEE: - case MASK: - case MATH: - case MENU: - case MENUITEM: - case METER: - case MULTICOL: - case NAV: - case NEXTID: - case NOBR: - case NOEMBED: - case NOFRAMES: - case NOSCRIPT: - case OBJECT: - case OL: - case OPTGROUP: - case OPTION: - case OUTPUT: - case P: - case PATH: - case PATTERN: - case PICTURE: - case PLAINTEXT: - case POLYGON: - case POLYLINE: - case PRE: - case PROGRESS: - case Q: - case RADIALGRADIENT: - case RB: - case RBC: - case RECT: - case RP: - case RT: - case RTC: - case RUBY: - case S: - case SAMP: - case SCRIPT: - case SECTION: - case SELECT: - case SHADOW: - case SLOT: - case SMALL: - case SPACER: - case SPAN: - case STOP: - case STRIKE: - case STRONG: - case STYLE: - case NOSTYLE: - case SUB: - case SUMMARY: - case SUP: - case SVG: - case TABLE: - case TBODY: - case TD: - case TEMPLATE: - case TEXTAREA: - case TFOOT: - case TH: - case THEAD: - case TIME: - case TITLE: - case TR: - case TSPAN: - case TT: - case U: - case UL: - case VAR: - case VIDEO: - case XMP: - case META: - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.KEYWORD); - break; - case COLON: - isError = false; - classNamePrevious = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.AUTO_COMP_PANEL_CORNER, 0, true, false, false)); + case STRING: + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.HTML_TAG, 0, true, true, false)); + break; + case FLOATING_POINT_LITERAL: + case INTEGER_LITERAL: + classNamePrevious = false; + result.addIfNeeded(line, column, EditorColorScheme.COLOR_DEBUG); + break; + case A: + case ABBR: + case ACRONYM: + case ADDRESS: + case APPLET: + case ARTICLE: + case ASIDE: + case AUDIO: + case B: + case BASEFONT: + case BDI: + case BDO: + case BGSOUND: + case BIG: + case BLINK: + case BLOCKQUOTE: + case BODY: + case BUTTON: + case CANVAS: + case CAPTION: + case CENTER: + case CIRCLE: + case CITE: + case CLIPPATH: + case CODE: + case COLGROUP: + case COMMAND: + case CONTENT: + case DATALIST: + case DD: + case DEFS: + case DEL: + case DETAILS: + case DFN: + case DIALOG: + case DIR: + case DIV: + case DL: + case DT: + case ELEMENT: + case ELLIPSE: + case EM: + case FIELDSET: + case FIGCAPTION: + case FIGURE: + case FONT: + case FOOTER: + case FOREIGNOBJECT: + case FORM: + case FRAME: + case FRAMESET: + case G: + case H1: + case H2: + case H3: + case H4: + case H5: + case H6: + case HEAD: + case HEADER: + case HGROUP: + case HTML: + case I: + case IFRAME: + case IMAGE: + case INS: + case ISINDEX: + case KBD: + case LABEL: + case LEGEND: + case LI: + case LINE: + case LINEARGRADIENT: + case LISTING: + case MAIN: + case MAP: + case MARK: + case MARQUEE: + case MASK: + case MATH: + case MENU: + case MENUITEM: + case METER: + case MULTICOL: + case NAV: + case NEXTID: + case NOBR: + case NOEMBED: + case NOFRAMES: + case NOSCRIPT: + case OBJECT: + case OL: + case OPTGROUP: + case OPTION: + case OUTPUT: + case P: + case PATH: + case PATTERN: + case PICTURE: + case PLAINTEXT: + case POLYGON: + case POLYLINE: + case PRE: + case PROGRESS: + case Q: + case RADIALGRADIENT: + case RB: + case RBC: + case RECT: + case RP: + case RT: + case RTC: + case RUBY: + case S: + case SAMP: + case SCRIPT: + case SECTION: + case SELECT: + case SHADOW: + case SLOT: + case SMALL: + case SPACER: + case SPAN: + case STOP: + case STRIKE: + case STRONG: + case STYLE: + case NOSTYLE: + case SUB: + case SUMMARY: + case SUP: + case SVG: + case TABLE: + case TBODY: + case TD: + case TEMPLATE: + case TEXTAREA: + case TFOOT: + case TH: + case THEAD: + case TIME: + case TITLE: + case TR: + case TSPAN: + case TT: + case U: + case UL: + case VAR: + case VIDEO: + case XMP: + case META: + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.KEYWORD); + break; + case COLON: + isError = false; + classNamePrevious = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.AUTO_COMP_PANEL_CORNER, 0, true, false, false)); - break; - // { - case LBRACE: { - isError = false; - classNamePrevious = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.BLOCK_LINE, 0, true, false, false)); - if (stack.isEmpty()) { - if (currSwitch > maxSwitch) { - maxSwitch = currSwitch; - } - currSwitch = 0; - } - currSwitch++; - BlockLine block = result.obtainNewBlock(); - block.startLine = line; - block.startColumn = column; - stack.push(block); - break; - } - // } - case RBRACE: { - isError = false; - - classNamePrevious = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.BLOCK_LINE, 0, true, false, false)); - if (!stack.isEmpty()) { - BlockLine block = stack.pop(); - block.endLine = line; - block.endColumn = column; - if (block.startLine != block.endLine) { - result.addBlockLine(block); - } - break; - } else { - break; - } - } - case CHARACTER_LITERAL: - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); - break; - case LINE_COMMENT: - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.COMMENT); - break; - case LONG_COMMENT: - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.COMMENT); - break; - // divs = / - case DIVS: - result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); - break; - // tagslash < - case TAGSLASH: - case GT: { - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); - if (stack.isEmpty()) { - if (currSwitch > maxSwitch) { - maxSwitch = currSwitch; - } - currSwitch = 0; - } - currSwitch++; + break; + // { + case LBRACE: + { + isError = false; + classNamePrevious = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.BLOCK_LINE, 0, true, false, false)); + if (stack.isEmpty()) { + if (currSwitch > maxSwitch) { + maxSwitch = currSwitch; + } + currSwitch = 0; + } + currSwitch++; + BlockLine block = result.obtainNewBlock(); + block.startLine = line; + block.startColumn = column; + stack.push(block); + break; + } + // } + case RBRACE: + { + isError = false; - break; - } - // LT < + classNamePrevious = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.BLOCK_LINE, 0, true, false, false)); + if (!stack.isEmpty()) { + BlockLine block = stack.pop(); + block.endLine = line; + block.endColumn = column; + if (block.startLine != block.endLine) { + result.addBlockLine(block); + } + break; + } else { + break; + } + } + case CHARACTER_LITERAL: + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); + break; + case LINE_COMMENT: + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.COMMENT); + break; + case LONG_COMMENT: + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.COMMENT); + break; + // divs = / + case DIVS: + result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); + break; + // tagslash < + case TAGSLASH: + case GT: + { + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); + if (stack.isEmpty()) { + if (currSwitch > maxSwitch) { + maxSwitch = currSwitch; + } + currSwitch = 0; + } + currSwitch++; - case LT: { - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); - if (!stack.isEmpty()) { - BlockLine block = stack.pop(); - block.endLine = line - 1; - block.endColumn = column; - if (block.startLine != block.endLine) { - if (helper.getLine() == helper.getColumn()) block.toBottomOfEndLine = true; - result.addBlockLine(block); - } - } - break; - } + break; + } + // LT < - case ALIGN_CONTENT: - case ALIGN_ITEMS: - case ALIGN_SELF: - case ALL: - case ANIMATION: - case ANIMATION_DELAY: - case ANIMATION_DIRECTION: - case ANIMATION_DURATION: - case ANIMATION_FILL_MODE: - case ANIMATION_ITERATION_COUNT: - case ANIMATION_NAME: - case ANIMATION_PLAY_STATE: - case ANIMATION_TIMING_FUNCTION: - case BACKFACE_VISIBILITY: - case BACKGROUND: - case BACKGROUND_ATTACHMENT: - case BACKGROUND_BLUR: - case BACKGROUND_CLIP: - case BACKGROUND_COLOR: - case BACKGROUND_IMAGE: - case BACKGROUND_ORIGIN: - case BACKGROUND_POSITION: - case BACKGROUND_REPEAT: - case BACKGROUND_SIZE: - case BORDER: - case CLASS: - case BORDER_BOTTOM: - case BORDER_BOTTOM_COLOR: - case BORDER_BOTTOM_LEFT_RADIUS: - case BORDER_BOTTOM_RIGHT_RADIUS: - case BORDER_BOTTOM_STYLE: - case BORDER_BOTTOM_WIDTH: - case BORDER_COLLAPSE: - case BORDER_COLOR: - case BORDER_IMAGE: - case BORDER_IMAGE_OUTSET: - case BORDER_IMAGE_REPEAT: - case BORDER_IMAGE_SLICE: - case BORDER_IMAGE_SOURCE: - case BORDER_IMAGE_WIDTH: - case BORDER_LEFT: - case BORDER_LEFT_COLOR: - case BORDER_LEFT_STYLE: - case BORDER_LEFT_WIDTH: - case BORDER_RADIUS: - case BORDER_RIGHT: - case BORDER_RIGHT_COLOR: - case BORDER_RIGHT_STYLE: - case BORDER_RIGHT_WIDTH: - case BORDER_SPACING: - case BORDER_STYLE: - case BORDER_TOP: - case BORDER_TOP_COLOR: - case BORDER_TOP_LEFT_RADIUS: - case BORDER_TOP_RIGHT_RADIUS: - case BORDER_TOP_STYLE: - case BORDER_TOP_WIDTH: - case BORDER_WIDTH: - case BOTTOM: - case BOX_DECORATION_BREAK: - case BOX_SHADOW: - case BOX_SIZING: - case BREAK_AFTER: - case BREAK_BEFORE: - case BREAK_INSIDE: - case CAPTION_SIDE: - case CARET_COLOR: - case CLEAR: - case CLIP: - case COLOR: - case COLUMN_COUNT: - case COLUMN_FILL: - case COLUMN_GAP: - case COLUMN_RULE: - case COLUMN_RULE_COLOR: - case COLUMN_RULE_STYLE: - case COLUMN_RULE_WIDTH: - case COLUMN_SPAN: - case COLUMN_WIDTH: - case COLUMNS: - case COUNTER_INCREMENT: - case COUNTER_RESET: - case CURSOR: - case DIRECTION: - case DISPLAY: - case EMPTY_CELLS: - case FILTER: - case FLEX: - case FLEX_BASIS: - case FLEX_DIRECTION: - case FLEX_FLOW: - case FLEX_GROW: - case FLEX_SHRINK: - case FLEX_WRAP: - case FLOAT: - isError = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.ATTRIBUTE_VALUE, 0, true, false, false)); - break; - case FONT_FAMILY: - case FONT_SIZE: - case FONT_SIZE_ADJUST: - case FONT_STRETCH: - case FONT_STYLE: - case FONT_VARIANT: - case FONT_VARIANT_CAPS: - case FONT_WEIGHT: - case GAP: - case GRID: - case GRID_AREA: - case GRID_AUTO_COLUMNS: - case GRID_AUTO_FLOW: - case GRID_AUTO_ROWS: - case GRID_COLUMN: - case GRID_COLUMN_END: - case GRID_COLUMN_GAP: - case GRID_COLUMN_START: - case GRID_GAP: - case GRID_ROW: - case GRID_ROW_END: - case GRID_ROW_GAP: - case GRID_ROW_START: - case GRID_TEMPLATE: - case GRID_TEMPLATE_AREAS: - case GRID_TEMPLATE_COLUMNS: - case GRID_TEMPLATE_ROWS: - case HEIGHT: - case IME_MODE: - case JUSTIFY_CONTENT: - case LEFT: - case LETTER_SPACING: - case LINE_BREAK: - case LINE_HEIGHT: - case LIST_STYLE: - case LIST_STYLE_IMAGE: - case LIST_STYLE_POSITION: - case LIST_STYLE_TYPE: - case MARGIN: - case MARGIN_BOTTOM: - case MARGIN_LEFT: - case MARGIN_RIGHT: - case MARGIN_TOP: - case MARKER_OFFSET: - case MAX_HEIGHT: - case MAX_WIDTH: - case MIN_HEIGHT: - case MIN_WIDTH: - case MIX_BLEND_MODE: - case OBJECT_FIT: - case OBJECT_POSITION: - case OPACITY: - case ORDER: - case ORPHANS: - case OUTLINE: - case OUTLINE_COLOR: - case OUTLINE_OFFSET: - case OUTLINE_STYLE: - case OUTLINE_WIDTH: - case OVERFLOW: - case OVERFLOW_WRAP: - case OVERFLOW_X: - case OVERFLOW_Y: - case PADDING: - case PADDING_BOTTOM: - case PADDING_LEFT: - case PADDING_RIGHT: - case PADDING_TOP: - case PAGE_BREAK_AFTER: - case PAGE_BREAK_BEFORE: - case PAGE_BREAK_INSIDE: - case PERSPECTIVE: - case PERSPECTIVE_ORIGIN: - case POINTER_EVENTS: - case POSITION: - case QUOTES: - case RESIZE: - case RIGHT: - case ROW_GAP: - case SCROLL_BEHAVIOR: - case SPEAK: - case TABLE_LAYOUT: + case LT: + { + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG); + if (!stack.isEmpty()) { + BlockLine block = stack.pop(); + block.endLine = line - 1; + block.endColumn = column; + if (block.startLine != block.endLine) { + if (helper.getLine() == helper.getColumn()) block.toBottomOfEndLine = true; + result.addBlockLine(block); + } + } + break; + } - case TOP: - case TRANSFORM: - case TRANSITION: - case UNICODE_BIDI: - case VERTICAL_ALIGN: - case VISIBILITY: - case WHITE_SPACE: - case WIDOWS: - case WIDTH: - case WORD_BREAK: - case WORD_SPACING: - case WORD_WRAP: - case WRITING_MODE: - case REPEAT: - case Z_INDEX: - isError = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.ATTRIBUTE_NAME, 0, true, false, false)); - break; - case ABSTRACT: - case ELSE: - case INSTANCEOF: - case SUPER: - case BOOLEAN: - case ENUM: - case INT: - case SWITCH: - case BREAK: - case EXPORT: - case INTERFACE: - case SYNCHRONIZED: - case BYTE: - case EXTENDS: - case LET: - case THIS: - case CASE: - case FALSE: - case LONG: - case THROW: - case CATCH: - case FINAL: - case NATIVE: - case THROWS: - case CHAR: - case FINALLY: - case NEW: - case TRANSIENT: - case NULL: - case TRUE: - case CONST: - case FOR: - case PACKAGE: - case TRY: - case CONTINUE: - case FUNCTION: - case PRIVATE: - case TYPEOF: - case DEBUGGER: - case GOTO: - case PROTECTED: - case IF: - case PUBLIC: - case VOID: - case DELETE: - case IMPLEMENTS: - case RETURN: - case VOLATILE: - case DO: - case IMPORT: - case SHORT: - case WHILE: - case DOUBLE: - case IN: - case STATIC: - case WITH: - case OF: - case CONSOLE: - case LOG: - isError = false; - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.NON_PRINTABLE_CHAR, 0, true, false, false)); - break; + case ALIGN_CONTENT: + case ALIGN_ITEMS: + case ALIGN_SELF: + case ALL: + case ANIMATION: + case ANIMATION_DELAY: + case ANIMATION_DIRECTION: + case ANIMATION_DURATION: + case ANIMATION_FILL_MODE: + case ANIMATION_ITERATION_COUNT: + case ANIMATION_NAME: + case ANIMATION_PLAY_STATE: + case ANIMATION_TIMING_FUNCTION: + case BACKFACE_VISIBILITY: + case BACKGROUND: + case BACKGROUND_ATTACHMENT: + case BACKGROUND_BLUR: + case BACKGROUND_CLIP: + case BACKGROUND_COLOR: + case BACKGROUND_IMAGE: + case BACKGROUND_ORIGIN: + case BACKGROUND_POSITION: + case BACKGROUND_REPEAT: + case BACKGROUND_SIZE: + case BORDER: + case CLASS: + case BORDER_BOTTOM: + case BORDER_BOTTOM_COLOR: + case BORDER_BOTTOM_LEFT_RADIUS: + case BORDER_BOTTOM_RIGHT_RADIUS: + case BORDER_BOTTOM_STYLE: + case BORDER_BOTTOM_WIDTH: + case BORDER_COLLAPSE: + case BORDER_COLOR: + case BORDER_IMAGE: + case BORDER_IMAGE_OUTSET: + case BORDER_IMAGE_REPEAT: + case BORDER_IMAGE_SLICE: + case BORDER_IMAGE_SOURCE: + case BORDER_IMAGE_WIDTH: + case BORDER_LEFT: + case BORDER_LEFT_COLOR: + case BORDER_LEFT_STYLE: + case BORDER_LEFT_WIDTH: + case BORDER_RADIUS: + case BORDER_RIGHT: + case BORDER_RIGHT_COLOR: + case BORDER_RIGHT_STYLE: + case BORDER_RIGHT_WIDTH: + case BORDER_SPACING: + case BORDER_STYLE: + case BORDER_TOP: + case BORDER_TOP_COLOR: + case BORDER_TOP_LEFT_RADIUS: + case BORDER_TOP_RIGHT_RADIUS: + case BORDER_TOP_STYLE: + case BORDER_TOP_WIDTH: + case BORDER_WIDTH: + case BOTTOM: + case BOX_DECORATION_BREAK: + case BOX_SHADOW: + case BOX_SIZING: + case BREAK_AFTER: + case BREAK_BEFORE: + case BREAK_INSIDE: + case CAPTION_SIDE: + case CARET_COLOR: + case CLEAR: + case CLIP: + case COLOR: + case COLUMN_COUNT: + case COLUMN_FILL: + case COLUMN_GAP: + case COLUMN_RULE: + case COLUMN_RULE_COLOR: + case COLUMN_RULE_STYLE: + case COLUMN_RULE_WIDTH: + case COLUMN_SPAN: + case COLUMN_WIDTH: + case COLUMNS: + case COUNTER_INCREMENT: + case COUNTER_RESET: + case CURSOR: + case DIRECTION: + case DISPLAY: + case EMPTY_CELLS: + case FILTER: + case FLEX: + case FLEX_BASIS: + case FLEX_DIRECTION: + case FLEX_FLOW: + case FLEX_GROW: + case FLEX_SHRINK: + case FLEX_WRAP: + case FLOAT: + isError = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.ATTRIBUTE_VALUE, 0, true, false, false)); + break; + case FONT_FAMILY: + case FONT_SIZE: + case FONT_SIZE_ADJUST: + case FONT_STRETCH: + case FONT_STYLE: + case FONT_VARIANT: + case FONT_VARIANT_CAPS: + case FONT_WEIGHT: + case GAP: + case GRID: + case GRID_AREA: + case GRID_AUTO_COLUMNS: + case GRID_AUTO_FLOW: + case GRID_AUTO_ROWS: + case GRID_COLUMN: + case GRID_COLUMN_END: + case GRID_COLUMN_GAP: + case GRID_COLUMN_START: + case GRID_GAP: + case GRID_ROW: + case GRID_ROW_END: + case GRID_ROW_GAP: + case GRID_ROW_START: + case GRID_TEMPLATE: + case GRID_TEMPLATE_AREAS: + case GRID_TEMPLATE_COLUMNS: + case GRID_TEMPLATE_ROWS: + case HEIGHT: + case IME_MODE: + case JUSTIFY_CONTENT: + case LEFT: + case LETTER_SPACING: + case LINE_BREAK: + case LINE_HEIGHT: + case LIST_STYLE: + case LIST_STYLE_IMAGE: + case LIST_STYLE_POSITION: + case LIST_STYLE_TYPE: + case MARGIN: + case MARGIN_BOTTOM: + case MARGIN_LEFT: + case MARGIN_RIGHT: + case MARGIN_TOP: + case MARKER_OFFSET: + case MAX_HEIGHT: + case MAX_WIDTH: + case MIN_HEIGHT: + case MIN_WIDTH: + case MIX_BLEND_MODE: + case OBJECT_FIT: + case OBJECT_POSITION: + case OPACITY: + case ORDER: + case ORPHANS: + case OUTLINE: + case OUTLINE_COLOR: + case OUTLINE_OFFSET: + case OUTLINE_STYLE: + case OUTLINE_WIDTH: + case OVERFLOW: + case OVERFLOW_WRAP: + case OVERFLOW_X: + case OVERFLOW_Y: + case PADDING: + case PADDING_BOTTOM: + case PADDING_LEFT: + case PADDING_RIGHT: + case PADDING_TOP: + case PAGE_BREAK_AFTER: + case PAGE_BREAK_BEFORE: + case PAGE_BREAK_INSIDE: + case PERSPECTIVE: + case PERSPECTIVE_ORIGIN: + case POINTER_EVENTS: + case POSITION: + case QUOTES: + case RESIZE: + case RIGHT: + case ROW_GAP: + case SCROLL_BEHAVIOR: + case SPEAK: + case TABLE_LAYOUT: - case PROTOTYPE: - case ALERT: - case SUPPORT: - case YIELD: - case ASYNC: - case DOCUMENT: - case ARGUMENTS: - case PARSEINT: - case AWAIT: - case UNDEFINED: - case PARSEFLOAT: - case GET: - case STORAGE: - case TYPE: - case INFINITY: - case ESCAPE: - case __PROTO__: - case WINDOW: - case EVAL: - case GETELEMENTBYID: - isError = false; - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.LITERAL, 0, true, false, false)); - break; - case DOT: - case MULT: - case MINUS: - case PLUS: - case COMMA: - case NOT: - case QUESTION: - case AND: - case OR: - case XOR: - case MOD: - case SEMICOLON: - isError = false; - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.print, 0, true, true, false)); - break; - case ACCEPT: - case ACCESSKEY: - case ACTION: - case ALIGN: - case TEXT: - case ALT: - case AUTOCOMPLETE: - case AUTOFOCUS: - case AUTOPLAY: + case TOP: + case TRANSFORM: + case TRANSITION: + case UNICODE_BIDI: + case VERTICAL_ALIGN: + case VISIBILITY: + case WHITE_SPACE: + case WIDOWS: + case WIDTH: + case WORD_BREAK: + case WORD_SPACING: + case WORD_WRAP: + case WRITING_MODE: + case REPEAT: + case Z_INDEX: + isError = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.ATTRIBUTE_NAME, 0, true, false, false)); + break; + case ABSTRACT: + case ELSE: + case INSTANCEOF: + case SUPER: + case BOOLEAN: + case ENUM: + case INT: + case SWITCH: + case BREAK: + case EXPORT: + case INTERFACE: + case SYNCHRONIZED: + case BYTE: + case EXTENDS: + case LET: + case THIS: + case CASE: + case FALSE: + case LONG: + case THROW: + case CATCH: + case FINAL: + case NATIVE: + case THROWS: + case CHAR: + case FINALLY: + case NEW: + case TRANSIENT: + case NULL: + case TRUE: + case CONST: + case FOR: + case PACKAGE: + case TRY: + case CONTINUE: + case FUNCTION: + case PRIVATE: + case TYPEOF: + case DEBUGGER: + case GOTO: + case PROTECTED: + case IF: + case PUBLIC: + case VOID: + case DELETE: + case IMPLEMENTS: + case RETURN: + case VOLATILE: + case DO: + case IMPORT: + case SHORT: + case WHILE: + case DOUBLE: + case IN: + case STATIC: + case WITH: + case OF: + case CONSOLE: + case LOG: + isError = false; + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.NON_PRINTABLE_CHAR, 0, true, false, false)); + break; - case BGCOLOR: - case CHARSET: - case CHECKED: - case COLS: - case COLSPAN: - case CONTENTEDITABLE: - case CONTROLS: - case COORDS: - case DATA: - case DATETIME: - case DEFAULT: - case DEFER: - case DIRNAME: - case DISABLED: - case DRAGGABLE: - case DROPZONE: - case ENCTYPE: - case FACE: - case FORMACTION: - case HEADERS: - case HIGH: - case HREF: - case HREFLANG: - case HTTP: - case EQUIV: - case ID: - case ISMAP: - case KIND: - case LANG: - case LIST: - case LOOP: - case LOW: - case MAX: - case MAXLENGTH: - case MEDIA: - case METHOD: - case MIN: - case MULTIPLE: - case MUTED: - case NAME: - case NOVALIDATE: - case ONABORT: - case ONAFTERPRINT: - case ONBEFOREPRINT: - case ONBEFOREUNLOAD: - case ONBLUR: - case ONCANPLAY: - case ONCANPLAYTHROUGH: - case ONCHANGE: - case ONCLICK: - case ONCONTEXTMENU: - case ONCOPY: - case ONCUECHANGE: - case ONCUT: - case ONDBLCLICK: - case ONDRAG: - case ONDRAGEND: - case ONDRAGENTER: - case ONDRAGLEAVE: - case ONDRAGOVER: - case ONDRAGSTART: - case ONDROP: - case ONDURATIONCHANGE: - case ONEMPTIED: - case ONENDED: - case ONERROR: - case ONFOCUS: - case ONHASHCHANGE: - case ONINPUT: - case ONINVALID: - case ONKEYDOWN: - case ONKEYPRESS: - case ONKEYUP: - case ONLOAD: - case ONLOADEDDATA: - case ONLOADEDMETADATA: - case ONLOADSTART: - case ONMOUSEDOWN: - case ONMOUSEMOVE: - case ONMOUSEOUT: - case ONMOUSEOVER: - case ONMOUSEUP: - case ONMOUSEWHEEL: - case ONOFFLINE: - case ONONLINE: - case ONPAGEHIDE: - case ONPAGESHOW: - case ONPASTE: - case ONPLAY: - case ONPLAYING: - case ONPOPSTATE: - case ONPROGRESS: - case ONRATECHANGE: - case ONRESET: - case ONRESIZE: - case ONSCROLL: - case ONSEARCH: - case ONSEEKED: - case ONSEEKING: - case ONSELECT: - case ONSTALLED: - case ONSTORAGE: - case ONSUBMIT: - case ONSUSPEND: - case ONTIMEUPDATE: - case ONTOGGLE: - case ONUNLOAD: - case ONVOLUMECHANGE: - case ONWAITING: - case ONWHEEL: - case OPEN: - case OPTIMUM: - case PLACEHOLDER: - case POSTER: - case PRELOAD: - case READONLY: - case REL: - case REQUIRED: - case REVERSED: - case ROWS: - case ROWSPAN: - case SANDBOX: - case SCOPE: - case SELECTED: - case SHAPE: - case SIZE: - case SIZES: - case SPELLCHECK: - case SRC: - case SRCDOC: - case SRCLANG: - case SRCSET: - case START: - case STEP: - case TABINDEX: - case TARGET: - case TRANSLATE: - case USEMAP: - case VALUE: - case WRAP: - result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); - isError = false; - break; - case HTMLCOMMENTSTART: - case HTMLCOMMENTEND: - case CSSCOMMENTSTART: - case CSSCOMMENTEND: - isError = false; - result.addIfNeeded(line, column, EditorColorScheme.COMMENT); - break; - case AREA: - case BASE: - case BR: - case COL: - case EMBED: - case HR: - case IMG: - case INPUT: - case KEYGEN: - case LINK: - case PARAM: - case SOURCE: - case TRACK: - case WBR: - case VIM: - case REM: - case VH: - case VW: - case PT: - case CM: - case MM: - case PC: - case EX: - case CH: - case DEG: - case GRAD: - case RAD: - case TURN: - case MS: - case FR: - case UNDERLINE: - case ITALIC: - case BOLD: - case NORMAL: - case RGBA: - case HSL: - case URL: - case NONE: - case BLOCK: - case INLINE: - case CELL: - case ROW: - case ABSOLUTE: - case RELATIVE: - case FIXED: - case COLLAPSE: - case VISIBLE: - case UPPERCASE: - case LOWERCASE: - case CAPITALIZE: - case SHRINK: - case REVERSE: - case NOWRAP: - case HORIZONTAL: - case VERTICAL: - case NO: - isError = false; - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.OPERATOR, 0, true, false, false)); - break; - case RED: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.red, 0, true, false, false)); - break; - } - case ALICEBLUE: { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.aliceblue, 0, true, false, false)); + case PROTOTYPE: + case ALERT: + case SUPPORT: + case YIELD: + case ASYNC: + case DOCUMENT: + case ARGUMENTS: + case PARSEINT: + case AWAIT: + case UNDEFINED: + case PARSEFLOAT: + case GET: + case STORAGE: + case TYPE: + case INFINITY: + case ESCAPE: + case __PROTO__: + case WINDOW: + case EVAL: + case GETELEMENTBYID: + isError = false; + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.LITERAL, 0, true, false, false)); + break; + case DOT: + case MULT: + case MINUS: + case PLUS: + case COMMA: + case NOT: + case QUESTION: + case AND: + case OR: + case XOR: + case MOD: + case SEMICOLON: + isError = false; + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.print, 0, true, true, false)); + break; + case ACCEPT: + case ACCESSKEY: + case ACTION: + case ALIGN: + case TEXT: + case ALT: + case AUTOCOMPLETE: + case AUTOFOCUS: + case AUTOPLAY: - break; - } - case ANTIQUEWHITE: { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.antiquewhite, 0, true, false, false)); + case BGCOLOR: + case CHARSET: + case CHECKED: + case COLS: + case COLSPAN: + case CONTENTEDITABLE: + case CONTROLS: + case COORDS: + case DATA: + case DATETIME: + case DEFAULT: + case DEFER: + case DIRNAME: + case DISABLED: + case DRAGGABLE: + case DROPZONE: + case ENCTYPE: + case FACE: + case FORMACTION: + case HEADERS: + case HIGH: + case HREF: + case HREFLANG: + case HTTP: + case EQUIV: + case ID: + case ISMAP: + case KIND: + case LANG: + case LIST: + case LOOP: + case LOW: + case MAX: + case MAXLENGTH: + case MEDIA: + case METHOD: + case MIN: + case MULTIPLE: + case MUTED: + case NAME: + case NOVALIDATE: + case ONABORT: + case ONAFTERPRINT: + case ONBEFOREPRINT: + case ONBEFOREUNLOAD: + case ONBLUR: + case ONCANPLAY: + case ONCANPLAYTHROUGH: + case ONCHANGE: + case ONCLICK: + case ONCONTEXTMENU: + case ONCOPY: + case ONCUECHANGE: + case ONCUT: + case ONDBLCLICK: + case ONDRAG: + case ONDRAGEND: + case ONDRAGENTER: + case ONDRAGLEAVE: + case ONDRAGOVER: + case ONDRAGSTART: + case ONDROP: + case ONDURATIONCHANGE: + case ONEMPTIED: + case ONENDED: + case ONERROR: + case ONFOCUS: + case ONHASHCHANGE: + case ONINPUT: + case ONINVALID: + case ONKEYDOWN: + case ONKEYPRESS: + case ONKEYUP: + case ONLOAD: + case ONLOADEDDATA: + case ONLOADEDMETADATA: + case ONLOADSTART: + case ONMOUSEDOWN: + case ONMOUSEMOVE: + case ONMOUSEOUT: + case ONMOUSEOVER: + case ONMOUSEUP: + case ONMOUSEWHEEL: + case ONOFFLINE: + case ONONLINE: + case ONPAGEHIDE: + case ONPAGESHOW: + case ONPASTE: + case ONPLAY: + case ONPLAYING: + case ONPOPSTATE: + case ONPROGRESS: + case ONRATECHANGE: + case ONRESET: + case ONRESIZE: + case ONSCROLL: + case ONSEARCH: + case ONSEEKED: + case ONSEEKING: + case ONSELECT: + case ONSTALLED: + case ONSTORAGE: + case ONSUBMIT: + case ONSUSPEND: + case ONTIMEUPDATE: + case ONTOGGLE: + case ONUNLOAD: + case ONVOLUMECHANGE: + case ONWAITING: + case ONWHEEL: + case OPEN: + case OPTIMUM: + case PLACEHOLDER: + case POSTER: + case PRELOAD: + case READONLY: + case REL: + case REQUIRED: + case REVERSED: + case ROWS: + case ROWSPAN: + case SANDBOX: + case SCOPE: + case SELECTED: + case SHAPE: + case SIZE: + case SIZES: + case SPELLCHECK: + case SRC: + case SRCDOC: + case SRCLANG: + case SRCSET: + case START: + case STEP: + case TABINDEX: + case TARGET: + case TRANSLATE: + case USEMAP: + case VALUE: + case WRAP: + result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); + isError = false; + break; + case HTMLCOMMENTSTART: + case HTMLCOMMENTEND: + case CSSCOMMENTSTART: + case CSSCOMMENTEND: + isError = false; + result.addIfNeeded(line, column, EditorColorScheme.COMMENT); + break; + case AREA: + case BASE: + case BR: + case COL: + case EMBED: + case HR: + case IMG: + case INPUT: + case KEYGEN: + case LINK: + case PARAM: + case SOURCE: + case TRACK: + case WBR: + case VIM: + case REM: + case VH: + case VW: + case PT: + case CM: + case MM: + case PC: + case EX: + case CH: + case DEG: + case GRAD: + case RAD: + case TURN: + case MS: + case FR: + case UNDERLINE: + case ITALIC: + case BOLD: + case NORMAL: + case RGBA: + case HSL: + case URL: + case NONE: + case BLOCK: + case INLINE: + case CELL: + case ROW: + case ABSOLUTE: + case RELATIVE: + case FIXED: + case COLLAPSE: + case VISIBLE: + case UPPERCASE: + case LOWERCASE: + case CAPITALIZE: + case SHRINK: + case REVERSE: + case NOWRAP: + case HORIZONTAL: + case VERTICAL: + case NO: + isError = false; + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.OPERATOR, 0, true, false, false)); + break; + case RED: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.red, 0, true, false, false)); + break; + } + case ALICEBLUE: + { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.aliceblue, 0, true, false, false)); - break; - } - case AQUA: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.aqua, 0, true, false, false)); + break; + } + case ANTIQUEWHITE: + { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.antiquewhite, 0, true, false, false)); - break; - } - case AQUAMARINE: { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.aquamarine, 0, true, false, false)); + break; + } + case AQUA: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.aqua, 0, true, false, false)); - break; - } - case AZURE: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.azure, 0, true, false, false)); + break; + } + case AQUAMARINE: + { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.aquamarine, 0, true, false, false)); - break; - } - case BEIGE: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.beige, 0, true, false, false)); + break; + } + case AZURE: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.azure, 0, true, false, false)); - break; - } - case BISQUE: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.bisque, 0, true, false, false)); + break; + } + case BEIGE: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.beige, 0, true, false, false)); - break; - } - case BLACK: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.black, 0, true, false, false)); + break; + } + case BISQUE: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.bisque, 0, true, false, false)); - break; - } - case BLANCHEDALMOND: { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.blanchedalmond, 0, true, false, false)); + break; + } + case BLACK: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.black, 0, true, false, false)); - break; - } - case BLUE: { - result.addIfNeeded(line, column, EditorColorScheme.blue); - break; - } - case BLUEVIOLET: { - result.addIfNeeded( - line, - column, - TextStyle.makeStyle(EditorColorScheme.blueviolet, 0, true, false, false)); + break; + } + case BLANCHEDALMOND: + { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.blanchedalmond, 0, true, false, false)); - break; - } - case BROWN: { - result.addIfNeeded( - line, column, TextStyle.makeStyle(EditorColorScheme.brown, 0, true, false, false)); + break; + } + case BLUE: + { + result.addIfNeeded(line, column, EditorColorScheme.blue); + break; + } + case BLUEVIOLET: + { + result.addIfNeeded( + line, + column, + TextStyle.makeStyle(EditorColorScheme.blueviolet, 0, true, false, false)); - break; - } + break; + } + case BROWN: + { + result.addIfNeeded( + line, column, TextStyle.makeStyle(EditorColorScheme.brown, 0, true, false, false)); - default: - isError = true; - if (token == Token.LBRACK || (token == Token.RBRACK && previous == Token.LBRACK)) { - result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); - break; - } - try { - if (text.toString() - .matches( - "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)")) { - result.addIfNeeded(line, column, EditorColorScheme.red); - break; - } - } catch (Exception err) { - err.printStackTrace(); - } + break; + } - classNamePrevious = false; - result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); + default: + isError = true; + if (token == Token.LBRACK || (token == Token.RBRACK && previous == Token.LBRACK)) { + result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); + break; + } + try { + if (text.toString() + .matches( + "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)")) { + result.addIfNeeded(line, column, EditorColorScheme.red); + break; } - first = false; - helper.update(thisLength); - line = helper.getLine(); - column = helper.getColumn(); - if (token != Token.WHITESPACE && token != Token.NEWLINE) { - previous = token; - } - } - if (stack.isEmpty()) { - if (currSwitch > maxSwitch) { - maxSwitch = currSwitch; - } - } - if (isError) { - // if(helperzz != null) { - // //helperzz.show(); - // } - sin.analyze(content, result, delegate); - } - identifiers.finish(); - result.determine(line); - result.setExtra(identifiers); - result.setSuppressSwitch(maxSwitch + 50); - result.setNavigation(labels); - } + } catch (Exception err) { + err.printStackTrace(); + } - @Override - public void Error(boolean error) { - isError = error; + classNamePrevious = false; + result.addIfNeeded(line, column, EditorColorScheme.OPERATOR); + } + first = false; + helper.update(thisLength); + line = helper.getLine(); + column = helper.getColumn(); + if (token != Token.WHITESPACE && token != Token.NEWLINE) { + previous = token; + } } - - @Override - public void NotError(boolean error) { - isError = error; + if (stack.isEmpty()) { + if (currSwitch > maxSwitch) { + maxSwitch = currSwitch; + } } - - protected interface End { - void ends(); + if (isError) { + // if(helperzz != null) { + // //helperzz.show(); + // } + sin.analyze(content, result, delegate); } + identifiers.finish(); + result.determine(line); + result.setExtra(identifiers); + result.setSuppressSwitch(maxSwitch + 50); + result.setNavigation(labels); + } + + @Override + public void Error(boolean error) { + isError = error; + } + + @Override + public void NotError(boolean error) { + isError = error; + } - public static class HighlightToken { + protected interface End { + void ends(); + } - public Token token; - public int offset; - public String url; + public static class HighlightToken { - public HighlightToken(Token token, int offset) { - this.token = token; - this.offset = offset; - } + public Token token; + public int offset; + public String url; + + public HighlightToken(Token token, int offset) { + this.token = token; + this.offset = offset; + } - public HighlightToken(Token token, int offset, String url) { - this.token = token; - this.offset = offset; - this.url = url; - } + public HighlightToken(Token token, int offset, String url) { + this.token = token; + this.offset = offset; + this.url = url; } + } } diff --git a/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLTextTokenizer.java b/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLTextTokenizer.java index 4dc72702..6d4b0de3 100644 --- a/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLTextTokenizer.java +++ b/app/src/main/java/io/github/rosemoe/sora/langs/html/HTMLTextTokenizer.java @@ -8,1827 +8,1829 @@ */ public class HTMLTextTokenizer { - protected static String[] sKeywords; - private static TrieTree keywords; - private static TrieTree css; + protected static String[] sKeywords; + private static TrieTree keywords; + private static TrieTree css; - static { - doStaticInit(); - } + static { + doStaticInit(); + } - protected int bufferLen; - protected int offset; - protected int length; - private CharSequence source; - private int line; - private int column; - private int index; - private Token currToken; - private boolean lcCal; - private boolean skipWS; - private boolean skipComment; - public HTMLTextTokenizer(CharSequence src) { - if (src == null) { - throw new IllegalArgumentException("src can not be null"); - } - this.source = src; - init(); - } + protected int bufferLen; + protected int offset; + protected int length; + private CharSequence source; + private int line; + private int column; + private int index; + private Token currToken; + private boolean lcCal; + private boolean skipWS; + private boolean skipComment; - public static TrieTree getTree() { - return keywords; + public HTMLTextTokenizer(CharSequence src) { + if (src == null) { + throw new IllegalArgumentException("src can not be null"); } + this.source = src; + init(); + } - public static TrieTree getcss() { - return css; - } + public static TrieTree getTree() { + return keywords; + } - /* */ - protected static void doStaticInit() { - sKeywords = - new String[]{ - "", - "/*", - "*/", - "a", - "abbr", - "acronym", - "address", - "applet", - "article", - "aside", - "audio", - "b", - "basefont", - "bdi", - "bdo", - "bgsound", - "big", - "blink", - "blockquote", - "body", - "button", - "canvas", - "caption", - "center", - "circle", - "clippath", - "code", - "colgroup", - "command", - "datalist", - "dd", - "defs", - "del", - "details", - "dfn", - "dialog", - "dir", - "div", - "dl", - "dt", - "element", - "ellipse", - "em", - "fieldset", - "figcaption", - "figure", - "footer", - "foreignobject", - "form", - "frame", - "frameset", - "g", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "html", - "i", - "iframe", - "image", - "ins", - "isindex", - "kbd", - "label", - "legend", - "li", - "line", - "lineargradient", - "listing", - "main", - "map", - "mark", - "marquee", - "mask", - "math", - "menu", - "menuitem", - "meter", - "multicol", - "nav", - "nextid", - "nobr", - "noembed", - "noframes", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "path", - "pattern", - "picture", - "plaintext", - "polygon", - "polyline", - "pre", - "progress", - "q", - "radialgradient", - "rb", - "rbc", - "rect", - "rp", - "rt", - "rtc", - "ruby", - "s", - "samp", - "script", - "section", - "select", - "shadow", - "slot", - "small", - "spacer", - "span", - "stop", - "strike", - "strong", - "style", - "nostyle", - "sub", - "summary", - "sup", - "svg", - "table", - "tbody", - "td", - "template", - "text", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "tspan", - "tt", - "u", - "ul", - "video", - "xmp", - "class", - "meta", - "align_content", - "align_items", - "align_self", - "all", - "animation", - "animation_delay", - "animation_direction", - "animation_duration", - "animation_fill_mode", - "animation_iteration_count", - "animation_name", - "animation_play_state", - "animation_timing_function", - "backface_visibility", - "background", - "background_attachment", - "background_blur", - "background_clip", - "background_color", - "background_image", - "background_origin", - "background_position", - "background_repeat", - "background_size", - "border_bottom", - "border_bottom_color", - "border_bottom_left_radius", - "border_bottom_right_radius", - "border_bottom_style", - "border_bottom_width", - "border_collapse", - "border_color", - "border_image", - "border_image_outset", - "border_image_repeat", - "border_image_slice", - "border_image_source", - "border_image_width", - "border_left", - "border_left_color", - "border_left_style", - "border_left_width", - "border_radius", - "border_right", - "border_right_color", - "border_right_style", - "border_right_width", - "border_spacing", - "border_style", - "border_top", - "border_top_color", - "border_top_left_radius", - "border_top_right_radius", - "border_top_style", - "border_top_width", - "border_width", - "bottom", - "box_decoration_break", - "box_shadow", - "box_sizing", - "break_after", - "break_before", - "break_inside", - "caption_side", - "caret_color", - "clear", - "clip", - "color", - "column_count", - "column_fill", - "column_gap", - "column_rule", - "column_rule_color", - "column_rule_style", - "column_rule_width", - "column_span", - "column_width", - "columns", - "counter_increment", - "counter_reset", - "cursor", - "direction", - "display", - "empty_cells", - "filter", - "flex", - "flex_basis", - "flex_direction", - "flex_flow", - "flex_grow", - "flex_shrink", - "flex_wrap", - "font", - "font_family", - "font_size", - "font_size_adjust", - "font_stretch", - "font_style", - "font_variant", - "font_variant_caps", - "font_weight", - "gap", - "grid", - "grid_area", - "grid_auto_columns", - "grid_auto_flow", - "grid_auto_rows", - "grid_column", - "grid_column_end", - "grid_column_gap", - "grid_column_start", - "grid_gap", - "grid_row", - "grid_row_end", - "grid_row_gap", - "grid_row_start", - "grid_template", - "grid_template_areas", - "grid_template_columns", - "grid_template_rows", - "height", - "ime_mode", - "justify_content", - "left", - "letter_spacing", - "line_break", - "line_height", - "list_style", - "list_style_image", - "list_style_position", - "list_style_type", - "margin", - "margin_bottom", - "margin_left", - "margin_right", - "margin_top", - "marker_offset", - "max_height", - "max_width", - "min_height", - "min_width", - "mix_blend_mode", - "object_fit", - "object_position", - "opacity", - "order", - "orphans", - "outline", - "outline_color", - "outline_offset", - "outline_style", - "outline_width", - "overflow", - "overflow_wrap", - "overflow_x", - "overflow_y", - "padding", - "padding_bottom", - "padding_left", - "padding_right", - "padding_top", - "page_break_after", - "page_break_before", - "page_break_inside", - "perspective", - "perspective_origin", - "pointer_events", - "position", - "quotes", - "resize", - "right", - "row_gap", - "scroll_behavior", - "speak", - "table_layout", - "tab_size", - "text_align", - "text_align_last", - "text_decoration", - "text_decoration_color", - "text_decoration_line", - "text_decoration_skip", - "text_decoration_style", - "text_indent", - "text_justify", - "text_overflow", - "text_shadow", - "text_transform", - "text_underline_position", - "top", - "transform", - "transform_origin", - "transform_style", - "transition", - "transition_delay", - "transition_duration", - "transition_property", - "transition_timing_function", - "unicode_bidi", - "vertical_align", - "visibility", - "white_space", - "widows", - "width", - "will_change", - "word_break", - "word_spacing", - "word_wrap", - "writing_mode", - "z_index", - "abstract", - "else", - "instanceof", - "super", - "boolean", - "enum", - "int", - "switch", - "break", - "export", - "interface", - "synchronized", - "byte", - "extends", - "let", - "this", - "case", - "false", - "long", - "throw", - "catch", - "final", - "native", - "throws", - "char", - "finally", - "new", - "transient", - "float", - "null", - "true", - "const", - "for", - "package", - "try", - "continue", - "function", - "private", - "typeof", - "debugger", - "goto", - "protected", - "var", - "if", - "public", - "void", - "delete", - "implements", - "return", - "volatile", - "do", - "import", - "short", - "while", - "double", - "in", - "static", - "with", - "of", - "console", - "log", - "prototype", - "alert", - "support", - "yield", - "async", - "document", - "arguments", - "parseint", - "await", - "undefined", - "parsefloat", - "get", - "storage", - "infinity", - "escape", - "__count__", - "__parent__", - "__proto__", - "window", - "eval", - "getelementbyid", - "getelementbyclass", - "accept", - "accesskey", - "action", - "align", - "alt", - "autocomplete", - "autofocus", - "autoplay", - "border", - "bgcolor", - "charset", - "checked", - "cite", - "cols", - "colspan", - "content", - "contenteditable", - "controls", - "coords", - "data", - "datetime", - "default", - "defer", - "dirname", - "disabled", - "draggable", - "dropzone", - "enctype", - "face", - "formaction", - "headers", - "high", - "href", - "hreflang", - "http", - "equiv", - "id", - "ismap", - "kind", - "lang", - "list", - "loop", - "low", - "max", - "maxlength", - "media", - "method", - "min", - "multiple", - "muted", - "name", - "novalidate", - "onabort", - "onafterprint", - "onbeforeprint", - "onbeforeunload", - "onblur", - "oncanplay", - "oncanplaythrough", - "onchange", - "onclick", - "oncontextmenu", - "oncopy", - "oncuechange", - "oncut", - "ondblclick", - "ondrag", - "ondragend", - "ondragenter", - "ondragleave", - "ondragover", - "ondragstart", - "ondrop", - "ondurationchange", - "onemptied", - "onended", - "onerror", - "onfocus", - "onhashchange", - "oninput", - "oninvalid", - "onkeydown", - "onkeypress", - "onkeyup", - "onload", - "onloadeddata", - "onloadedmetadata", - "onloadstart", - "onmousedown", - "onmousemove", - "onmouseout", - "onmouseover", - "onmouseup", - "onmousewheel", - "onoffline", - "ononline", - "onpagehide", - "onpageshow", - "onpaste", - "onplay", - "onplaying", - "onpopstate", - "onprogress", - "onratechange", - "onreset", - "onresize", - "onscroll", - "onsearch", - "onseeked", - "onseeking", - "onselect", - "onstalled", - "onstorage", - "onsubmit", - "onsuspend", - "ontimeupdate", - "ontoggle", - "onunload", - "onvolumechange", - "onwaiting", - "onwheel", - "open", - "optimum", - "placeholder", - "poster", - "preload", - "readonly", - "rel", - "required", - "reversed", - "rows", - "rowspan", - "sandbox", - "scope", - "selected", - "shape", - "size", - "sizes", - "spellcheck", - "src", - "srcdoc", - "srclang", - "srcset", - "start", - "step", - "tabindex", - "target", - "translate", - "type", - "usemap", - "value", - "wrap", - "area", - "base", - "br", - "col", - "embed", - "hr", - "img", - "input", - "keygen", - "link", - "param", - "source", - "track", - "wbr", - "px", - "vim", - "rem", - "vh", - "vw", - "pt", - "cm", - "mm", - "pc", - "ex", - "ch", - "deg", - "grad", - "rad", - "turn", - "ms", - "fr", - "underline", - "italic", - "bold", - "normal", - "rgba", - "hsl", - "url", - "none", - "block", - "inline", - "cell", - "row", - "absolute", - "relative", - "fixed", - "collapse", - "visible", - "uppercase", - "lowercase", - "capitalize", - "shrink", - "reverse", - "nowrap", - "horizontal", - "vertical", - "repeat", - "no", - "red", - "aliceblue", - "antiquewhite", - "aqua", - "aquamarine", - "azure", - "beige", - "bisque", - " black", - "blanchedalmond", - "blue", - "blueviolet", "brown" - }; - Token[] sToken = - new Token[]{ - Token.HTMLCOMMENTSTART, - Token.HTMLCOMMENTEND, - Token.CSSCOMMENTSTART, - Token.CSSCOMMENTEND, - Token.A, - Token.ABBR, - Token.ACRONYM, - Token.ADDRESS, - Token.APPLET, - Token.ARTICLE, - Token.ASIDE, - Token.AUDIO, - Token.B, - Token.BASEFONT, - Token.BDI, - Token.BDO, - Token.BGSOUND, - Token.BIG, - Token.BLINK, - Token.BLOCKQUOTE, - Token.BODY, - Token.BUTTON, - Token.CANVAS, - Token.CAPTION, - Token.CENTER, - Token.CIRCLE, - Token.CLIPPATH, - Token.CODE, - Token.COLGROUP, - Token.COMMAND, - Token.DATALIST, - Token.DD, - Token.DEFS, - Token.DEL, - Token.DETAILS, - Token.DFN, - Token.DIALOG, - Token.DIR, - Token.DIV, - Token.DL, - Token.DT, - Token.ELEMENT, - Token.ELLIPSE, - Token.EM, - Token.FIELDSET, - Token.FIGCAPTION, - Token.FIGURE, - Token.FOOTER, - Token.FOREIGNOBJECT, - Token.FORM, - Token.FRAME, - Token.FRAMESET, - Token.G, - Token.H1, - Token.H2, - Token.H3, - Token.H4, - Token.H5, - Token.H6, - Token.HEAD, - Token.HEADER, - Token.HGROUP, - Token.HTML, - Token.I, - Token.IFRAME, - Token.IMAGE, - Token.INS, - Token.ISINDEX, - Token.KBD, - Token.LABEL, - Token.LEGEND, - Token.LI, - Token.LINE, - Token.LINEARGRADIENT, - Token.LISTING, - Token.MAIN, - Token.MAP, - Token.MARK, - Token.MARQUEE, - Token.MASK, - Token.MATH, - Token.MENU, - Token.MENUITEM, - Token.METER, - Token.MULTICOL, - Token.NAV, - Token.NEXTID, - Token.NOBR, - Token.NOEMBED, - Token.NOFRAMES, - Token.NOSCRIPT, - Token.OBJECT, - Token.OL, - Token.OPTGROUP, - Token.OPTION, - Token.OUTPUT, - Token.P, - Token.PATH, - Token.PATTERN, - Token.PICTURE, - Token.PLAINTEXT, - Token.POLYGON, - Token.POLYLINE, - Token.PRE, - Token.PROGRESS, - Token.Q, - Token.RADIALGRADIENT, - Token.RB, - Token.RBC, - Token.RECT, - Token.RP, - Token.RT, - Token.RTC, - Token.RUBY, - Token.S, - Token.SAMP, - Token.SCRIPT, - Token.SECTION, - Token.SELECT, - Token.SHADOW, - Token.SLOT, - Token.SMALL, - Token.SPACER, - Token.SPAN, - Token.STOP, - Token.STRIKE, - Token.STRONG, - Token.STYLE, - Token.NOSTYLE, - Token.SUB, - Token.SUMMARY, - Token.SUP, - Token.SVG, - Token.TABLE, - Token.TBODY, - Token.TD, - Token.TEMPLATE, - Token.TEXT, - Token.TEXTAREA, - Token.TFOOT, - Token.TH, - Token.THEAD, - Token.TIME, - Token.TITLE, - Token.TR, - Token.TSPAN, - Token.TT, - Token.U, - Token.UL, - Token.VIDEO, - Token.XMP, - Token.CLASS, - Token.META, - Token.ALIGN_CONTENT, - Token.ALIGN_ITEMS, - Token.ALIGN_SELF, - Token.ALL, - Token.ANIMATION, - Token.ANIMATION_DELAY, - Token.ANIMATION_DIRECTION, - Token.ANIMATION_DURATION, - Token.ANIMATION_FILL_MODE, - Token.ANIMATION_ITERATION_COUNT, - Token.ANIMATION_NAME, - Token.ANIMATION_PLAY_STATE, - Token.ANIMATION_TIMING_FUNCTION, - Token.BACKFACE_VISIBILITY, - Token.BACKGROUND, - Token.BACKGROUND_ATTACHMENT, - Token.BACKGROUND_BLUR, - Token.BACKGROUND_CLIP, - Token.BACKGROUND_COLOR, - Token.BACKGROUND_IMAGE, - Token.BACKGROUND_ORIGIN, - Token.BACKGROUND_POSITION, - Token.BACKGROUND_REPEAT, - Token.BACKGROUND_SIZE, - Token.BORDER_BOTTOM, - Token.BORDER_BOTTOM_COLOR, - Token.BORDER_BOTTOM_LEFT_RADIUS, - Token.BORDER_BOTTOM_RIGHT_RADIUS, - Token.BORDER_BOTTOM_STYLE, - Token.BORDER_BOTTOM_WIDTH, - Token.BORDER_COLLAPSE, - Token.BORDER_COLOR, - Token.BORDER_IMAGE, - Token.BORDER_IMAGE_OUTSET, - Token.BORDER_IMAGE_REPEAT, - Token.BORDER_IMAGE_SLICE, - Token.BORDER_IMAGE_SOURCE, - Token.BORDER_IMAGE_WIDTH, - Token.BORDER_LEFT, - Token.BORDER_LEFT_COLOR, - Token.BORDER_LEFT_STYLE, - Token.BORDER_LEFT_WIDTH, - Token.BORDER_RADIUS, - Token.BORDER_RIGHT, - Token.BORDER_RIGHT_COLOR, - Token.BORDER_RIGHT_STYLE, - Token.BORDER_RIGHT_WIDTH, - Token.BORDER_SPACING, - Token.BORDER_STYLE, - Token.BORDER_TOP, - Token.BORDER_TOP_COLOR, - Token.BORDER_TOP_LEFT_RADIUS, - Token.BORDER_TOP_RIGHT_RADIUS, - Token.BORDER_TOP_STYLE, - Token.BORDER_TOP_WIDTH, - Token.BORDER_WIDTH, - Token.BOTTOM, - Token.BOX_DECORATION_BREAK, - Token.BOX_SHADOW, - Token.BOX_SIZING, - Token.BREAK_AFTER, - Token.BREAK_BEFORE, - Token.BREAK_INSIDE, - Token.CAPTION_SIDE, - Token.CARET_COLOR, - Token.CLEAR, - Token.CLIP, - Token.COLOR, - Token.COLUMN_COUNT, - Token.COLUMN_FILL, - Token.COLUMN_GAP, - Token.COLUMN_RULE, - Token.COLUMN_RULE_COLOR, - Token.COLUMN_RULE_STYLE, - Token.COLUMN_RULE_WIDTH, - Token.COLUMN_SPAN, - Token.COLUMN_WIDTH, - Token.COLUMNS, - Token.COUNTER_INCREMENT, - Token.COUNTER_RESET, - Token.CURSOR, - Token.DIRECTION, - Token.DISPLAY, - Token.EMPTY_CELLS, - Token.FILTER, - Token.FLEX, - Token.FLEX_BASIS, - Token.FLEX_DIRECTION, - Token.FLEX_FLOW, - Token.FLEX_GROW, - Token.FLEX_SHRINK, - Token.FLEX_WRAP, - Token.FONT, - Token.FONT_FAMILY, - Token.FONT_SIZE, - Token.FONT_SIZE_ADJUST, - Token.FONT_STRETCH, - Token.FONT_STYLE, - Token.FONT_VARIANT, - Token.FONT_VARIANT_CAPS, - Token.FONT_WEIGHT, - Token.GAP, - Token.GRID, - Token.GRID_AREA, - Token.GRID_AUTO_COLUMNS, - Token.GRID_AUTO_FLOW, - Token.GRID_AUTO_ROWS, - Token.GRID_COLUMN, - Token.GRID_COLUMN_END, - Token.GRID_COLUMN_GAP, - Token.GRID_COLUMN_START, - Token.GRID_GAP, - Token.GRID_ROW, - Token.GRID_ROW_END, - Token.GRID_ROW_GAP, - Token.GRID_ROW_START, - Token.GRID_TEMPLATE, - Token.GRID_TEMPLATE_AREAS, - Token.GRID_TEMPLATE_COLUMNS, - Token.GRID_TEMPLATE_ROWS, - Token.HEIGHT, - Token.IME_MODE, - Token.JUSTIFY_CONTENT, - Token.LEFT, - Token.LETTER_SPACING, - Token.LINE_BREAK, - Token.LINE_HEIGHT, - Token.LIST_STYLE, - Token.LIST_STYLE_IMAGE, - Token.LIST_STYLE_POSITION, - Token.LIST_STYLE_TYPE, - Token.MARGIN, - Token.MARGIN_BOTTOM, - Token.MARGIN_LEFT, - Token.MARGIN_RIGHT, - Token.MARGIN_TOP, - Token.MARKER_OFFSET, - Token.MAX_HEIGHT, - Token.MAX_WIDTH, - Token.MIN_HEIGHT, - Token.MIN_WIDTH, - Token.MIX_BLEND_MODE, - Token.OBJECT_FIT, - Token.OBJECT_POSITION, - Token.OPACITY, - Token.ORDER, - Token.ORPHANS, - Token.OUTLINE, - Token.OUTLINE_COLOR, - Token.OUTLINE_OFFSET, - Token.OUTLINE_STYLE, - Token.OUTLINE_WIDTH, - Token.OVERFLOW, - Token.OVERFLOW_WRAP, - Token.OVERFLOW_X, - Token.OVERFLOW_Y, - Token.PADDING, - Token.PADDING_BOTTOM, - Token.PADDING_LEFT, - Token.PADDING_RIGHT, - Token.PADDING_TOP, - Token.PAGE_BREAK_AFTER, - Token.PAGE_BREAK_BEFORE, - Token.PAGE_BREAK_INSIDE, - Token.PERSPECTIVE, - Token.PERSPECTIVE_ORIGIN, - Token.POINTER_EVENTS, - Token.POSITION, - Token.QUOTES, - Token.RESIZE, - Token.RIGHT, - Token.ROW_GAP, - Token.SCROLL_BEHAVIOR, - Token.SPEAK, - Token.TABLE_LAYOUT, - Token.TAB_SIZE, - Token.TEXT_ALIGN, - Token.TEXT_ALIGN_LAST, - Token.TEXT_DECORATION, - Token.TEXT_DECORATION_COLOR, - Token.TEXT_DECORATION_LINE, - Token.TEXT_DECORATION_SKIP, - Token.TEXT_DECORATION_STYLE, - Token.TEXT_INDENT, - Token.TEXT_JUSTIFY, - Token.TEXT_OVERFLOW, - Token.TEXT_SHADOW, - Token.TEXT_TRANSFORM, - Token.TEXT_UNDERLINE_POSITION, - Token.TOP, - Token.TRANSFORM, - Token.TRANSFORM_ORIGIN, - Token.TRANSFORM_STYLE, - Token.TRANSITION, - Token.TRANSITION_DELAY, - Token.TRANSITION_DURATION, - Token.TRANSITION_PROPERTY, - Token.TRANSITION_TIMING_FUNCTION, - Token.UNICODE_BIDI, - Token.VERTICAL_ALIGN, - Token.VISIBILITY, - Token.WHITE_SPACE, - Token.WIDOWS, - Token.WIDTH, - Token.WILL_CHANGE, - Token.WORD_BREAK, - Token.WORD_SPACING, - Token.WORD_WRAP, - Token.WRITING_MODE, - Token.Z_INDEX, - Token.ABSTRACT, - Token.ELSE, - Token.INSTANCEOF, - Token.SUPER, - Token.BOOLEAN, - Token.ENUM, - Token.INT, - Token.SWITCH, - Token.BREAK, - Token.EXPORT, - Token.INTERFACE, - Token.SYNCHRONIZED, - Token.BYTE, - Token.EXTENDS, - Token.LET, - Token.THIS, - Token.CASE, - Token.FALSE, - Token.LONG, - Token.THROW, - Token.CATCH, - Token.FINAL, - Token.NATIVE, - Token.THROWS, - Token.CHAR, - Token.FINALLY, - Token.NEW, - Token.TRANSIENT, - Token.FLOAT, - Token.NULL, - Token.TRUE, - Token.CONST, - Token.FOR, - Token.PACKAGE, - Token.TRY, - Token.CONTINUE, - Token.FUNCTION, - Token.PRIVATE, - Token.TYPEOF, - Token.DEBUGGER, - Token.GOTO, - Token.PROTECTED, - Token.VAR, - Token.IF, - Token.PUBLIC, - Token.VOID, - Token.DELETE, - Token.IMPLEMENTS, - Token.RETURN, - Token.VOLATILE, - Token.DO, - Token.IMPORT, - Token.SHORT, - Token.WHILE, - Token.DOUBLE, - Token.IN, - Token.STATIC, - Token.WITH, - Token.OF, - Token.CONSOLE, - Token.LOG, - Token.PROTOTYPE, - Token.ALERT, - Token.SUPPORT, - Token.YIELD, - Token.ASYNC, - Token.DOCUMENT, - Token.ARGUMENTS, - Token.PARSEINT, - Token.AWAIT, - Token.UNDEFINED, - Token.PARSEFLOAT, - Token.GET, - Token.STORAGE, - Token.INFINITY, - Token.ESCAPE, - Token.__COUNT__, - Token.__PARENT__, - Token.__PROTO__, - Token.WINDOW, - Token.EVAL, - Token.GETELEMENTBYID, - Token.GETELEMENTBYCLASS, - Token.ACCEPT, - Token.ACCESSKEY, - Token.ACTION, - Token.ALIGN, - Token.ALT, - Token.AUTOCOMPLETE, - Token.AUTOFOCUS, - Token.AUTOPLAY, - Token.BORDER, - Token.BGCOLOR, - Token.CHARSET, - Token.CHECKED, - Token.CITE, - Token.COLS, - Token.COLSPAN, - Token.CONTENT, - Token.CONTENTEDITABLE, - Token.CONTROLS, - Token.COORDS, - Token.DATA, - Token.DATETIME, - Token.DEFAULT, - Token.DEFER, - Token.DIRNAME, - Token.DISABLED, - Token.DRAGGABLE, - Token.DROPZONE, - Token.ENCTYPE, - Token.FACE, - Token.FORMACTION, - Token.HEADERS, - Token.HIGH, - Token.HREF, - Token.HREFLANG, - Token.HTTP, - Token.EQUIV, - Token.ID, - Token.ISMAP, - Token.KIND, - Token.LANG, - Token.LIST, - Token.LOOP, - Token.LOW, - Token.MAX, - Token.MAXLENGTH, - Token.MEDIA, - Token.METHOD, - Token.MIN, - Token.MULTIPLE, - Token.MUTED, - Token.NAME, - Token.NOVALIDATE, - Token.ONABORT, - Token.ONAFTERPRINT, - Token.ONBEFOREPRINT, - Token.ONBEFOREUNLOAD, - Token.ONBLUR, - Token.ONCANPLAY, - Token.ONCANPLAYTHROUGH, - Token.ONCHANGE, - Token.ONCLICK, - Token.ONCONTEXTMENU, - Token.ONCOPY, - Token.ONCUECHANGE, - Token.ONCUT, - Token.ONDBLCLICK, - Token.ONDRAG, - Token.ONDRAGEND, - Token.ONDRAGENTER, - Token.ONDRAGLEAVE, - Token.ONDRAGOVER, - Token.ONDRAGSTART, - Token.ONDROP, - Token.ONDURATIONCHANGE, - Token.ONEMPTIED, - Token.ONENDED, - Token.ONERROR, - Token.ONFOCUS, - Token.ONHASHCHANGE, - Token.ONINPUT, - Token.ONINVALID, - Token.ONKEYDOWN, - Token.ONKEYPRESS, - Token.ONKEYUP, - Token.ONLOAD, - Token.ONLOADEDDATA, - Token.ONLOADEDMETADATA, - Token.ONLOADSTART, - Token.ONMOUSEDOWN, - Token.ONMOUSEMOVE, - Token.ONMOUSEOUT, - Token.ONMOUSEOVER, - Token.ONMOUSEUP, - Token.ONMOUSEWHEEL, - Token.ONOFFLINE, - Token.ONONLINE, - Token.ONPAGEHIDE, - Token.ONPAGESHOW, - Token.ONPASTE, - Token.ONPLAY, - Token.ONPLAYING, - Token.ONPOPSTATE, - Token.ONPROGRESS, - Token.ONRATECHANGE, - Token.ONRESET, - Token.ONRESIZE, - Token.ONSCROLL, - Token.ONSEARCH, - Token.ONSEEKED, - Token.ONSEEKING, - Token.ONSELECT, - Token.ONSTALLED, - Token.ONSTORAGE, - Token.ONSUBMIT, - Token.ONSUSPEND, - Token.ONTIMEUPDATE, - Token.ONTOGGLE, - Token.ONUNLOAD, - Token.ONVOLUMECHANGE, - Token.ONWAITING, - Token.ONWHEEL, - Token.OPEN, - Token.OPTIMUM, - Token.PLACEHOLDER, - Token.POSTER, - Token.PRELOAD, - Token.READONLY, - Token.REL, - Token.REQUIRED, - Token.REVERSED, - Token.ROWS, - Token.ROWSPAN, - Token.SANDBOX, - Token.SCOPE, - Token.SELECTED, - Token.SHAPE, - Token.SIZE, - Token.SIZES, - Token.SPELLCHECK, - Token.SRC, - Token.SRCDOC, - Token.SRCLANG, - Token.SRCSET, - Token.START, - Token.STEP, - Token.TABINDEX, - Token.TARGET, - Token.TRANSLATE, - Token.TYPE, - Token.USEMAP, - Token.VALUE, - Token.WRAP, - Token.AREA, - Token.BASE, - Token.BR, - Token.COL, - Token.EMBED, - Token.HR, - Token.IMG, - Token.INPUT, - Token.KEYGEN, - Token.LINK, - Token.PARAM, - Token.SOURCE, - Token.TRACK, - Token.WBR, - Token.PX, - Token.VIM, - Token.REM, - Token.VH, - Token.VW, - Token.PT, - Token.CM, - Token.MM, - Token.PC, - Token.EX, - Token.CH, - Token.DEG, - Token.GRAD, - Token.RAD, - Token.TURN, - Token.MS, - Token.FR, - Token.UNDERLINE, - Token.ITALIC, - Token.BOLD, - Token.NORMAL, - Token.RGBA, - Token.HSL, - Token.URL, - Token.NONE, - Token.BLOCK, - Token.INLINE, - Token.CELL, - Token.ROW, - Token.ABSOLUTE, - Token.RELATIVE, - Token.FIXED, - Token.COLLAPSE, - Token.VISIBLE, - Token.UPPERCASE, - Token.LOWERCASE, - Token.CAPITALIZE, - Token.SHRINK, - Token.REVERSE, - Token.NOWRAP, - Token.HORIZONTAL, - Token.VERTICAL, - Token.REPEAT, - Token.NO, - Token.RED, - Token.ALICEBLUE, - Token.ANTIQUEWHITE, - Token.AQUA, - Token.AQUAMARINE, - Token.AZURE, - Token.BEIGE, - Token.BISQUE, - Token.BLACK, - Token.BLANCHEDALMOND, - Token.BLUE, - Token.BLUEVIOLET, - Token.BROWN - }; - keywords = new TrieTree<>(); - css = new TrieTree<>(); - for (int i = 0; i < sKeywords.length; i++) { - keywords.put(sKeywords[i], sToken[i]); - } - } + public static TrieTree getcss() { + return css; + } - protected static boolean isDigit(char c) { - return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); + /* */ + protected static void doStaticInit() { + sKeywords = + new String[] { + "", + "/*", + "*/", + "a", + "abbr", + "acronym", + "address", + "applet", + "article", + "aside", + "audio", + "b", + "basefont", + "bdi", + "bdo", + "bgsound", + "big", + "blink", + "blockquote", + "body", + "button", + "canvas", + "caption", + "center", + "circle", + "clippath", + "code", + "colgroup", + "command", + "datalist", + "dd", + "defs", + "del", + "details", + "dfn", + "dialog", + "dir", + "div", + "dl", + "dt", + "element", + "ellipse", + "em", + "fieldset", + "figcaption", + "figure", + "footer", + "foreignobject", + "form", + "frame", + "frameset", + "g", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hgroup", + "html", + "i", + "iframe", + "image", + "ins", + "isindex", + "kbd", + "label", + "legend", + "li", + "line", + "lineargradient", + "listing", + "main", + "map", + "mark", + "marquee", + "mask", + "math", + "menu", + "menuitem", + "meter", + "multicol", + "nav", + "nextid", + "nobr", + "noembed", + "noframes", + "noscript", + "object", + "ol", + "optgroup", + "option", + "output", + "p", + "path", + "pattern", + "picture", + "plaintext", + "polygon", + "polyline", + "pre", + "progress", + "q", + "radialgradient", + "rb", + "rbc", + "rect", + "rp", + "rt", + "rtc", + "ruby", + "s", + "samp", + "script", + "section", + "select", + "shadow", + "slot", + "small", + "spacer", + "span", + "stop", + "strike", + "strong", + "style", + "nostyle", + "sub", + "summary", + "sup", + "svg", + "table", + "tbody", + "td", + "template", + "text", + "textarea", + "tfoot", + "th", + "thead", + "time", + "title", + "tr", + "tspan", + "tt", + "u", + "ul", + "video", + "xmp", + "class", + "meta", + "align_content", + "align_items", + "align_self", + "all", + "animation", + "animation_delay", + "animation_direction", + "animation_duration", + "animation_fill_mode", + "animation_iteration_count", + "animation_name", + "animation_play_state", + "animation_timing_function", + "backface_visibility", + "background", + "background_attachment", + "background_blur", + "background_clip", + "background_color", + "background_image", + "background_origin", + "background_position", + "background_repeat", + "background_size", + "border_bottom", + "border_bottom_color", + "border_bottom_left_radius", + "border_bottom_right_radius", + "border_bottom_style", + "border_bottom_width", + "border_collapse", + "border_color", + "border_image", + "border_image_outset", + "border_image_repeat", + "border_image_slice", + "border_image_source", + "border_image_width", + "border_left", + "border_left_color", + "border_left_style", + "border_left_width", + "border_radius", + "border_right", + "border_right_color", + "border_right_style", + "border_right_width", + "border_spacing", + "border_style", + "border_top", + "border_top_color", + "border_top_left_radius", + "border_top_right_radius", + "border_top_style", + "border_top_width", + "border_width", + "bottom", + "box_decoration_break", + "box_shadow", + "box_sizing", + "break_after", + "break_before", + "break_inside", + "caption_side", + "caret_color", + "clear", + "clip", + "color", + "column_count", + "column_fill", + "column_gap", + "column_rule", + "column_rule_color", + "column_rule_style", + "column_rule_width", + "column_span", + "column_width", + "columns", + "counter_increment", + "counter_reset", + "cursor", + "direction", + "display", + "empty_cells", + "filter", + "flex", + "flex_basis", + "flex_direction", + "flex_flow", + "flex_grow", + "flex_shrink", + "flex_wrap", + "font", + "font_family", + "font_size", + "font_size_adjust", + "font_stretch", + "font_style", + "font_variant", + "font_variant_caps", + "font_weight", + "gap", + "grid", + "grid_area", + "grid_auto_columns", + "grid_auto_flow", + "grid_auto_rows", + "grid_column", + "grid_column_end", + "grid_column_gap", + "grid_column_start", + "grid_gap", + "grid_row", + "grid_row_end", + "grid_row_gap", + "grid_row_start", + "grid_template", + "grid_template_areas", + "grid_template_columns", + "grid_template_rows", + "height", + "ime_mode", + "justify_content", + "left", + "letter_spacing", + "line_break", + "line_height", + "list_style", + "list_style_image", + "list_style_position", + "list_style_type", + "margin", + "margin_bottom", + "margin_left", + "margin_right", + "margin_top", + "marker_offset", + "max_height", + "max_width", + "min_height", + "min_width", + "mix_blend_mode", + "object_fit", + "object_position", + "opacity", + "order", + "orphans", + "outline", + "outline_color", + "outline_offset", + "outline_style", + "outline_width", + "overflow", + "overflow_wrap", + "overflow_x", + "overflow_y", + "padding", + "padding_bottom", + "padding_left", + "padding_right", + "padding_top", + "page_break_after", + "page_break_before", + "page_break_inside", + "perspective", + "perspective_origin", + "pointer_events", + "position", + "quotes", + "resize", + "right", + "row_gap", + "scroll_behavior", + "speak", + "table_layout", + "tab_size", + "text_align", + "text_align_last", + "text_decoration", + "text_decoration_color", + "text_decoration_line", + "text_decoration_skip", + "text_decoration_style", + "text_indent", + "text_justify", + "text_overflow", + "text_shadow", + "text_transform", + "text_underline_position", + "top", + "transform", + "transform_origin", + "transform_style", + "transition", + "transition_delay", + "transition_duration", + "transition_property", + "transition_timing_function", + "unicode_bidi", + "vertical_align", + "visibility", + "white_space", + "widows", + "width", + "will_change", + "word_break", + "word_spacing", + "word_wrap", + "writing_mode", + "z_index", + "abstract", + "else", + "instanceof", + "super", + "boolean", + "enum", + "int", + "switch", + "break", + "export", + "interface", + "synchronized", + "byte", + "extends", + "let", + "this", + "case", + "false", + "long", + "throw", + "catch", + "final", + "native", + "throws", + "char", + "finally", + "new", + "transient", + "float", + "null", + "true", + "const", + "for", + "package", + "try", + "continue", + "function", + "private", + "typeof", + "debugger", + "goto", + "protected", + "var", + "if", + "public", + "void", + "delete", + "implements", + "return", + "volatile", + "do", + "import", + "short", + "while", + "double", + "in", + "static", + "with", + "of", + "console", + "log", + "prototype", + "alert", + "support", + "yield", + "async", + "document", + "arguments", + "parseint", + "await", + "undefined", + "parsefloat", + "get", + "storage", + "infinity", + "escape", + "__count__", + "__parent__", + "__proto__", + "window", + "eval", + "getelementbyid", + "getelementbyclass", + "accept", + "accesskey", + "action", + "align", + "alt", + "autocomplete", + "autofocus", + "autoplay", + "border", + "bgcolor", + "charset", + "checked", + "cite", + "cols", + "colspan", + "content", + "contenteditable", + "controls", + "coords", + "data", + "datetime", + "default", + "defer", + "dirname", + "disabled", + "draggable", + "dropzone", + "enctype", + "face", + "formaction", + "headers", + "high", + "href", + "hreflang", + "http", + "equiv", + "id", + "ismap", + "kind", + "lang", + "list", + "loop", + "low", + "max", + "maxlength", + "media", + "method", + "min", + "multiple", + "muted", + "name", + "novalidate", + "onabort", + "onafterprint", + "onbeforeprint", + "onbeforeunload", + "onblur", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "oncontextmenu", + "oncopy", + "oncuechange", + "oncut", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "onhashchange", + "oninput", + "oninvalid", + "onkeydown", + "onkeypress", + "onkeyup", + "onload", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onmousedown", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onmousewheel", + "onoffline", + "ononline", + "onpagehide", + "onpageshow", + "onpaste", + "onplay", + "onplaying", + "onpopstate", + "onprogress", + "onratechange", + "onreset", + "onresize", + "onscroll", + "onsearch", + "onseeked", + "onseeking", + "onselect", + "onstalled", + "onstorage", + "onsubmit", + "onsuspend", + "ontimeupdate", + "ontoggle", + "onunload", + "onvolumechange", + "onwaiting", + "onwheel", + "open", + "optimum", + "placeholder", + "poster", + "preload", + "readonly", + "rel", + "required", + "reversed", + "rows", + "rowspan", + "sandbox", + "scope", + "selected", + "shape", + "size", + "sizes", + "spellcheck", + "src", + "srcdoc", + "srclang", + "srcset", + "start", + "step", + "tabindex", + "target", + "translate", + "type", + "usemap", + "value", + "wrap", + "area", + "base", + "br", + "col", + "embed", + "hr", + "img", + "input", + "keygen", + "link", + "param", + "source", + "track", + "wbr", + "px", + "vim", + "rem", + "vh", + "vw", + "pt", + "cm", + "mm", + "pc", + "ex", + "ch", + "deg", + "grad", + "rad", + "turn", + "ms", + "fr", + "underline", + "italic", + "bold", + "normal", + "rgba", + "hsl", + "url", + "none", + "block", + "inline", + "cell", + "row", + "absolute", + "relative", + "fixed", + "collapse", + "visible", + "uppercase", + "lowercase", + "capitalize", + "shrink", + "reverse", + "nowrap", + "horizontal", + "vertical", + "repeat", + "no", + "red", + "aliceblue", + "antiquewhite", + "aqua", + "aquamarine", + "azure", + "beige", + "bisque", + " black", + "blanchedalmond", + "blue", + "blueviolet", + "brown" + }; + Token[] sToken = + new Token[] { + Token.HTMLCOMMENTSTART, + Token.HTMLCOMMENTEND, + Token.CSSCOMMENTSTART, + Token.CSSCOMMENTEND, + Token.A, + Token.ABBR, + Token.ACRONYM, + Token.ADDRESS, + Token.APPLET, + Token.ARTICLE, + Token.ASIDE, + Token.AUDIO, + Token.B, + Token.BASEFONT, + Token.BDI, + Token.BDO, + Token.BGSOUND, + Token.BIG, + Token.BLINK, + Token.BLOCKQUOTE, + Token.BODY, + Token.BUTTON, + Token.CANVAS, + Token.CAPTION, + Token.CENTER, + Token.CIRCLE, + Token.CLIPPATH, + Token.CODE, + Token.COLGROUP, + Token.COMMAND, + Token.DATALIST, + Token.DD, + Token.DEFS, + Token.DEL, + Token.DETAILS, + Token.DFN, + Token.DIALOG, + Token.DIR, + Token.DIV, + Token.DL, + Token.DT, + Token.ELEMENT, + Token.ELLIPSE, + Token.EM, + Token.FIELDSET, + Token.FIGCAPTION, + Token.FIGURE, + Token.FOOTER, + Token.FOREIGNOBJECT, + Token.FORM, + Token.FRAME, + Token.FRAMESET, + Token.G, + Token.H1, + Token.H2, + Token.H3, + Token.H4, + Token.H5, + Token.H6, + Token.HEAD, + Token.HEADER, + Token.HGROUP, + Token.HTML, + Token.I, + Token.IFRAME, + Token.IMAGE, + Token.INS, + Token.ISINDEX, + Token.KBD, + Token.LABEL, + Token.LEGEND, + Token.LI, + Token.LINE, + Token.LINEARGRADIENT, + Token.LISTING, + Token.MAIN, + Token.MAP, + Token.MARK, + Token.MARQUEE, + Token.MASK, + Token.MATH, + Token.MENU, + Token.MENUITEM, + Token.METER, + Token.MULTICOL, + Token.NAV, + Token.NEXTID, + Token.NOBR, + Token.NOEMBED, + Token.NOFRAMES, + Token.NOSCRIPT, + Token.OBJECT, + Token.OL, + Token.OPTGROUP, + Token.OPTION, + Token.OUTPUT, + Token.P, + Token.PATH, + Token.PATTERN, + Token.PICTURE, + Token.PLAINTEXT, + Token.POLYGON, + Token.POLYLINE, + Token.PRE, + Token.PROGRESS, + Token.Q, + Token.RADIALGRADIENT, + Token.RB, + Token.RBC, + Token.RECT, + Token.RP, + Token.RT, + Token.RTC, + Token.RUBY, + Token.S, + Token.SAMP, + Token.SCRIPT, + Token.SECTION, + Token.SELECT, + Token.SHADOW, + Token.SLOT, + Token.SMALL, + Token.SPACER, + Token.SPAN, + Token.STOP, + Token.STRIKE, + Token.STRONG, + Token.STYLE, + Token.NOSTYLE, + Token.SUB, + Token.SUMMARY, + Token.SUP, + Token.SVG, + Token.TABLE, + Token.TBODY, + Token.TD, + Token.TEMPLATE, + Token.TEXT, + Token.TEXTAREA, + Token.TFOOT, + Token.TH, + Token.THEAD, + Token.TIME, + Token.TITLE, + Token.TR, + Token.TSPAN, + Token.TT, + Token.U, + Token.UL, + Token.VIDEO, + Token.XMP, + Token.CLASS, + Token.META, + Token.ALIGN_CONTENT, + Token.ALIGN_ITEMS, + Token.ALIGN_SELF, + Token.ALL, + Token.ANIMATION, + Token.ANIMATION_DELAY, + Token.ANIMATION_DIRECTION, + Token.ANIMATION_DURATION, + Token.ANIMATION_FILL_MODE, + Token.ANIMATION_ITERATION_COUNT, + Token.ANIMATION_NAME, + Token.ANIMATION_PLAY_STATE, + Token.ANIMATION_TIMING_FUNCTION, + Token.BACKFACE_VISIBILITY, + Token.BACKGROUND, + Token.BACKGROUND_ATTACHMENT, + Token.BACKGROUND_BLUR, + Token.BACKGROUND_CLIP, + Token.BACKGROUND_COLOR, + Token.BACKGROUND_IMAGE, + Token.BACKGROUND_ORIGIN, + Token.BACKGROUND_POSITION, + Token.BACKGROUND_REPEAT, + Token.BACKGROUND_SIZE, + Token.BORDER_BOTTOM, + Token.BORDER_BOTTOM_COLOR, + Token.BORDER_BOTTOM_LEFT_RADIUS, + Token.BORDER_BOTTOM_RIGHT_RADIUS, + Token.BORDER_BOTTOM_STYLE, + Token.BORDER_BOTTOM_WIDTH, + Token.BORDER_COLLAPSE, + Token.BORDER_COLOR, + Token.BORDER_IMAGE, + Token.BORDER_IMAGE_OUTSET, + Token.BORDER_IMAGE_REPEAT, + Token.BORDER_IMAGE_SLICE, + Token.BORDER_IMAGE_SOURCE, + Token.BORDER_IMAGE_WIDTH, + Token.BORDER_LEFT, + Token.BORDER_LEFT_COLOR, + Token.BORDER_LEFT_STYLE, + Token.BORDER_LEFT_WIDTH, + Token.BORDER_RADIUS, + Token.BORDER_RIGHT, + Token.BORDER_RIGHT_COLOR, + Token.BORDER_RIGHT_STYLE, + Token.BORDER_RIGHT_WIDTH, + Token.BORDER_SPACING, + Token.BORDER_STYLE, + Token.BORDER_TOP, + Token.BORDER_TOP_COLOR, + Token.BORDER_TOP_LEFT_RADIUS, + Token.BORDER_TOP_RIGHT_RADIUS, + Token.BORDER_TOP_STYLE, + Token.BORDER_TOP_WIDTH, + Token.BORDER_WIDTH, + Token.BOTTOM, + Token.BOX_DECORATION_BREAK, + Token.BOX_SHADOW, + Token.BOX_SIZING, + Token.BREAK_AFTER, + Token.BREAK_BEFORE, + Token.BREAK_INSIDE, + Token.CAPTION_SIDE, + Token.CARET_COLOR, + Token.CLEAR, + Token.CLIP, + Token.COLOR, + Token.COLUMN_COUNT, + Token.COLUMN_FILL, + Token.COLUMN_GAP, + Token.COLUMN_RULE, + Token.COLUMN_RULE_COLOR, + Token.COLUMN_RULE_STYLE, + Token.COLUMN_RULE_WIDTH, + Token.COLUMN_SPAN, + Token.COLUMN_WIDTH, + Token.COLUMNS, + Token.COUNTER_INCREMENT, + Token.COUNTER_RESET, + Token.CURSOR, + Token.DIRECTION, + Token.DISPLAY, + Token.EMPTY_CELLS, + Token.FILTER, + Token.FLEX, + Token.FLEX_BASIS, + Token.FLEX_DIRECTION, + Token.FLEX_FLOW, + Token.FLEX_GROW, + Token.FLEX_SHRINK, + Token.FLEX_WRAP, + Token.FONT, + Token.FONT_FAMILY, + Token.FONT_SIZE, + Token.FONT_SIZE_ADJUST, + Token.FONT_STRETCH, + Token.FONT_STYLE, + Token.FONT_VARIANT, + Token.FONT_VARIANT_CAPS, + Token.FONT_WEIGHT, + Token.GAP, + Token.GRID, + Token.GRID_AREA, + Token.GRID_AUTO_COLUMNS, + Token.GRID_AUTO_FLOW, + Token.GRID_AUTO_ROWS, + Token.GRID_COLUMN, + Token.GRID_COLUMN_END, + Token.GRID_COLUMN_GAP, + Token.GRID_COLUMN_START, + Token.GRID_GAP, + Token.GRID_ROW, + Token.GRID_ROW_END, + Token.GRID_ROW_GAP, + Token.GRID_ROW_START, + Token.GRID_TEMPLATE, + Token.GRID_TEMPLATE_AREAS, + Token.GRID_TEMPLATE_COLUMNS, + Token.GRID_TEMPLATE_ROWS, + Token.HEIGHT, + Token.IME_MODE, + Token.JUSTIFY_CONTENT, + Token.LEFT, + Token.LETTER_SPACING, + Token.LINE_BREAK, + Token.LINE_HEIGHT, + Token.LIST_STYLE, + Token.LIST_STYLE_IMAGE, + Token.LIST_STYLE_POSITION, + Token.LIST_STYLE_TYPE, + Token.MARGIN, + Token.MARGIN_BOTTOM, + Token.MARGIN_LEFT, + Token.MARGIN_RIGHT, + Token.MARGIN_TOP, + Token.MARKER_OFFSET, + Token.MAX_HEIGHT, + Token.MAX_WIDTH, + Token.MIN_HEIGHT, + Token.MIN_WIDTH, + Token.MIX_BLEND_MODE, + Token.OBJECT_FIT, + Token.OBJECT_POSITION, + Token.OPACITY, + Token.ORDER, + Token.ORPHANS, + Token.OUTLINE, + Token.OUTLINE_COLOR, + Token.OUTLINE_OFFSET, + Token.OUTLINE_STYLE, + Token.OUTLINE_WIDTH, + Token.OVERFLOW, + Token.OVERFLOW_WRAP, + Token.OVERFLOW_X, + Token.OVERFLOW_Y, + Token.PADDING, + Token.PADDING_BOTTOM, + Token.PADDING_LEFT, + Token.PADDING_RIGHT, + Token.PADDING_TOP, + Token.PAGE_BREAK_AFTER, + Token.PAGE_BREAK_BEFORE, + Token.PAGE_BREAK_INSIDE, + Token.PERSPECTIVE, + Token.PERSPECTIVE_ORIGIN, + Token.POINTER_EVENTS, + Token.POSITION, + Token.QUOTES, + Token.RESIZE, + Token.RIGHT, + Token.ROW_GAP, + Token.SCROLL_BEHAVIOR, + Token.SPEAK, + Token.TABLE_LAYOUT, + Token.TAB_SIZE, + Token.TEXT_ALIGN, + Token.TEXT_ALIGN_LAST, + Token.TEXT_DECORATION, + Token.TEXT_DECORATION_COLOR, + Token.TEXT_DECORATION_LINE, + Token.TEXT_DECORATION_SKIP, + Token.TEXT_DECORATION_STYLE, + Token.TEXT_INDENT, + Token.TEXT_JUSTIFY, + Token.TEXT_OVERFLOW, + Token.TEXT_SHADOW, + Token.TEXT_TRANSFORM, + Token.TEXT_UNDERLINE_POSITION, + Token.TOP, + Token.TRANSFORM, + Token.TRANSFORM_ORIGIN, + Token.TRANSFORM_STYLE, + Token.TRANSITION, + Token.TRANSITION_DELAY, + Token.TRANSITION_DURATION, + Token.TRANSITION_PROPERTY, + Token.TRANSITION_TIMING_FUNCTION, + Token.UNICODE_BIDI, + Token.VERTICAL_ALIGN, + Token.VISIBILITY, + Token.WHITE_SPACE, + Token.WIDOWS, + Token.WIDTH, + Token.WILL_CHANGE, + Token.WORD_BREAK, + Token.WORD_SPACING, + Token.WORD_WRAP, + Token.WRITING_MODE, + Token.Z_INDEX, + Token.ABSTRACT, + Token.ELSE, + Token.INSTANCEOF, + Token.SUPER, + Token.BOOLEAN, + Token.ENUM, + Token.INT, + Token.SWITCH, + Token.BREAK, + Token.EXPORT, + Token.INTERFACE, + Token.SYNCHRONIZED, + Token.BYTE, + Token.EXTENDS, + Token.LET, + Token.THIS, + Token.CASE, + Token.FALSE, + Token.LONG, + Token.THROW, + Token.CATCH, + Token.FINAL, + Token.NATIVE, + Token.THROWS, + Token.CHAR, + Token.FINALLY, + Token.NEW, + Token.TRANSIENT, + Token.FLOAT, + Token.NULL, + Token.TRUE, + Token.CONST, + Token.FOR, + Token.PACKAGE, + Token.TRY, + Token.CONTINUE, + Token.FUNCTION, + Token.PRIVATE, + Token.TYPEOF, + Token.DEBUGGER, + Token.GOTO, + Token.PROTECTED, + Token.VAR, + Token.IF, + Token.PUBLIC, + Token.VOID, + Token.DELETE, + Token.IMPLEMENTS, + Token.RETURN, + Token.VOLATILE, + Token.DO, + Token.IMPORT, + Token.SHORT, + Token.WHILE, + Token.DOUBLE, + Token.IN, + Token.STATIC, + Token.WITH, + Token.OF, + Token.CONSOLE, + Token.LOG, + Token.PROTOTYPE, + Token.ALERT, + Token.SUPPORT, + Token.YIELD, + Token.ASYNC, + Token.DOCUMENT, + Token.ARGUMENTS, + Token.PARSEINT, + Token.AWAIT, + Token.UNDEFINED, + Token.PARSEFLOAT, + Token.GET, + Token.STORAGE, + Token.INFINITY, + Token.ESCAPE, + Token.__COUNT__, + Token.__PARENT__, + Token.__PROTO__, + Token.WINDOW, + Token.EVAL, + Token.GETELEMENTBYID, + Token.GETELEMENTBYCLASS, + Token.ACCEPT, + Token.ACCESSKEY, + Token.ACTION, + Token.ALIGN, + Token.ALT, + Token.AUTOCOMPLETE, + Token.AUTOFOCUS, + Token.AUTOPLAY, + Token.BORDER, + Token.BGCOLOR, + Token.CHARSET, + Token.CHECKED, + Token.CITE, + Token.COLS, + Token.COLSPAN, + Token.CONTENT, + Token.CONTENTEDITABLE, + Token.CONTROLS, + Token.COORDS, + Token.DATA, + Token.DATETIME, + Token.DEFAULT, + Token.DEFER, + Token.DIRNAME, + Token.DISABLED, + Token.DRAGGABLE, + Token.DROPZONE, + Token.ENCTYPE, + Token.FACE, + Token.FORMACTION, + Token.HEADERS, + Token.HIGH, + Token.HREF, + Token.HREFLANG, + Token.HTTP, + Token.EQUIV, + Token.ID, + Token.ISMAP, + Token.KIND, + Token.LANG, + Token.LIST, + Token.LOOP, + Token.LOW, + Token.MAX, + Token.MAXLENGTH, + Token.MEDIA, + Token.METHOD, + Token.MIN, + Token.MULTIPLE, + Token.MUTED, + Token.NAME, + Token.NOVALIDATE, + Token.ONABORT, + Token.ONAFTERPRINT, + Token.ONBEFOREPRINT, + Token.ONBEFOREUNLOAD, + Token.ONBLUR, + Token.ONCANPLAY, + Token.ONCANPLAYTHROUGH, + Token.ONCHANGE, + Token.ONCLICK, + Token.ONCONTEXTMENU, + Token.ONCOPY, + Token.ONCUECHANGE, + Token.ONCUT, + Token.ONDBLCLICK, + Token.ONDRAG, + Token.ONDRAGEND, + Token.ONDRAGENTER, + Token.ONDRAGLEAVE, + Token.ONDRAGOVER, + Token.ONDRAGSTART, + Token.ONDROP, + Token.ONDURATIONCHANGE, + Token.ONEMPTIED, + Token.ONENDED, + Token.ONERROR, + Token.ONFOCUS, + Token.ONHASHCHANGE, + Token.ONINPUT, + Token.ONINVALID, + Token.ONKEYDOWN, + Token.ONKEYPRESS, + Token.ONKEYUP, + Token.ONLOAD, + Token.ONLOADEDDATA, + Token.ONLOADEDMETADATA, + Token.ONLOADSTART, + Token.ONMOUSEDOWN, + Token.ONMOUSEMOVE, + Token.ONMOUSEOUT, + Token.ONMOUSEOVER, + Token.ONMOUSEUP, + Token.ONMOUSEWHEEL, + Token.ONOFFLINE, + Token.ONONLINE, + Token.ONPAGEHIDE, + Token.ONPAGESHOW, + Token.ONPASTE, + Token.ONPLAY, + Token.ONPLAYING, + Token.ONPOPSTATE, + Token.ONPROGRESS, + Token.ONRATECHANGE, + Token.ONRESET, + Token.ONRESIZE, + Token.ONSCROLL, + Token.ONSEARCH, + Token.ONSEEKED, + Token.ONSEEKING, + Token.ONSELECT, + Token.ONSTALLED, + Token.ONSTORAGE, + Token.ONSUBMIT, + Token.ONSUSPEND, + Token.ONTIMEUPDATE, + Token.ONTOGGLE, + Token.ONUNLOAD, + Token.ONVOLUMECHANGE, + Token.ONWAITING, + Token.ONWHEEL, + Token.OPEN, + Token.OPTIMUM, + Token.PLACEHOLDER, + Token.POSTER, + Token.PRELOAD, + Token.READONLY, + Token.REL, + Token.REQUIRED, + Token.REVERSED, + Token.ROWS, + Token.ROWSPAN, + Token.SANDBOX, + Token.SCOPE, + Token.SELECTED, + Token.SHAPE, + Token.SIZE, + Token.SIZES, + Token.SPELLCHECK, + Token.SRC, + Token.SRCDOC, + Token.SRCLANG, + Token.SRCSET, + Token.START, + Token.STEP, + Token.TABINDEX, + Token.TARGET, + Token.TRANSLATE, + Token.TYPE, + Token.USEMAP, + Token.VALUE, + Token.WRAP, + Token.AREA, + Token.BASE, + Token.BR, + Token.COL, + Token.EMBED, + Token.HR, + Token.IMG, + Token.INPUT, + Token.KEYGEN, + Token.LINK, + Token.PARAM, + Token.SOURCE, + Token.TRACK, + Token.WBR, + Token.PX, + Token.VIM, + Token.REM, + Token.VH, + Token.VW, + Token.PT, + Token.CM, + Token.MM, + Token.PC, + Token.EX, + Token.CH, + Token.DEG, + Token.GRAD, + Token.RAD, + Token.TURN, + Token.MS, + Token.FR, + Token.UNDERLINE, + Token.ITALIC, + Token.BOLD, + Token.NORMAL, + Token.RGBA, + Token.HSL, + Token.URL, + Token.NONE, + Token.BLOCK, + Token.INLINE, + Token.CELL, + Token.ROW, + Token.ABSOLUTE, + Token.RELATIVE, + Token.FIXED, + Token.COLLAPSE, + Token.VISIBLE, + Token.UPPERCASE, + Token.LOWERCASE, + Token.CAPITALIZE, + Token.SHRINK, + Token.REVERSE, + Token.NOWRAP, + Token.HORIZONTAL, + Token.VERTICAL, + Token.REPEAT, + Token.NO, + Token.RED, + Token.ALICEBLUE, + Token.ANTIQUEWHITE, + Token.AQUA, + Token.AQUAMARINE, + Token.AZURE, + Token.BEIGE, + Token.BISQUE, + Token.BLACK, + Token.BLANCHEDALMOND, + Token.BLUE, + Token.BLUEVIOLET, + Token.BROWN + }; + keywords = new TrieTree<>(); + css = new TrieTree<>(); + for (int i = 0; i < sKeywords.length; i++) { + keywords.put(sKeywords[i], sToken[i]); } + } - protected static boolean isPrimeDigit(char c) { - return (c >= '0' && c <= '9'); - } + protected static boolean isDigit(char c) { + return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); + } - protected static boolean isWhitespace(char c) { - return (c == '\t' || c == ' ' || c == '\f' || c == '\n' || c == '\r'); - } + protected static boolean isPrimeDigit(char c) { + return (c >= '0' && c <= '9'); + } - private void init() { - line = 0; - column = 0; - length = 0; - index = 0; - currToken = Token.WHITESPACE; - lcCal = false; - skipWS = false; - skipComment = false; - this.bufferLen = source.length(); - } + protected static boolean isWhitespace(char c) { + return (c == '\t' || c == ' ' || c == '\f' || c == '\n' || c == '\r'); + } - public void setCalculateLineColumn(boolean cal) { - this.lcCal = cal; - } + private void init() { + line = 0; + column = 0; + length = 0; + index = 0; + currToken = Token.WHITESPACE; + lcCal = false; + skipWS = false; + skipComment = false; + this.bufferLen = source.length(); + } - public void setSkipWhitespace(boolean skip) { - this.skipWS = skip; - } + public void setCalculateLineColumn(boolean cal) { + this.lcCal = cal; + } - public void setSkipComment(boolean skip) { - this.skipComment = skip; - } + public void setSkipWhitespace(boolean skip) { + this.skipWS = skip; + } - public void pushBack(int length) { - if (length > getTokenLength()) { - throw new IllegalArgumentException("pushBack length too large"); - } - this.length -= length; - } + public void setSkipComment(boolean skip) { + this.skipComment = skip; + } - private boolean isIdentifierPart(char ch) { - return MyCharacter.isJavaIdentifierPart(ch); + public void pushBack(int length) { + if (length > getTokenLength()) { + throw new IllegalArgumentException("pushBack length too large"); } + this.length -= length; + } - private boolean isIdentifierStart(char ch) { - return MyCharacter.isJavaIdentifierStart(ch); - } + private boolean isIdentifierPart(char ch) { + return MyCharacter.isJavaIdentifierPart(ch); + } - public CharSequence getTokentring() { - return source.subSequence(offset, offset + length); - } + private boolean isIdentifierStart(char ch) { + return MyCharacter.isJavaIdentifierStart(ch); + } - public int getTokenLength() { - return length; - } + public CharSequence getTokentring() { + return source.subSequence(offset, offset + length); + } - public int getLine() { - return line; - } + public int getTokenLength() { + return length; + } - public int getColumn() { - return column; - } + public int getLine() { + return line; + } - public int getIndex() { - return index; - } + public int getColumn() { + return column; + } - public Token getToken() { - return currToken; - } + public int getIndex() { + return index; + } - public String yyDesc() { - return " Line:" + line + " Column:" + column; - } + public Token getToken() { + return currToken; + } - private char charAt(int i) { - return source.charAt(i); - } + public String yyDesc() { + return " Line:" + line + " Column:" + column; + } - private char charAt() { - return source.charAt(offset + length); - } + private char charAt(int i) { + return source.charAt(i); + } - public Token nextToken() { - Token token; - do { - token = directNextToken(); - } while ((skipWS && token == Token.WHITESPACE) - || (skipComment && (token == Token.LINE_COMMENT || token == Token.LONG_COMMENT))); - currToken = token; - return token; - } + private char charAt() { + return source.charAt(offset + length); + } - public int getOffset() { - return offset; - } + public Token nextToken() { + Token token; + do { + token = directNextToken(); + } while ((skipWS && token == Token.WHITESPACE) + || (skipComment && (token == Token.LINE_COMMENT || token == Token.LONG_COMMENT))); + currToken = token; + return token; + } - public Token directNextToken() { - if (lcCal) { - boolean r = false; - for (int i = offset; i < offset + length; i++) { - char ch = charAt(i); - if (ch == '\r') { - r = true; - line++; - column = 0; - } else if (ch == '\n') { - if (r) { - r = false; - continue; - } - line++; - column = 0; - } else { - r = false; - column++; - } - } + public int getOffset() { + return offset; + } + + public Token directNextToken() { + if (lcCal) { + boolean r = false; + for (int i = offset; i < offset + length; i++) { + char ch = charAt(i); + if (ch == '\r') { + r = true; + line++; + column = 0; + } else if (ch == '\n') { + if (r) { + r = false; + continue; + } + line++; + column = 0; + } else { + r = false; + column++; } - index = index + length; - offset = offset + length; - if (offset == bufferLen) { - return Token.EOF; + } + } + index = index + length; + offset = offset + length; + if (offset == bufferLen) { + return Token.EOF; + } + char ch = source.charAt(offset); + length = 1; + if (ch == '\n') { + return Token.NEWLINE; + } else if (ch == '\r') { + scanNewline(); + return Token.NEWLINE; + } else if (isWhitespace(ch)) { + char chLocal; + while (offset + length < bufferLen && isWhitespace(chLocal = charAt(offset + length))) { + if (chLocal == '\r' || chLocal == '\n') { + break; } - char ch = source.charAt(offset); - length = 1; - if (ch == '\n') { - return Token.NEWLINE; - } else if (ch == '\r') { - scanNewline(); - return Token.NEWLINE; - } else if (isWhitespace(ch)) { - char chLocal; - while (offset + length < bufferLen && isWhitespace(chLocal = charAt(offset + length))) { - if (chLocal == '\r' || chLocal == '\n') { - break; - } - length++; - } - return Token.WHITESPACE; - } else { - if (isIdentifierStart(ch)) { - return scanIdentifier(ch); - } - if (isPrimeDigit(ch)) { - return scanNumber(); - } - /* Scan usual symbols first */ - if (ch == ';') { - return Token.SEMICOLON; - } else if (ch == '(') { - return Token.LPAREN; - } else if (ch == ')') { - return Token.RPAREN; - } else if (ch == ':') { - return Token.COLON; - } else if (ch == '<') { - return scanLT(); - } else if (ch == '>') { - return scanGT(); - } - /* Scan secondly symbols */ - if (source.toString().contains("') { + return scanGT(); + } + /* Scan secondly symbols */ + if (source.toString().contains(" n = keywords.root.map.get(ch); - while (offset + length < bufferLen && isIdentifierPart(ch = charAt(offset + length))) { - length++; - n = n == null ? null : n.map.get(ch); - } //n.token - return n == null ? Token.IDENTIFIER : (n.token == null ? Token.IDENTIFIER : n.token); - } + protected Token scanIdentifier(char ch) { + TrieTree.Node n = keywords.root.map.get(ch); + while (offset + length < bufferLen && isIdentifierPart(ch = charAt(offset + length))) { + length++; + n = n == null ? null : n.map.get(ch); + } // n.token + return n == null ? Token.IDENTIFIER : (n.token == null ? Token.IDENTIFIER : n.token); + } - protected void scanTrans() { + protected void scanTrans() { + throwIfNeeded(); + char ch = charAt(); + if (ch == '\\' + || ch == 't' + || ch == 'f' + || ch == 'n' + || ch == 'r' + || ch == '0' + || ch == '\"' + || ch == '\'' + || ch == 'b') { + length++; + } else if (ch == 'u') { + length++; + for (int i = 0; i < 4; i++) { throwIfNeeded(); - char ch = charAt(); - if (ch == '\\' - || ch == 't' - || ch == 'f' - || ch == 'n' - || ch == 'r' - || ch == '0' - || ch == '\"' - || ch == '\'' - || ch == 'b') { - length++; - } else if (ch == 'u') { - length++; - for (int i = 0; i < 4; i++) { - throwIfNeeded(); - if (!isDigit(charAt(offset + length))) { - return; - } - length++; - } + if (!isDigit(charAt(offset + length))) { + return; } + length++; + } } + } - protected void scanStringLiteral() { - throwIfNeeded(); - char ch; - while (offset + length < bufferLen && (ch = charAt(offset + length)) != '\"') { - if (ch == '\\') { - length++; - scanTrans(); - } else { - if (ch == '\n') { + protected void scanStringLiteral() { + throwIfNeeded(); + char ch; + while (offset + length < bufferLen && (ch = charAt(offset + length)) != '\"') { + if (ch == '\\') { + length++; + scanTrans(); + } else { + if (ch == '\n') { - return; - } - length++; - throwIfNeeded(); - } - } - if (offset + length != bufferLen) { - length++; + return; } + length++; + throwIfNeeded(); + } + } + if (offset + length != bufferLen) { + length++; } + } - protected void scanCharLiteral() { - throwIfNeeded(); - char ch = charAt(); - if (ch == '\\') { - length++; - scanTrans(); - } else if (ch == '\'') { - length++; - return; - } else { - if (ch == '\n') { - return; - } - length++; - } - throwIfNeeded(); - if (charAt() == '\'') { - length++; - } + protected void scanCharLiteral() { + throwIfNeeded(); + char ch = charAt(); + if (ch == '\\') { + length++; + scanTrans(); + } else if (ch == '\'') { + length++; + return; + } else { + if (ch == '\n') { + return; + } + length++; + } + throwIfNeeded(); + if (charAt() == '\'') { + length++; } + } - protected Token scanNumber() { - if (offset + length == bufferLen) { - return Token.INTEGER_LITERAL; - } - boolean flag = false; - char ch = charAt(offset); - if (ch == '0') { - if (charAt() == 'x') { - length++; - } - flag = true; + protected Token scanNumber() { + if (offset + length == bufferLen) { + return Token.INTEGER_LITERAL; + } + boolean flag = false; + char ch = charAt(offset); + if (ch == '0') { + if (charAt() == 'x') { + length++; + } + flag = true; + } + while (offset + length < bufferLen && isDigit(charAt())) { + length++; + } + if (offset + length == bufferLen) { + return Token.INTEGER_LITERAL; + } + ch = charAt(); + if (ch == '.') { + if (flag) { + return Token.INTEGER_LITERAL; + } + if (offset + length + 1 == bufferLen) { + return Token.INTEGER_LITERAL; + } + length++; + throwIfNeeded(); + while (offset + length < bufferLen && isDigit(charAt())) { + length++; + } + if (offset + length == bufferLen) { + return Token.FLOATING_POINT_LITERAL; + } + ch = charAt(); + if (ch == 'e' || ch == 'E') { + length++; + throwIfNeeded(); + if (charAt() == '-' || charAt() == '+') { + length++; + throwIfNeeded(); } - while (offset + length < bufferLen && isDigit(charAt())) { - length++; + while (offset + length < bufferLen && isPrimeDigit(charAt())) { + length++; } if (offset + length == bufferLen) { - return Token.INTEGER_LITERAL; + return Token.FLOATING_POINT_LITERAL; } ch = charAt(); - if (ch == '.') { - if (flag) { - return Token.INTEGER_LITERAL; - } - if (offset + length + 1 == bufferLen) { - return Token.INTEGER_LITERAL; - } - length++; - throwIfNeeded(); - while (offset + length < bufferLen && isDigit(charAt())) { - length++; - } - if (offset + length == bufferLen) { - return Token.FLOATING_POINT_LITERAL; - } - ch = charAt(); - if (ch == 'e' || ch == 'E') { - length++; - throwIfNeeded(); - if (charAt() == '-' || charAt() == '+') { - length++; - throwIfNeeded(); - } - while (offset + length < bufferLen && isPrimeDigit(charAt())) { - length++; - } - if (offset + length == bufferLen) { - return Token.FLOATING_POINT_LITERAL; - } - ch = charAt(); - } - if (ch == 'f' || ch == 'F' || ch == 'D' || ch == 'd') { - length++; - } - return Token.FLOATING_POINT_LITERAL; - } else if (ch == 'l' || ch == 'L') { - length++; - return Token.INTEGER_LITERAL; - } else if (ch == 'F' || ch == 'f' || ch == 'D' || ch == 'd') { - length++; - return Token.FLOATING_POINT_LITERAL; - } else { - return Token.INTEGER_LITERAL; - } + } + if (ch == 'f' || ch == 'F' || ch == 'D' || ch == 'd') { + length++; + } + return Token.FLOATING_POINT_LITERAL; + } else if (ch == 'l' || ch == 'L') { + length++; + return Token.INTEGER_LITERAL; + } else if (ch == 'F' || ch == 'f' || ch == 'D' || ch == 'd') { + length++; + return Token.FLOATING_POINT_LITERAL; + } else { + return Token.INTEGER_LITERAL; } + } - protected Token scanDIV() { - if (offset + 1 == bufferLen) { - return Token.DIVS; - } - char ch = charAt(); - if (ch == '<') { - length++; - while (offset + length < bufferLen && charAt() != '\n') { - length++; - } - return Token.LINE_COMMENT; - } else if (ch == '!' && ch == '-' && ch == '-') { - length++; - char pre, curr = '?'; - while (offset + length < bufferLen) { - pre = curr; - curr = charAt(); - if (curr == '<' && pre == '-') { - length++; - break; - } - length++; - } - return Token.LONG_COMMENT; - } else { - return Token.DIVS; + protected Token scanDIV() { + if (offset + 1 == bufferLen) { + return Token.DIVS; + } + char ch = charAt(); + if (ch == '<') { + length++; + while (offset + length < bufferLen && charAt() != '\n') { + length++; + } + return Token.LINE_COMMENT; + } else if (ch == '!' && ch == '-' && ch == '-') { + length++; + char pre, curr = '?'; + while (offset + length < bufferLen) { + pre = curr; + curr = charAt(); + if (curr == '<' && pre == '-') { + length++; + break; } + length++; + } + return Token.LONG_COMMENT; + } else { + return Token.DIVS; } + } - @SuppressWarnings("SameReturnValue") - protected Token scanLT() { - return Token.LT; - } + @SuppressWarnings("SameReturnValue") + protected Token scanLT() { + return Token.LT; + } - @SuppressWarnings("SameReturnValue") - protected Token scanGT() { - return Token.GT; - } + @SuppressWarnings("SameReturnValue") + protected Token scanGT() { + return Token.GT; + } - protected Token scanOperatorTwo(Token ifWrong) { - return ifWrong; - } + protected Token scanOperatorTwo(Token ifWrong) { + return ifWrong; + } - public void reset(CharSequence src) { - if (src == null) { - throw new IllegalArgumentException(); - } - this.source = src; - line = 0; - column = 0; - length = 0; - index = 0; - offset = 0; - currToken = Token.WHITESPACE; - bufferLen = src.length(); + public void reset(CharSequence src) { + if (src == null) { + throw new IllegalArgumentException(); } + this.source = src; + line = 0; + column = 0; + length = 0; + index = 0; + offset = 0; + currToken = Token.WHITESPACE; + bufferLen = src.length(); + } }