diff --git a/lexers/build.gradle b/lexers/build.gradle index a36aa55ba..38c6ef17a 100755 --- a/lexers/build.gradle +++ b/lexers/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' android { compileSdkVersion rootProject.ext.compileSdk @@ -14,6 +15,10 @@ android { targetCompatibility rootProject.ext.javaTargetVersion } + kotlinOptions { + jvmTarget = "11" + } + buildTypes { release { minifyEnabled true @@ -23,6 +28,12 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - api common.antlr4 + + implementation androidx.ktx + implementation common.kotlin + + testImplementation tests.junit + testImplementation tests.google_truth + testImplementation tests.robolectric } diff --git a/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.interp b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.interp new file mode 100644 index 000000000..df1aa4837 --- /dev/null +++ b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.interp @@ -0,0 +1,97 @@ +token literal names: +null +':' +'!' +'-' +null +null +null +null +null +null +null +null +'<' +'' +null +'/>' +'/' +'=' +null +null +null +null + +token symbolic names: +null +COLON +NOT +DASH +COMMENT_START +COMMENT_END +COMMENT +CDATA +DTD +EntityRef +CharRef +SEA_WS +OPEN +OPEN_SLASH +XMLDeclOpen +TEXT +CLOSE +SPECIAL_CLOSE +SLASH_CLOSE +SLASH +EQUALS +STRING +Name +S +PI + +rule names: +COLON +NOT +DASH +COMMENT_START +COMMENT_END +COMMENT +CDATA +DTD +EntityRef +CharRef +SEA_WS +OPEN +OPEN_SLASH +XMLDeclOpen +SPECIAL_OPEN +TEXT +CLOSE +SPECIAL_CLOSE +SLASH_CLOSE +SLASH +EQUALS +STRING +Name +S +HEXDIGIT +DIGIT +NameChar +NameStartChar +PI +IGNORE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +INSIDE +PROC_INSTR + +atn: +[4, 0, 24, 257, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 5, 5, 81, 8, 5, 10, 5, 12, 5, 84, 9, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 99, 8, 6, 10, 6, 12, 6, 102, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 112, 8, 7, 10, 7, 12, 7, 115, 9, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 4, 9, 129, 8, 9, 11, 9, 12, 9, 130, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 4, 9, 140, 8, 9, 11, 9, 12, 9, 141, 1, 9, 1, 9, 3, 9, 146, 8, 9, 1, 10, 1, 10, 3, 10, 150, 8, 10, 1, 10, 4, 10, 153, 8, 10, 11, 10, 12, 10, 154, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 4, 15, 185, 8, 15, 11, 15, 12, 15, 186, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 5, 21, 209, 8, 21, 10, 21, 12, 21, 212, 9, 21, 1, 21, 1, 21, 1, 21, 5, 21, 217, 8, 21, 10, 21, 12, 21, 220, 9, 21, 1, 21, 3, 21, 223, 8, 21, 1, 22, 1, 22, 5, 22, 227, 8, 22, 10, 22, 12, 22, 230, 9, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 244, 8, 26, 1, 27, 3, 27, 247, 8, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 3, 82, 100, 113, 0, 30, 3, 1, 5, 2, 7, 3, 9, 4, 11, 5, 13, 6, 15, 7, 17, 8, 19, 9, 21, 10, 23, 11, 25, 12, 27, 13, 29, 14, 31, 0, 33, 15, 35, 16, 37, 17, 39, 18, 41, 19, 43, 20, 45, 21, 47, 22, 49, 23, 51, 0, 53, 0, 55, 0, 57, 0, 59, 24, 61, 0, 3, 0, 1, 2, 10, 2, 0, 9, 9, 32, 32, 2, 0, 38, 38, 60, 60, 2, 0, 34, 34, 60, 60, 2, 0, 39, 39, 60, 60, 3, 0, 9, 10, 13, 13, 32, 32, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 2, 0, 45, 46, 95, 95, 3, 0, 183, 183, 768, 879, 8255, 8256, 8, 0, 58, 58, 65, 90, 97, 122, 8304, 8591, 11264, 12271, 12289, 55295, 63744, 64975, 65008, 65533, 267, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 1, 35, 1, 0, 0, 0, 1, 37, 1, 0, 0, 0, 1, 39, 1, 0, 0, 0, 1, 41, 1, 0, 0, 0, 1, 43, 1, 0, 0, 0, 1, 45, 1, 0, 0, 0, 1, 47, 1, 0, 0, 0, 1, 49, 1, 0, 0, 0, 2, 59, 1, 0, 0, 0, 2, 61, 1, 0, 0, 0, 3, 63, 1, 0, 0, 0, 5, 65, 1, 0, 0, 0, 7, 67, 1, 0, 0, 0, 9, 69, 1, 0, 0, 0, 11, 74, 1, 0, 0, 0, 13, 78, 1, 0, 0, 0, 15, 87, 1, 0, 0, 0, 17, 107, 1, 0, 0, 0, 19, 120, 1, 0, 0, 0, 21, 145, 1, 0, 0, 0, 23, 152, 1, 0, 0, 0, 25, 156, 1, 0, 0, 0, 27, 160, 1, 0, 0, 0, 29, 165, 1, 0, 0, 0, 31, 175, 1, 0, 0, 0, 33, 184, 1, 0, 0, 0, 35, 188, 1, 0, 0, 0, 37, 192, 1, 0, 0, 0, 39, 197, 1, 0, 0, 0, 41, 202, 1, 0, 0, 0, 43, 204, 1, 0, 0, 0, 45, 222, 1, 0, 0, 0, 47, 224, 1, 0, 0, 0, 49, 231, 1, 0, 0, 0, 51, 235, 1, 0, 0, 0, 53, 237, 1, 0, 0, 0, 55, 243, 1, 0, 0, 0, 57, 246, 1, 0, 0, 0, 59, 248, 1, 0, 0, 0, 61, 253, 1, 0, 0, 0, 63, 64, 5, 58, 0, 0, 64, 4, 1, 0, 0, 0, 65, 66, 5, 33, 0, 0, 66, 6, 1, 0, 0, 0, 67, 68, 5, 45, 0, 0, 68, 8, 1, 0, 0, 0, 69, 70, 5, 60, 0, 0, 70, 71, 3, 5, 1, 0, 71, 72, 3, 7, 2, 0, 72, 73, 3, 7, 2, 0, 73, 10, 1, 0, 0, 0, 74, 75, 3, 7, 2, 0, 75, 76, 3, 7, 2, 0, 76, 77, 5, 62, 0, 0, 77, 12, 1, 0, 0, 0, 78, 82, 3, 9, 3, 0, 79, 81, 9, 0, 0, 0, 80, 79, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 85, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 86, 3, 11, 4, 0, 86, 14, 1, 0, 0, 0, 87, 88, 5, 60, 0, 0, 88, 89, 5, 33, 0, 0, 89, 90, 5, 91, 0, 0, 90, 91, 5, 67, 0, 0, 91, 92, 5, 68, 0, 0, 92, 93, 5, 65, 0, 0, 93, 94, 5, 84, 0, 0, 94, 95, 5, 65, 0, 0, 95, 96, 5, 91, 0, 0, 96, 100, 1, 0, 0, 0, 97, 99, 9, 0, 0, 0, 98, 97, 1, 0, 0, 0, 99, 102, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 101, 103, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 103, 104, 5, 93, 0, 0, 104, 105, 5, 93, 0, 0, 105, 106, 5, 62, 0, 0, 106, 16, 1, 0, 0, 0, 107, 108, 5, 60, 0, 0, 108, 109, 5, 33, 0, 0, 109, 113, 1, 0, 0, 0, 110, 112, 9, 0, 0, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 62, 0, 0, 117, 118, 1, 0, 0, 0, 118, 119, 6, 7, 0, 0, 119, 18, 1, 0, 0, 0, 120, 121, 5, 38, 0, 0, 121, 122, 3, 47, 22, 0, 122, 123, 5, 59, 0, 0, 123, 20, 1, 0, 0, 0, 124, 125, 5, 38, 0, 0, 125, 126, 5, 35, 0, 0, 126, 128, 1, 0, 0, 0, 127, 129, 3, 53, 25, 0, 128, 127, 1, 0, 0, 0, 129, 130, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 5, 59, 0, 0, 133, 146, 1, 0, 0, 0, 134, 135, 5, 38, 0, 0, 135, 136, 5, 35, 0, 0, 136, 137, 5, 120, 0, 0, 137, 139, 1, 0, 0, 0, 138, 140, 3, 51, 24, 0, 139, 138, 1, 0, 0, 0, 140, 141, 1, 0, 0, 0, 141, 139, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 144, 5, 59, 0, 0, 144, 146, 1, 0, 0, 0, 145, 124, 1, 0, 0, 0, 145, 134, 1, 0, 0, 0, 146, 22, 1, 0, 0, 0, 147, 153, 7, 0, 0, 0, 148, 150, 5, 13, 0, 0, 149, 148, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 153, 5, 10, 0, 0, 152, 147, 1, 0, 0, 0, 152, 149, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 24, 1, 0, 0, 0, 156, 157, 5, 60, 0, 0, 157, 158, 1, 0, 0, 0, 158, 159, 6, 11, 1, 0, 159, 26, 1, 0, 0, 0, 160, 161, 5, 60, 0, 0, 161, 162, 5, 47, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 6, 12, 1, 0, 164, 28, 1, 0, 0, 0, 165, 166, 5, 60, 0, 0, 166, 167, 5, 63, 0, 0, 167, 168, 5, 120, 0, 0, 168, 169, 5, 109, 0, 0, 169, 170, 5, 108, 0, 0, 170, 171, 1, 0, 0, 0, 171, 172, 3, 49, 23, 0, 172, 173, 1, 0, 0, 0, 173, 174, 6, 13, 1, 0, 174, 30, 1, 0, 0, 0, 175, 176, 5, 60, 0, 0, 176, 177, 5, 63, 0, 0, 177, 178, 1, 0, 0, 0, 178, 179, 3, 47, 22, 0, 179, 180, 1, 0, 0, 0, 180, 181, 6, 14, 2, 0, 181, 182, 6, 14, 3, 0, 182, 32, 1, 0, 0, 0, 183, 185, 8, 1, 0, 0, 184, 183, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 34, 1, 0, 0, 0, 188, 189, 5, 62, 0, 0, 189, 190, 1, 0, 0, 0, 190, 191, 6, 16, 4, 0, 191, 36, 1, 0, 0, 0, 192, 193, 5, 63, 0, 0, 193, 194, 5, 62, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 6, 17, 4, 0, 196, 38, 1, 0, 0, 0, 197, 198, 5, 47, 0, 0, 198, 199, 5, 62, 0, 0, 199, 200, 1, 0, 0, 0, 200, 201, 6, 18, 4, 0, 201, 40, 1, 0, 0, 0, 202, 203, 5, 47, 0, 0, 203, 42, 1, 0, 0, 0, 204, 205, 5, 61, 0, 0, 205, 44, 1, 0, 0, 0, 206, 210, 5, 34, 0, 0, 207, 209, 8, 2, 0, 0, 208, 207, 1, 0, 0, 0, 209, 212, 1, 0, 0, 0, 210, 208, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 213, 1, 0, 0, 0, 212, 210, 1, 0, 0, 0, 213, 223, 5, 34, 0, 0, 214, 218, 5, 39, 0, 0, 215, 217, 8, 3, 0, 0, 216, 215, 1, 0, 0, 0, 217, 220, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 221, 1, 0, 0, 0, 220, 218, 1, 0, 0, 0, 221, 223, 5, 39, 0, 0, 222, 206, 1, 0, 0, 0, 222, 214, 1, 0, 0, 0, 223, 46, 1, 0, 0, 0, 224, 228, 3, 57, 27, 0, 225, 227, 3, 55, 26, 0, 226, 225, 1, 0, 0, 0, 227, 230, 1, 0, 0, 0, 228, 226, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 48, 1, 0, 0, 0, 230, 228, 1, 0, 0, 0, 231, 232, 7, 4, 0, 0, 232, 233, 1, 0, 0, 0, 233, 234, 6, 23, 0, 0, 234, 50, 1, 0, 0, 0, 235, 236, 7, 5, 0, 0, 236, 52, 1, 0, 0, 0, 237, 238, 7, 6, 0, 0, 238, 54, 1, 0, 0, 0, 239, 244, 3, 57, 27, 0, 240, 244, 7, 7, 0, 0, 241, 244, 3, 53, 25, 0, 242, 244, 7, 8, 0, 0, 243, 239, 1, 0, 0, 0, 243, 240, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 242, 1, 0, 0, 0, 244, 56, 1, 0, 0, 0, 245, 247, 7, 9, 0, 0, 246, 245, 1, 0, 0, 0, 247, 58, 1, 0, 0, 0, 248, 249, 5, 63, 0, 0, 249, 250, 5, 62, 0, 0, 250, 251, 1, 0, 0, 0, 251, 252, 6, 28, 4, 0, 252, 60, 1, 0, 0, 0, 253, 254, 9, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 256, 6, 29, 2, 0, 256, 62, 1, 0, 0, 0, 19, 0, 1, 2, 82, 100, 113, 130, 141, 145, 149, 152, 154, 186, 210, 218, 222, 228, 243, 246, 5, 6, 0, 0, 5, 1, 0, 3, 0, 0, 5, 2, 0, 4, 0, 0] \ No newline at end of file diff --git a/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.java b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.java new file mode 100644 index 000000000..72393ae30 --- /dev/null +++ b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.java @@ -0,0 +1,294 @@ +// Generated from /home/itsaky/Projects/Android/AndroidIDE/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.g4 by ANTLR 4.10.1 +package com.itsaky.androidide.lexers.xml; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class XMLLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.10.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + COLON=1, NOT=2, DASH=3, COMMENT_START=4, COMMENT_END=5, COMMENT=6, CDATA=7, + DTD=8, EntityRef=9, CharRef=10, SEA_WS=11, OPEN=12, OPEN_SLASH=13, XMLDeclOpen=14, + TEXT=15, CLOSE=16, SPECIAL_CLOSE=17, SLASH_CLOSE=18, SLASH=19, EQUALS=20, + STRING=21, Name=22, S=23, PI=24; + public static final int + INSIDE=1, PROC_INSTR=2; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE", "INSIDE", "PROC_INSTR" + }; + + private static String[] makeRuleNames() { + return new String[] { + "COLON", "NOT", "DASH", "COMMENT_START", "COMMENT_END", "COMMENT", "CDATA", + "DTD", "EntityRef", "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", "XMLDeclOpen", + "SPECIAL_OPEN", "TEXT", "CLOSE", "SPECIAL_CLOSE", "SLASH_CLOSE", "SLASH", + "EQUALS", "STRING", "Name", "S", "HEXDIGIT", "DIGIT", "NameChar", "NameStartChar", + "PI", "IGNORE" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "':'", "'!'", "'-'", null, null, null, null, null, null, null, + null, "'<'", "''", null, "'/>'", "'/'", "'='" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "COLON", "NOT", "DASH", "COMMENT_START", "COMMENT_END", "COMMENT", + "CDATA", "DTD", "EntityRef", "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", + "XMLDeclOpen", "TEXT", "CLOSE", "SPECIAL_CLOSE", "SLASH_CLOSE", "SLASH", + "EQUALS", "STRING", "Name", "S", "PI" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public XMLLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "XMLLexer.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\u0004\u0000\u0018\u0101\u0006\uffff\uffff\u0006\uffff\uffff\u0006\uffff"+ + "\uffff\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002\u0002\u0007"+ + "\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002\u0005\u0007"+ + "\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002\b\u0007\b"+ + "\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002\f\u0007"+ + "\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f\u0002"+ + "\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012\u0002"+ + "\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007\u0015\u0002"+ + "\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007\u0018\u0002"+ + "\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002\u001b\u0007\u001b\u0002"+ + "\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0001\u0000\u0001\u0000\u0001"+ + "\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001"+ + "\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ + "\u0004\u0001\u0005\u0001\u0005\u0005\u0005Q\b\u0005\n\u0005\f\u0005T\t"+ + "\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0005\u0006c\b\u0006\n\u0006\f\u0006f\t\u0006\u0001"+ + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001"+ + "\u0007\u0001\u0007\u0005\u0007p\b\u0007\n\u0007\f\u0007s\t\u0007\u0001"+ + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001"+ + "\b\u0001\t\u0001\t\u0001\t\u0001\t\u0004\t\u0081\b\t\u000b\t\f\t\u0082"+ + "\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0004\t\u008c"+ + "\b\t\u000b\t\f\t\u008d\u0001\t\u0001\t\u0003\t\u0092\b\t\u0001\n\u0001"+ + "\n\u0003\n\u0096\b\n\u0001\n\u0004\n\u0099\b\n\u000b\n\f\n\u009a\u0001"+ + "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001"+ + "\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001"+ + "\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0004\u000f\u00b9"+ + "\b\u000f\u000b\u000f\f\u000f\u00ba\u0001\u0010\u0001\u0010\u0001\u0010"+ + "\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011"+ + "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013"+ + "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0005\u0015"+ + "\u00d1\b\u0015\n\u0015\f\u0015\u00d4\t\u0015\u0001\u0015\u0001\u0015\u0001"+ + "\u0015\u0005\u0015\u00d9\b\u0015\n\u0015\f\u0015\u00dc\t\u0015\u0001\u0015"+ + "\u0003\u0015\u00df\b\u0015\u0001\u0016\u0001\u0016\u0005\u0016\u00e3\b"+ + "\u0016\n\u0016\f\u0016\u00e6\t\u0016\u0001\u0017\u0001\u0017\u0001\u0017"+ + "\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a"+ + "\u0001\u001a\u0001\u001a\u0001\u001a\u0003\u001a\u00f4\b\u001a\u0001\u001b"+ + "\u0003\u001b\u00f7\b\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c"+ + "\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0003Rdq"+ + "\u0000\u001e\u0003\u0001\u0005\u0002\u0007\u0003\t\u0004\u000b\u0005\r"+ + "\u0006\u000f\u0007\u0011\b\u0013\t\u0015\n\u0017\u000b\u0019\f\u001b\r"+ + "\u001d\u000e\u001f\u0000!\u000f#\u0010%\u0011\'\u0012)\u0013+\u0014-\u0015"+ + "/\u00161\u00173\u00005\u00007\u00009\u0000;\u0018=\u0000\u0003\u0000\u0001"+ + "\u0002\n\u0002\u0000\t\t \u0002\u0000&&<<\u0002\u0000\"\"<<\u0002\u0000"+ + "\'\'<<\u0003\u0000\t\n\r\r \u0003\u000009AFaf\u0001\u000009\u0002\u0000"+ + "-.__\u0003\u0000\u00b7\u00b7\u0300\u036f\u203f\u2040\b\u0000::AZaz\u2070"+ + "\u218f\u2c00\u2fef\u3001\u8000\ud7ff\u8000\uf900\u8000\ufdcf\u8000\ufdf0"+ + "\u8000\ufffd\u010b\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001"+ + "\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000"+ + "\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000"+ + "\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000"+ + "\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000"+ + "\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000"+ + "\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000"+ + "\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000"+ + "\u0001#\u0001\u0000\u0000\u0000\u0001%\u0001\u0000\u0000\u0000\u0001\'"+ + "\u0001\u0000\u0000\u0000\u0001)\u0001\u0000\u0000\u0000\u0001+\u0001\u0000"+ + "\u0000\u0000\u0001-\u0001\u0000\u0000\u0000\u0001/\u0001\u0000\u0000\u0000"+ + "\u00011\u0001\u0000\u0000\u0000\u0002;\u0001\u0000\u0000\u0000\u0002="+ + "\u0001\u0000\u0000\u0000\u0003?\u0001\u0000\u0000\u0000\u0005A\u0001\u0000"+ + "\u0000\u0000\u0007C\u0001\u0000\u0000\u0000\tE\u0001\u0000\u0000\u0000"+ + "\u000bJ\u0001\u0000\u0000\u0000\rN\u0001\u0000\u0000\u0000\u000fW\u0001"+ + "\u0000\u0000\u0000\u0011k\u0001\u0000\u0000\u0000\u0013x\u0001\u0000\u0000"+ + "\u0000\u0015\u0091\u0001\u0000\u0000\u0000\u0017\u0098\u0001\u0000\u0000"+ + "\u0000\u0019\u009c\u0001\u0000\u0000\u0000\u001b\u00a0\u0001\u0000\u0000"+ + "\u0000\u001d\u00a5\u0001\u0000\u0000\u0000\u001f\u00af\u0001\u0000\u0000"+ + "\u0000!\u00b8\u0001\u0000\u0000\u0000#\u00bc\u0001\u0000\u0000\u0000%"+ + "\u00c0\u0001\u0000\u0000\u0000\'\u00c5\u0001\u0000\u0000\u0000)\u00ca"+ + "\u0001\u0000\u0000\u0000+\u00cc\u0001\u0000\u0000\u0000-\u00de\u0001\u0000"+ + "\u0000\u0000/\u00e0\u0001\u0000\u0000\u00001\u00e7\u0001\u0000\u0000\u0000"+ + "3\u00eb\u0001\u0000\u0000\u00005\u00ed\u0001\u0000\u0000\u00007\u00f3"+ + "\u0001\u0000\u0000\u00009\u00f6\u0001\u0000\u0000\u0000;\u00f8\u0001\u0000"+ + "\u0000\u0000=\u00fd\u0001\u0000\u0000\u0000?@\u0005:\u0000\u0000@\u0004"+ + "\u0001\u0000\u0000\u0000AB\u0005!\u0000\u0000B\u0006\u0001\u0000\u0000"+ + "\u0000CD\u0005-\u0000\u0000D\b\u0001\u0000\u0000\u0000EF\u0005<\u0000"+ + "\u0000FG\u0003\u0005\u0001\u0000GH\u0003\u0007\u0002\u0000HI\u0003\u0007"+ + "\u0002\u0000I\n\u0001\u0000\u0000\u0000JK\u0003\u0007\u0002\u0000KL\u0003"+ + "\u0007\u0002\u0000LM\u0005>\u0000\u0000M\f\u0001\u0000\u0000\u0000NR\u0003"+ + "\t\u0003\u0000OQ\t\u0000\u0000\u0000PO\u0001\u0000\u0000\u0000QT\u0001"+ + "\u0000\u0000\u0000RS\u0001\u0000\u0000\u0000RP\u0001\u0000\u0000\u0000"+ + "SU\u0001\u0000\u0000\u0000TR\u0001\u0000\u0000\u0000UV\u0003\u000b\u0004"+ + "\u0000V\u000e\u0001\u0000\u0000\u0000WX\u0005<\u0000\u0000XY\u0005!\u0000"+ + "\u0000YZ\u0005[\u0000\u0000Z[\u0005C\u0000\u0000[\\\u0005D\u0000\u0000"+ + "\\]\u0005A\u0000\u0000]^\u0005T\u0000\u0000^_\u0005A\u0000\u0000_`\u0005"+ + "[\u0000\u0000`d\u0001\u0000\u0000\u0000ac\t\u0000\u0000\u0000ba\u0001"+ + "\u0000\u0000\u0000cf\u0001\u0000\u0000\u0000de\u0001\u0000\u0000\u0000"+ + "db\u0001\u0000\u0000\u0000eg\u0001\u0000\u0000\u0000fd\u0001\u0000\u0000"+ + "\u0000gh\u0005]\u0000\u0000hi\u0005]\u0000\u0000ij\u0005>\u0000\u0000"+ + "j\u0010\u0001\u0000\u0000\u0000kl\u0005<\u0000\u0000lm\u0005!\u0000\u0000"+ + "mq\u0001\u0000\u0000\u0000np\t\u0000\u0000\u0000on\u0001\u0000\u0000\u0000"+ + "ps\u0001\u0000\u0000\u0000qr\u0001\u0000\u0000\u0000qo\u0001\u0000\u0000"+ + "\u0000rt\u0001\u0000\u0000\u0000sq\u0001\u0000\u0000\u0000tu\u0005>\u0000"+ + "\u0000uv\u0001\u0000\u0000\u0000vw\u0006\u0007\u0000\u0000w\u0012\u0001"+ + "\u0000\u0000\u0000xy\u0005&\u0000\u0000yz\u0003/\u0016\u0000z{\u0005;"+ + "\u0000\u0000{\u0014\u0001\u0000\u0000\u0000|}\u0005&\u0000\u0000}~\u0005"+ + "#\u0000\u0000~\u0080\u0001\u0000\u0000\u0000\u007f\u0081\u00035\u0019"+ + "\u0000\u0080\u007f\u0001\u0000\u0000\u0000\u0081\u0082\u0001\u0000\u0000"+ + "\u0000\u0082\u0080\u0001\u0000\u0000\u0000\u0082\u0083\u0001\u0000\u0000"+ + "\u0000\u0083\u0084\u0001\u0000\u0000\u0000\u0084\u0085\u0005;\u0000\u0000"+ + "\u0085\u0092\u0001\u0000\u0000\u0000\u0086\u0087\u0005&\u0000\u0000\u0087"+ + "\u0088\u0005#\u0000\u0000\u0088\u0089\u0005x\u0000\u0000\u0089\u008b\u0001"+ + "\u0000\u0000\u0000\u008a\u008c\u00033\u0018\u0000\u008b\u008a\u0001\u0000"+ + "\u0000\u0000\u008c\u008d\u0001\u0000\u0000\u0000\u008d\u008b\u0001\u0000"+ + "\u0000\u0000\u008d\u008e\u0001\u0000\u0000\u0000\u008e\u008f\u0001\u0000"+ + "\u0000\u0000\u008f\u0090\u0005;\u0000\u0000\u0090\u0092\u0001\u0000\u0000"+ + "\u0000\u0091|\u0001\u0000\u0000\u0000\u0091\u0086\u0001\u0000\u0000\u0000"+ + "\u0092\u0016\u0001\u0000\u0000\u0000\u0093\u0099\u0007\u0000\u0000\u0000"+ + "\u0094\u0096\u0005\r\u0000\u0000\u0095\u0094\u0001\u0000\u0000\u0000\u0095"+ + "\u0096\u0001\u0000\u0000\u0000\u0096\u0097\u0001\u0000\u0000\u0000\u0097"+ + "\u0099\u0005\n\u0000\u0000\u0098\u0093\u0001\u0000\u0000\u0000\u0098\u0095"+ + "\u0001\u0000\u0000\u0000\u0099\u009a\u0001\u0000\u0000\u0000\u009a\u0098"+ + "\u0001\u0000\u0000\u0000\u009a\u009b\u0001\u0000\u0000\u0000\u009b\u0018"+ + "\u0001\u0000\u0000\u0000\u009c\u009d\u0005<\u0000\u0000\u009d\u009e\u0001"+ + "\u0000\u0000\u0000\u009e\u009f\u0006\u000b\u0001\u0000\u009f\u001a\u0001"+ + "\u0000\u0000\u0000\u00a0\u00a1\u0005<\u0000\u0000\u00a1\u00a2\u0005/\u0000"+ + "\u0000\u00a2\u00a3\u0001\u0000\u0000\u0000\u00a3\u00a4\u0006\f\u0001\u0000"+ + "\u00a4\u001c\u0001\u0000\u0000\u0000\u00a5\u00a6\u0005<\u0000\u0000\u00a6"+ + "\u00a7\u0005?\u0000\u0000\u00a7\u00a8\u0005x\u0000\u0000\u00a8\u00a9\u0005"+ + "m\u0000\u0000\u00a9\u00aa\u0005l\u0000\u0000\u00aa\u00ab\u0001\u0000\u0000"+ + "\u0000\u00ab\u00ac\u00031\u0017\u0000\u00ac\u00ad\u0001\u0000\u0000\u0000"+ + "\u00ad\u00ae\u0006\r\u0001\u0000\u00ae\u001e\u0001\u0000\u0000\u0000\u00af"+ + "\u00b0\u0005<\u0000\u0000\u00b0\u00b1\u0005?\u0000\u0000\u00b1\u00b2\u0001"+ + "\u0000\u0000\u0000\u00b2\u00b3\u0003/\u0016\u0000\u00b3\u00b4\u0001\u0000"+ + "\u0000\u0000\u00b4\u00b5\u0006\u000e\u0002\u0000\u00b5\u00b6\u0006\u000e"+ + "\u0003\u0000\u00b6 \u0001\u0000\u0000\u0000\u00b7\u00b9\b\u0001\u0000"+ + "\u0000\u00b8\u00b7\u0001\u0000\u0000\u0000\u00b9\u00ba\u0001\u0000\u0000"+ + "\u0000\u00ba\u00b8\u0001\u0000\u0000\u0000\u00ba\u00bb\u0001\u0000\u0000"+ + "\u0000\u00bb\"\u0001\u0000\u0000\u0000\u00bc\u00bd\u0005>\u0000\u0000"+ + "\u00bd\u00be\u0001\u0000\u0000\u0000\u00be\u00bf\u0006\u0010\u0004\u0000"+ + "\u00bf$\u0001\u0000\u0000\u0000\u00c0\u00c1\u0005?\u0000\u0000\u00c1\u00c2"+ + "\u0005>\u0000\u0000\u00c2\u00c3\u0001\u0000\u0000\u0000\u00c3\u00c4\u0006"+ + "\u0011\u0004\u0000\u00c4&\u0001\u0000\u0000\u0000\u00c5\u00c6\u0005/\u0000"+ + "\u0000\u00c6\u00c7\u0005>\u0000\u0000\u00c7\u00c8\u0001\u0000\u0000\u0000"+ + "\u00c8\u00c9\u0006\u0012\u0004\u0000\u00c9(\u0001\u0000\u0000\u0000\u00ca"+ + "\u00cb\u0005/\u0000\u0000\u00cb*\u0001\u0000\u0000\u0000\u00cc\u00cd\u0005"+ + "=\u0000\u0000\u00cd,\u0001\u0000\u0000\u0000\u00ce\u00d2\u0005\"\u0000"+ + "\u0000\u00cf\u00d1\b\u0002\u0000\u0000\u00d0\u00cf\u0001\u0000\u0000\u0000"+ + "\u00d1\u00d4\u0001\u0000\u0000\u0000\u00d2\u00d0\u0001\u0000\u0000\u0000"+ + "\u00d2\u00d3\u0001\u0000\u0000\u0000\u00d3\u00d5\u0001\u0000\u0000\u0000"+ + "\u00d4\u00d2\u0001\u0000\u0000\u0000\u00d5\u00df\u0005\"\u0000\u0000\u00d6"+ + "\u00da\u0005\'\u0000\u0000\u00d7\u00d9\b\u0003\u0000\u0000\u00d8\u00d7"+ + "\u0001\u0000\u0000\u0000\u00d9\u00dc\u0001\u0000\u0000\u0000\u00da\u00d8"+ + "\u0001\u0000\u0000\u0000\u00da\u00db\u0001\u0000\u0000\u0000\u00db\u00dd"+ + "\u0001\u0000\u0000\u0000\u00dc\u00da\u0001\u0000\u0000\u0000\u00dd\u00df"+ + "\u0005\'\u0000\u0000\u00de\u00ce\u0001\u0000\u0000\u0000\u00de\u00d6\u0001"+ + "\u0000\u0000\u0000\u00df.\u0001\u0000\u0000\u0000\u00e0\u00e4\u00039\u001b"+ + "\u0000\u00e1\u00e3\u00037\u001a\u0000\u00e2\u00e1\u0001\u0000\u0000\u0000"+ + "\u00e3\u00e6\u0001\u0000\u0000\u0000\u00e4\u00e2\u0001\u0000\u0000\u0000"+ + "\u00e4\u00e5\u0001\u0000\u0000\u0000\u00e50\u0001\u0000\u0000\u0000\u00e6"+ + "\u00e4\u0001\u0000\u0000\u0000\u00e7\u00e8\u0007\u0004\u0000\u0000\u00e8"+ + "\u00e9\u0001\u0000\u0000\u0000\u00e9\u00ea\u0006\u0017\u0000\u0000\u00ea"+ + "2\u0001\u0000\u0000\u0000\u00eb\u00ec\u0007\u0005\u0000\u0000\u00ec4\u0001"+ + "\u0000\u0000\u0000\u00ed\u00ee\u0007\u0006\u0000\u0000\u00ee6\u0001\u0000"+ + "\u0000\u0000\u00ef\u00f4\u00039\u001b\u0000\u00f0\u00f4\u0007\u0007\u0000"+ + "\u0000\u00f1\u00f4\u00035\u0019\u0000\u00f2\u00f4\u0007\b\u0000\u0000"+ + "\u00f3\u00ef\u0001\u0000\u0000\u0000\u00f3\u00f0\u0001\u0000\u0000\u0000"+ + "\u00f3\u00f1\u0001\u0000\u0000\u0000\u00f3\u00f2\u0001\u0000\u0000\u0000"+ + "\u00f48\u0001\u0000\u0000\u0000\u00f5\u00f7\u0007\t\u0000\u0000\u00f6"+ + "\u00f5\u0001\u0000\u0000\u0000\u00f7:\u0001\u0000\u0000\u0000\u00f8\u00f9"+ + "\u0005?\u0000\u0000\u00f9\u00fa\u0005>\u0000\u0000\u00fa\u00fb\u0001\u0000"+ + "\u0000\u0000\u00fb\u00fc\u0006\u001c\u0004\u0000\u00fc<\u0001\u0000\u0000"+ + "\u0000\u00fd\u00fe\t\u0000\u0000\u0000\u00fe\u00ff\u0001\u0000\u0000\u0000"+ + "\u00ff\u0100\u0006\u001d\u0002\u0000\u0100>\u0001\u0000\u0000\u0000\u0013"+ + "\u0000\u0001\u0002Rdq\u0082\u008d\u0091\u0095\u0098\u009a\u00ba\u00d2"+ + "\u00da\u00de\u00e4\u00f3\u00f6\u0005\u0006\u0000\u0000\u0005\u0001\u0000"+ + "\u0003\u0000\u0000\u0005\u0002\u0000\u0004\u0000\u0000"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.tokens b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.tokens new file mode 100644 index 000000000..8a847de68 --- /dev/null +++ b/lexers/src/main/gen/com/itsaky/androidide/lexers/xml/XMLLexer.tokens @@ -0,0 +1,33 @@ +COLON=1 +NOT=2 +DASH=3 +COMMENT_START=4 +COMMENT_END=5 +COMMENT=6 +CDATA=7 +DTD=8 +EntityRef=9 +CharRef=10 +SEA_WS=11 +OPEN=12 +OPEN_SLASH=13 +XMLDeclOpen=14 +TEXT=15 +CLOSE=16 +SPECIAL_CLOSE=17 +SLASH_CLOSE=18 +SLASH=19 +EQUALS=20 +STRING=21 +Name=22 +S=23 +PI=24 +':'=1 +'!'=2 +'-'=3 +'<'=12 +''=16 +'/>'=18 +'/'=19 +'='=20 diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.g4 b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.g4 index cec25bee9..490b3d2e1 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.g4 +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.g4 @@ -30,10 +30,14 @@ lexer grammar XMLLexer; // Default "mode": Everything OUTSIDE of a tag -COLON : ':' ; -NOT : '!' ; -DASH : '-' ; -COMMENT : '' ; +COLON : ':' ; +NOT : '!' ; +DASH : '-' ; + +// When we encounter a comment, enter COMMENT_MODE +COMMENT_START: '<' NOT DASH DASH -> pushMode(COMMENT_MODE); +COMMENT_END : DASH DASH '>' ; +COMMENT : COMMENT_START .*? COMMENT_END ; CDATA : '' ; /** Scarf all DTD stuff, Entity Declarations like , * and Notation Declarations @@ -45,15 +49,20 @@ CharRef : '&#' DIGIT+ ';' ; SEA_WS : (' '|'\t'|'\r'? '\n')+ ; -OPEN : '<' -> pushMode(INSIDE) ; -OPEN_SLASH : ' pushMode(INSIDE) ; -XMLDeclOpen : ' pushMode(INSIDE) ; +OPEN : '<' -> pushMode(TAG_MODE) ; +OPEN_SLASH : ' pushMode(TAG_MODE) ; +XMLDeclOpen : ' pushMode(TAG_MODE) ; SPECIAL_OPEN: ' more, pushMode(PROC_INSTR) ; -TEXT : ~[<&]+ ; // match any 16 bit char other than < and & +TEXT : ~[<&]+; // match any 16 bit char other than < and & + +// ----------------- Inside a comment ------------------------------ +mode COMMENT_MODE; +CommentText : ~[<&-]+ -> skip ; +CommentModeEnd : COMMENT_END -> popMode; // Comment ended, exit COMMENT_MODE // ----------------- Everything INSIDE of a tag --------------------- -mode INSIDE; +mode TAG_MODE; CLOSE : '>' -> popMode ; SPECIAL_CLOSE: '?>' -> popMode ; // close @@ -75,7 +84,7 @@ DIGIT : [0-9] ; fragment NameChar : NameStartChar - | '-' | '_' | '.' | DIGIT + | DASH | '_' | '.' | DIGIT | '\u00B7' | '\u0300'..'\u036F' | '\u203F'..'\u2040' diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.interp b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.interp index 6c76f0521..4840a09ca 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.interp +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.interp @@ -9,10 +9,14 @@ null null null null +null +null '<' '' null '/>' @@ -28,6 +32,8 @@ null COLON NOT DASH +COMMENT_START +COMMENT_END COMMENT CDATA DTD @@ -38,6 +44,8 @@ OPEN OPEN_SLASH XMLDeclOpen TEXT +CommentText +CommentModeEnd CLOSE SPECIAL_CLOSE SLASH_CLOSE @@ -52,6 +60,8 @@ rule names: COLON NOT DASH +COMMENT_START +COMMENT_END COMMENT CDATA DTD @@ -63,6 +73,8 @@ OPEN_SLASH XMLDeclOpen SPECIAL_OPEN TEXT +CommentText +CommentModeEnd CLOSE SPECIAL_CLOSE SLASH_CLOSE @@ -84,8 +96,9 @@ HIDDEN mode names: DEFAULT_MODE -INSIDE +COMMENT_MODE +TAG_MODE PROC_INSTR atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 24, 252, 8, 1, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 74, 10, 5, 12, 5, 14, 5, 77, 11, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 7, 6, 94, 10, 6, 12, 6, 14, 6, 97, 11, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 107, 10, 7, 12, 7, 14, 7, 110, 11, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 6, 9, 124, 10, 9, 13, 9, 14, 9, 125, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 6, 9, 135, 10, 9, 13, 9, 14, 9, 136, 3, 9, 3, 9, 5, 9, 141, 10, 9, 3, 10, 3, 10, 5, 10, 145, 10, 10, 3, 10, 6, 10, 148, 10, 10, 13, 10, 14, 10, 149, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 6, 15, 180, 10, 15, 13, 15, 14, 15, 181, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 7, 21, 204, 10, 21, 12, 21, 14, 21, 207, 11, 21, 3, 21, 3, 21, 3, 21, 7, 21, 212, 10, 21, 12, 21, 14, 21, 215, 11, 21, 3, 21, 5, 21, 218, 10, 21, 3, 22, 3, 22, 7, 22, 222, 10, 22, 12, 22, 14, 22, 225, 11, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 239, 10, 26, 3, 27, 5, 27, 242, 10, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5, 75, 95, 108, 2, 30, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 2, 31, 15, 33, 16, 35, 17, 37, 18, 39, 19, 41, 20, 43, 21, 45, 22, 47, 23, 49, 2, 51, 2, 53, 2, 55, 2, 57, 24, 59, 2, 5, 2, 3, 4, 12, 4, 2, 11, 11, 34, 34, 4, 2, 40, 40, 62, 62, 4, 2, 36, 36, 62, 62, 4, 2, 41, 41, 62, 62, 5, 2, 11, 12, 15, 15, 34, 34, 5, 2, 50, 59, 67, 72, 99, 104, 3, 2, 50, 59, 4, 2, 47, 48, 97, 97, 5, 2, 185, 185, 770, 881, 8257, 8258, 10, 2, 60, 60, 67, 92, 99, 124, 8306, 8593, 11266, 12273, 12291, 55297, 63746, 64977, 65010, 65535, 2, 262, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 3, 33, 3, 2, 2, 2, 3, 35, 3, 2, 2, 2, 3, 37, 3, 2, 2, 2, 3, 39, 3, 2, 2, 2, 3, 41, 3, 2, 2, 2, 3, 43, 3, 2, 2, 2, 3, 45, 3, 2, 2, 2, 3, 47, 3, 2, 2, 2, 4, 57, 3, 2, 2, 2, 4, 59, 3, 2, 2, 2, 5, 61, 3, 2, 2, 2, 7, 63, 3, 2, 2, 2, 9, 65, 3, 2, 2, 2, 11, 67, 3, 2, 2, 2, 13, 82, 3, 2, 2, 2, 15, 102, 3, 2, 2, 2, 17, 115, 3, 2, 2, 2, 19, 140, 3, 2, 2, 2, 21, 147, 3, 2, 2, 2, 23, 151, 3, 2, 2, 2, 25, 155, 3, 2, 2, 2, 27, 160, 3, 2, 2, 2, 29, 170, 3, 2, 2, 2, 31, 179, 3, 2, 2, 2, 33, 183, 3, 2, 2, 2, 35, 187, 3, 2, 2, 2, 37, 192, 3, 2, 2, 2, 39, 197, 3, 2, 2, 2, 41, 199, 3, 2, 2, 2, 43, 217, 3, 2, 2, 2, 45, 219, 3, 2, 2, 2, 47, 226, 3, 2, 2, 2, 49, 230, 3, 2, 2, 2, 51, 232, 3, 2, 2, 2, 53, 238, 3, 2, 2, 2, 55, 241, 3, 2, 2, 2, 57, 243, 3, 2, 2, 2, 59, 248, 3, 2, 2, 2, 61, 62, 7, 60, 2, 2, 62, 6, 3, 2, 2, 2, 63, 64, 7, 35, 2, 2, 64, 8, 3, 2, 2, 2, 65, 66, 7, 47, 2, 2, 66, 10, 3, 2, 2, 2, 67, 68, 7, 62, 2, 2, 68, 69, 7, 35, 2, 2, 69, 70, 7, 47, 2, 2, 70, 71, 7, 47, 2, 2, 71, 75, 3, 2, 2, 2, 72, 74, 11, 2, 2, 2, 73, 72, 3, 2, 2, 2, 74, 77, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 75, 73, 3, 2, 2, 2, 76, 78, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 78, 79, 7, 47, 2, 2, 79, 80, 7, 47, 2, 2, 80, 81, 7, 64, 2, 2, 81, 12, 3, 2, 2, 2, 82, 83, 7, 62, 2, 2, 83, 84, 7, 35, 2, 2, 84, 85, 7, 93, 2, 2, 85, 86, 7, 69, 2, 2, 86, 87, 7, 70, 2, 2, 87, 88, 7, 67, 2, 2, 88, 89, 7, 86, 2, 2, 89, 90, 7, 67, 2, 2, 90, 91, 7, 93, 2, 2, 91, 95, 3, 2, 2, 2, 92, 94, 11, 2, 2, 2, 93, 92, 3, 2, 2, 2, 94, 97, 3, 2, 2, 2, 95, 96, 3, 2, 2, 2, 95, 93, 3, 2, 2, 2, 96, 98, 3, 2, 2, 2, 97, 95, 3, 2, 2, 2, 98, 99, 7, 95, 2, 2, 99, 100, 7, 95, 2, 2, 100, 101, 7, 64, 2, 2, 101, 14, 3, 2, 2, 2, 102, 103, 7, 62, 2, 2, 103, 104, 7, 35, 2, 2, 104, 108, 3, 2, 2, 2, 105, 107, 11, 2, 2, 2, 106, 105, 3, 2, 2, 2, 107, 110, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2, 108, 106, 3, 2, 2, 2, 109, 111, 3, 2, 2, 2, 110, 108, 3, 2, 2, 2, 111, 112, 7, 64, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 8, 7, 2, 2, 114, 16, 3, 2, 2, 2, 115, 116, 7, 40, 2, 2, 116, 117, 5, 45, 22, 2, 117, 118, 7, 61, 2, 2, 118, 18, 3, 2, 2, 2, 119, 120, 7, 40, 2, 2, 120, 121, 7, 37, 2, 2, 121, 123, 3, 2, 2, 2, 122, 124, 5, 51, 25, 2, 123, 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 123, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 128, 7, 61, 2, 2, 128, 141, 3, 2, 2, 2, 129, 130, 7, 40, 2, 2, 130, 131, 7, 37, 2, 2, 131, 132, 7, 122, 2, 2, 132, 134, 3, 2, 2, 2, 133, 135, 5, 49, 24, 2, 134, 133, 3, 2, 2, 2, 135, 136, 3, 2, 2, 2, 136, 134, 3, 2, 2, 2, 136, 137, 3, 2, 2, 2, 137, 138, 3, 2, 2, 2, 138, 139, 7, 61, 2, 2, 139, 141, 3, 2, 2, 2, 140, 119, 3, 2, 2, 2, 140, 129, 3, 2, 2, 2, 141, 20, 3, 2, 2, 2, 142, 148, 9, 2, 2, 2, 143, 145, 7, 15, 2, 2, 144, 143, 3, 2, 2, 2, 144, 145, 3, 2, 2, 2, 145, 146, 3, 2, 2, 2, 146, 148, 7, 12, 2, 2, 147, 142, 3, 2, 2, 2, 147, 144, 3, 2, 2, 2, 148, 149, 3, 2, 2, 2, 149, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 22, 3, 2, 2, 2, 151, 152, 7, 62, 2, 2, 152, 153, 3, 2, 2, 2, 153, 154, 8, 11, 3, 2, 154, 24, 3, 2, 2, 2, 155, 156, 7, 62, 2, 2, 156, 157, 7, 49, 2, 2, 157, 158, 3, 2, 2, 2, 158, 159, 8, 12, 3, 2, 159, 26, 3, 2, 2, 2, 160, 161, 7, 62, 2, 2, 161, 162, 7, 65, 2, 2, 162, 163, 7, 122, 2, 2, 163, 164, 7, 111, 2, 2, 164, 165, 7, 110, 2, 2, 165, 166, 3, 2, 2, 2, 166, 167, 5, 47, 23, 2, 167, 168, 3, 2, 2, 2, 168, 169, 8, 13, 3, 2, 169, 28, 3, 2, 2, 2, 170, 171, 7, 62, 2, 2, 171, 172, 7, 65, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174, 5, 45, 22, 2, 174, 175, 3, 2, 2, 2, 175, 176, 8, 14, 4, 2, 176, 177, 8, 14, 5, 2, 177, 30, 3, 2, 2, 2, 178, 180, 10, 3, 2, 2, 179, 178, 3, 2, 2, 2, 180, 181, 3, 2, 2, 2, 181, 179, 3, 2, 2, 2, 181, 182, 3, 2, 2, 2, 182, 32, 3, 2, 2, 2, 183, 184, 7, 64, 2, 2, 184, 185, 3, 2, 2, 2, 185, 186, 8, 16, 6, 2, 186, 34, 3, 2, 2, 2, 187, 188, 7, 65, 2, 2, 188, 189, 7, 64, 2, 2, 189, 190, 3, 2, 2, 2, 190, 191, 8, 17, 6, 2, 191, 36, 3, 2, 2, 2, 192, 193, 7, 49, 2, 2, 193, 194, 7, 64, 2, 2, 194, 195, 3, 2, 2, 2, 195, 196, 8, 18, 6, 2, 196, 38, 3, 2, 2, 2, 197, 198, 7, 49, 2, 2, 198, 40, 3, 2, 2, 2, 199, 200, 7, 63, 2, 2, 200, 42, 3, 2, 2, 2, 201, 205, 7, 36, 2, 2, 202, 204, 10, 4, 2, 2, 203, 202, 3, 2, 2, 2, 204, 207, 3, 2, 2, 2, 205, 203, 3, 2, 2, 2, 205, 206, 3, 2, 2, 2, 206, 208, 3, 2, 2, 2, 207, 205, 3, 2, 2, 2, 208, 218, 7, 36, 2, 2, 209, 213, 7, 41, 2, 2, 210, 212, 10, 5, 2, 2, 211, 210, 3, 2, 2, 2, 212, 215, 3, 2, 2, 2, 213, 211, 3, 2, 2, 2, 213, 214, 3, 2, 2, 2, 214, 216, 3, 2, 2, 2, 215, 213, 3, 2, 2, 2, 216, 218, 7, 41, 2, 2, 217, 201, 3, 2, 2, 2, 217, 209, 3, 2, 2, 2, 218, 44, 3, 2, 2, 2, 219, 223, 5, 55, 27, 2, 220, 222, 5, 53, 26, 2, 221, 220, 3, 2, 2, 2, 222, 225, 3, 2, 2, 2, 223, 221, 3, 2, 2, 2, 223, 224, 3, 2, 2, 2, 224, 46, 3, 2, 2, 2, 225, 223, 3, 2, 2, 2, 226, 227, 9, 6, 2, 2, 227, 228, 3, 2, 2, 2, 228, 229, 8, 23, 2, 2, 229, 48, 3, 2, 2, 2, 230, 231, 9, 7, 2, 2, 231, 50, 3, 2, 2, 2, 232, 233, 9, 8, 2, 2, 233, 52, 3, 2, 2, 2, 234, 239, 5, 55, 27, 2, 235, 239, 9, 9, 2, 2, 236, 239, 5, 51, 25, 2, 237, 239, 9, 10, 2, 2, 238, 234, 3, 2, 2, 2, 238, 235, 3, 2, 2, 2, 238, 236, 3, 2, 2, 2, 238, 237, 3, 2, 2, 2, 239, 54, 3, 2, 2, 2, 240, 242, 9, 11, 2, 2, 241, 240, 3, 2, 2, 2, 242, 56, 3, 2, 2, 2, 243, 244, 7, 65, 2, 2, 244, 245, 7, 64, 2, 2, 245, 246, 3, 2, 2, 2, 246, 247, 8, 28, 6, 2, 247, 58, 3, 2, 2, 2, 248, 249, 11, 2, 2, 2, 249, 250, 3, 2, 2, 2, 250, 251, 8, 29, 4, 2, 251, 60, 3, 2, 2, 2, 21, 2, 3, 4, 75, 95, 108, 125, 136, 140, 144, 147, 149, 181, 205, 213, 217, 223, 238, 241, 7, 8, 2, 2, 7, 3, 2, 5, 2, 2, 7, 4, 2, 6, 2, 2] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 28, 278, 8, 1, 8, 1, 8, 1, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 7, 7, 90, 10, 7, 12, 7, 14, 7, 93, 11, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 7, 8, 108, 10, 8, 12, 8, 14, 8, 111, 11, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 7, 9, 121, 10, 9, 12, 9, 14, 9, 124, 11, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 6, 11, 138, 10, 11, 13, 11, 14, 11, 139, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 6, 11, 149, 10, 11, 13, 11, 14, 11, 150, 3, 11, 3, 11, 5, 11, 155, 10, 11, 3, 12, 3, 12, 5, 12, 159, 10, 12, 3, 12, 6, 12, 162, 10, 12, 13, 12, 14, 12, 163, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 6, 17, 194, 10, 17, 13, 17, 14, 17, 195, 3, 18, 6, 18, 199, 10, 18, 13, 18, 14, 18, 200, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 7, 25, 229, 10, 25, 12, 25, 14, 25, 232, 11, 25, 3, 25, 3, 25, 3, 25, 7, 25, 237, 10, 25, 12, 25, 14, 25, 240, 11, 25, 3, 25, 5, 25, 243, 10, 25, 3, 26, 3, 26, 7, 26, 247, 10, 26, 12, 26, 14, 26, 250, 11, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 5, 30, 265, 10, 30, 3, 31, 5, 31, 268, 10, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 91, 109, 122, 2, 34, 6, 3, 8, 4, 10, 5, 12, 6, 14, 7, 16, 8, 18, 9, 20, 10, 22, 11, 24, 12, 26, 13, 28, 14, 30, 15, 32, 16, 34, 2, 36, 17, 38, 18, 40, 19, 42, 20, 44, 21, 46, 22, 48, 23, 50, 24, 52, 25, 54, 26, 56, 27, 58, 2, 60, 2, 62, 2, 64, 2, 66, 28, 68, 2, 6, 2, 3, 4, 5, 13, 4, 2, 11, 11, 34, 34, 4, 2, 40, 40, 62, 62, 5, 2, 40, 40, 47, 47, 62, 62, 4, 2, 36, 36, 62, 62, 4, 2, 41, 41, 62, 62, 5, 2, 11, 12, 15, 15, 34, 34, 5, 2, 50, 59, 67, 72, 99, 104, 3, 2, 50, 59, 4, 2, 48, 48, 97, 97, 5, 2, 185, 185, 770, 881, 8257, 8258, 10, 2, 60, 60, 67, 92, 99, 124, 8306, 8593, 11266, 12273, 12291, 55297, 63746, 64977, 65010, 65535, 2, 289, 2, 6, 3, 2, 2, 2, 2, 8, 3, 2, 2, 2, 2, 10, 3, 2, 2, 2, 2, 12, 3, 2, 2, 2, 2, 14, 3, 2, 2, 2, 2, 16, 3, 2, 2, 2, 2, 18, 3, 2, 2, 2, 2, 20, 3, 2, 2, 2, 2, 22, 3, 2, 2, 2, 2, 24, 3, 2, 2, 2, 2, 26, 3, 2, 2, 2, 2, 28, 3, 2, 2, 2, 2, 30, 3, 2, 2, 2, 2, 32, 3, 2, 2, 2, 2, 34, 3, 2, 2, 2, 2, 36, 3, 2, 2, 2, 3, 38, 3, 2, 2, 2, 3, 40, 3, 2, 2, 2, 4, 42, 3, 2, 2, 2, 4, 44, 3, 2, 2, 2, 4, 46, 3, 2, 2, 2, 4, 48, 3, 2, 2, 2, 4, 50, 3, 2, 2, 2, 4, 52, 3, 2, 2, 2, 4, 54, 3, 2, 2, 2, 4, 56, 3, 2, 2, 2, 5, 66, 3, 2, 2, 2, 5, 68, 3, 2, 2, 2, 6, 70, 3, 2, 2, 2, 8, 72, 3, 2, 2, 2, 10, 74, 3, 2, 2, 2, 12, 76, 3, 2, 2, 2, 14, 83, 3, 2, 2, 2, 16, 87, 3, 2, 2, 2, 18, 96, 3, 2, 2, 2, 20, 116, 3, 2, 2, 2, 22, 129, 3, 2, 2, 2, 24, 154, 3, 2, 2, 2, 26, 161, 3, 2, 2, 2, 28, 165, 3, 2, 2, 2, 30, 169, 3, 2, 2, 2, 32, 174, 3, 2, 2, 2, 34, 184, 3, 2, 2, 2, 36, 193, 3, 2, 2, 2, 38, 198, 3, 2, 2, 2, 40, 204, 3, 2, 2, 2, 42, 208, 3, 2, 2, 2, 44, 212, 3, 2, 2, 2, 46, 217, 3, 2, 2, 2, 48, 222, 3, 2, 2, 2, 50, 224, 3, 2, 2, 2, 52, 242, 3, 2, 2, 2, 54, 244, 3, 2, 2, 2, 56, 251, 3, 2, 2, 2, 58, 255, 3, 2, 2, 2, 60, 257, 3, 2, 2, 2, 62, 264, 3, 2, 2, 2, 64, 267, 3, 2, 2, 2, 66, 269, 3, 2, 2, 2, 68, 274, 3, 2, 2, 2, 70, 71, 7, 60, 2, 2, 71, 7, 3, 2, 2, 2, 72, 73, 7, 35, 2, 2, 73, 9, 3, 2, 2, 2, 74, 75, 7, 47, 2, 2, 75, 11, 3, 2, 2, 2, 76, 77, 7, 62, 2, 2, 77, 78, 5, 8, 3, 2, 78, 79, 5, 10, 4, 2, 79, 80, 5, 10, 4, 2, 80, 81, 3, 2, 2, 2, 81, 82, 8, 5, 2, 2, 82, 13, 3, 2, 2, 2, 83, 84, 5, 10, 4, 2, 84, 85, 5, 10, 4, 2, 85, 86, 7, 64, 2, 2, 86, 15, 3, 2, 2, 2, 87, 91, 5, 12, 5, 2, 88, 90, 11, 2, 2, 2, 89, 88, 3, 2, 2, 2, 90, 93, 3, 2, 2, 2, 91, 92, 3, 2, 2, 2, 91, 89, 3, 2, 2, 2, 92, 94, 3, 2, 2, 2, 93, 91, 3, 2, 2, 2, 94, 95, 5, 14, 6, 2, 95, 17, 3, 2, 2, 2, 96, 97, 7, 62, 2, 2, 97, 98, 7, 35, 2, 2, 98, 99, 7, 93, 2, 2, 99, 100, 7, 69, 2, 2, 100, 101, 7, 70, 2, 2, 101, 102, 7, 67, 2, 2, 102, 103, 7, 86, 2, 2, 103, 104, 7, 67, 2, 2, 104, 105, 7, 93, 2, 2, 105, 109, 3, 2, 2, 2, 106, 108, 11, 2, 2, 2, 107, 106, 3, 2, 2, 2, 108, 111, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 109, 107, 3, 2, 2, 2, 110, 112, 3, 2, 2, 2, 111, 109, 3, 2, 2, 2, 112, 113, 7, 95, 2, 2, 113, 114, 7, 95, 2, 2, 114, 115, 7, 64, 2, 2, 115, 19, 3, 2, 2, 2, 116, 117, 7, 62, 2, 2, 117, 118, 7, 35, 2, 2, 118, 122, 3, 2, 2, 2, 119, 121, 11, 2, 2, 2, 120, 119, 3, 2, 2, 2, 121, 124, 3, 2, 2, 2, 122, 123, 3, 2, 2, 2, 122, 120, 3, 2, 2, 2, 123, 125, 3, 2, 2, 2, 124, 122, 3, 2, 2, 2, 125, 126, 7, 64, 2, 2, 126, 127, 3, 2, 2, 2, 127, 128, 8, 9, 3, 2, 128, 21, 3, 2, 2, 2, 129, 130, 7, 40, 2, 2, 130, 131, 5, 54, 26, 2, 131, 132, 7, 61, 2, 2, 132, 23, 3, 2, 2, 2, 133, 134, 7, 40, 2, 2, 134, 135, 7, 37, 2, 2, 135, 137, 3, 2, 2, 2, 136, 138, 5, 60, 29, 2, 137, 136, 3, 2, 2, 2, 138, 139, 3, 2, 2, 2, 139, 137, 3, 2, 2, 2, 139, 140, 3, 2, 2, 2, 140, 141, 3, 2, 2, 2, 141, 142, 7, 61, 2, 2, 142, 155, 3, 2, 2, 2, 143, 144, 7, 40, 2, 2, 144, 145, 7, 37, 2, 2, 145, 146, 7, 122, 2, 2, 146, 148, 3, 2, 2, 2, 147, 149, 5, 58, 28, 2, 148, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 148, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 153, 7, 61, 2, 2, 153, 155, 3, 2, 2, 2, 154, 133, 3, 2, 2, 2, 154, 143, 3, 2, 2, 2, 155, 25, 3, 2, 2, 2, 156, 162, 9, 2, 2, 2, 157, 159, 7, 15, 2, 2, 158, 157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 162, 7, 12, 2, 2, 161, 156, 3, 2, 2, 2, 161, 158, 3, 2, 2, 2, 162, 163, 3, 2, 2, 2, 163, 161, 3, 2, 2, 2, 163, 164, 3, 2, 2, 2, 164, 27, 3, 2, 2, 2, 165, 166, 7, 62, 2, 2, 166, 167, 3, 2, 2, 2, 167, 168, 8, 13, 4, 2, 168, 29, 3, 2, 2, 2, 169, 170, 7, 62, 2, 2, 170, 171, 7, 49, 2, 2, 171, 172, 3, 2, 2, 2, 172, 173, 8, 14, 4, 2, 173, 31, 3, 2, 2, 2, 174, 175, 7, 62, 2, 2, 175, 176, 7, 65, 2, 2, 176, 177, 7, 122, 2, 2, 177, 178, 7, 111, 2, 2, 178, 179, 7, 110, 2, 2, 179, 180, 3, 2, 2, 2, 180, 181, 5, 56, 27, 2, 181, 182, 3, 2, 2, 2, 182, 183, 8, 15, 4, 2, 183, 33, 3, 2, 2, 2, 184, 185, 7, 62, 2, 2, 185, 186, 7, 65, 2, 2, 186, 187, 3, 2, 2, 2, 187, 188, 5, 54, 26, 2, 188, 189, 3, 2, 2, 2, 189, 190, 8, 16, 5, 2, 190, 191, 8, 16, 6, 2, 191, 35, 3, 2, 2, 2, 192, 194, 10, 3, 2, 2, 193, 192, 3, 2, 2, 2, 194, 195, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 37, 3, 2, 2, 2, 197, 199, 10, 4, 2, 2, 198, 197, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 198, 3, 2, 2, 2, 200, 201, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 203, 8, 18, 3, 2, 203, 39, 3, 2, 2, 2, 204, 205, 5, 14, 6, 2, 205, 206, 3, 2, 2, 2, 206, 207, 8, 19, 7, 2, 207, 41, 3, 2, 2, 2, 208, 209, 7, 64, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 8, 20, 7, 2, 211, 43, 3, 2, 2, 2, 212, 213, 7, 65, 2, 2, 213, 214, 7, 64, 2, 2, 214, 215, 3, 2, 2, 2, 215, 216, 8, 21, 7, 2, 216, 45, 3, 2, 2, 2, 217, 218, 7, 49, 2, 2, 218, 219, 7, 64, 2, 2, 219, 220, 3, 2, 2, 2, 220, 221, 8, 22, 7, 2, 221, 47, 3, 2, 2, 2, 222, 223, 7, 49, 2, 2, 223, 49, 3, 2, 2, 2, 224, 225, 7, 63, 2, 2, 225, 51, 3, 2, 2, 2, 226, 230, 7, 36, 2, 2, 227, 229, 10, 5, 2, 2, 228, 227, 3, 2, 2, 2, 229, 232, 3, 2, 2, 2, 230, 228, 3, 2, 2, 2, 230, 231, 3, 2, 2, 2, 231, 233, 3, 2, 2, 2, 232, 230, 3, 2, 2, 2, 233, 243, 7, 36, 2, 2, 234, 238, 7, 41, 2, 2, 235, 237, 10, 6, 2, 2, 236, 235, 3, 2, 2, 2, 237, 240, 3, 2, 2, 2, 238, 236, 3, 2, 2, 2, 238, 239, 3, 2, 2, 2, 239, 241, 3, 2, 2, 2, 240, 238, 3, 2, 2, 2, 241, 243, 7, 41, 2, 2, 242, 226, 3, 2, 2, 2, 242, 234, 3, 2, 2, 2, 243, 53, 3, 2, 2, 2, 244, 248, 5, 64, 31, 2, 245, 247, 5, 62, 30, 2, 246, 245, 3, 2, 2, 2, 247, 250, 3, 2, 2, 2, 248, 246, 3, 2, 2, 2, 248, 249, 3, 2, 2, 2, 249, 55, 3, 2, 2, 2, 250, 248, 3, 2, 2, 2, 251, 252, 9, 7, 2, 2, 252, 253, 3, 2, 2, 2, 253, 254, 8, 27, 3, 2, 254, 57, 3, 2, 2, 2, 255, 256, 9, 8, 2, 2, 256, 59, 3, 2, 2, 2, 257, 258, 9, 9, 2, 2, 258, 61, 3, 2, 2, 2, 259, 265, 5, 64, 31, 2, 260, 265, 5, 10, 4, 2, 261, 265, 9, 10, 2, 2, 262, 265, 5, 60, 29, 2, 263, 265, 9, 11, 2, 2, 264, 259, 3, 2, 2, 2, 264, 260, 3, 2, 2, 2, 264, 261, 3, 2, 2, 2, 264, 262, 3, 2, 2, 2, 264, 263, 3, 2, 2, 2, 265, 63, 3, 2, 2, 2, 266, 268, 9, 12, 2, 2, 267, 266, 3, 2, 2, 2, 268, 65, 3, 2, 2, 2, 269, 270, 7, 65, 2, 2, 270, 271, 7, 64, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 8, 32, 7, 2, 273, 67, 3, 2, 2, 2, 274, 275, 11, 2, 2, 2, 275, 276, 3, 2, 2, 2, 276, 277, 8, 33, 5, 2, 277, 69, 3, 2, 2, 2, 23, 2, 3, 4, 5, 91, 109, 122, 139, 150, 154, 158, 161, 163, 195, 200, 230, 238, 242, 248, 264, 267, 8, 7, 3, 2, 8, 2, 2, 7, 4, 2, 5, 2, 2, 7, 5, 2, 6, 2, 2] \ No newline at end of file diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.java b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.java index 9fe151aec..eb609a14d 100755 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.java +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.java @@ -17,43 +17,45 @@ public class XMLLexer extends Lexer { protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int - COLON=1, NOT=2, DASH=3, COMMENT=4, CDATA=5, DTD=6, EntityRef=7, CharRef=8, - SEA_WS=9, OPEN=10, OPEN_SLASH=11, XMLDeclOpen=12, TEXT=13, CLOSE=14, SPECIAL_CLOSE=15, - SLASH_CLOSE=16, SLASH=17, EQUALS=18, STRING=19, Name=20, S=21, PI=22; + COLON=1, NOT=2, DASH=3, COMMENT_START=4, COMMENT_END=5, COMMENT=6, CDATA=7, + DTD=8, EntityRef=9, CharRef=10, SEA_WS=11, OPEN=12, OPEN_SLASH=13, XMLDeclOpen=14, + TEXT=15, CommentText=16, CommentModeEnd=17, CLOSE=18, SPECIAL_CLOSE=19, + SLASH_CLOSE=20, SLASH=21, EQUALS=22, STRING=23, Name=24, S=25, PI=26; public static final int - INSIDE=1, PROC_INSTR=2; + COMMENT_MODE=1, TAG_MODE=2, PROC_INSTR=3; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; public static String[] modeNames = { - "DEFAULT_MODE", "INSIDE", "PROC_INSTR" + "DEFAULT_MODE", "COMMENT_MODE", "TAG_MODE", "PROC_INSTR" }; private static String[] makeRuleNames() { return new String[] { - "COLON", "NOT", "DASH", "COMMENT", "CDATA", "DTD", "EntityRef", "CharRef", - "SEA_WS", "OPEN", "OPEN_SLASH", "XMLDeclOpen", "SPECIAL_OPEN", "TEXT", - "CLOSE", "SPECIAL_CLOSE", "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", - "Name", "S", "HEXDIGIT", "DIGIT", "NameChar", "NameStartChar", "PI", - "IGNORE" + "COLON", "NOT", "DASH", "COMMENT_START", "COMMENT_END", "COMMENT", "CDATA", + "DTD", "EntityRef", "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", "XMLDeclOpen", + "SPECIAL_OPEN", "TEXT", "CommentText", "CommentModeEnd", "CLOSE", "SPECIAL_CLOSE", + "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", "Name", "S", "HEXDIGIT", + "DIGIT", "NameChar", "NameStartChar", "PI", "IGNORE" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, "':'", "'!'", "'-'", null, null, null, null, null, null, "'<'", - "''", null, "'/>'", "'/'", "'='" + null, "':'", "'!'", "'-'", null, null, null, null, null, null, null, + null, "'<'", "''", null, "'/>'", "'/'", + "'='" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { - null, "COLON", "NOT", "DASH", "COMMENT", "CDATA", "DTD", "EntityRef", - "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", "XMLDeclOpen", "TEXT", "CLOSE", - "SPECIAL_CLOSE", "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", "Name", - "S", "PI" + null, "COLON", "NOT", "DASH", "COMMENT_START", "COMMENT_END", "COMMENT", + "CDATA", "DTD", "EntityRef", "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", + "XMLDeclOpen", "TEXT", "CommentText", "CommentModeEnd", "CLOSE", "SPECIAL_CLOSE", + "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", "Name", "S", "PI" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -115,89 +117,100 @@ public class XMLLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\30\u00fc\b\1\b\1"+ - "\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4"+ - "\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t"+ - "\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t"+ - "\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\3\2\3\2\3\3\3\3"+ - "\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\7\5J\n\5\f\5\16\5M\13\5\3\5\3\5\3\5\3"+ - "\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\7\6^\n\6\f\6\16\6a\13\6"+ - "\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\7\7k\n\7\f\7\16\7n\13\7\3\7\3\7\3\7\3"+ - "\7\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\6\t|\n\t\r\t\16\t}\3\t\3\t\3\t\3\t"+ - "\3\t\3\t\3\t\6\t\u0087\n\t\r\t\16\t\u0088\3\t\3\t\5\t\u008d\n\t\3\n\3"+ - "\n\5\n\u0091\n\n\3\n\6\n\u0094\n\n\r\n\16\n\u0095\3\13\3\13\3\13\3\13"+ - "\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16"+ - "\3\16\3\16\3\16\3\16\3\16\3\16\3\17\6\17\u00b4\n\17\r\17\16\17\u00b5\3"+ - "\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3"+ - "\23\3\23\3\24\3\24\3\25\3\25\7\25\u00cc\n\25\f\25\16\25\u00cf\13\25\3"+ - "\25\3\25\3\25\7\25\u00d4\n\25\f\25\16\25\u00d7\13\25\3\25\5\25\u00da\n"+ - "\25\3\26\3\26\7\26\u00de\n\26\f\26\16\26\u00e1\13\26\3\27\3\27\3\27\3"+ - "\27\3\30\3\30\3\31\3\31\3\32\3\32\3\32\3\32\5\32\u00ef\n\32\3\33\5\33"+ - "\u00f2\n\33\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\5K_l\2\36\5\3"+ - "\7\4\t\5\13\6\r\7\17\b\21\t\23\n\25\13\27\f\31\r\33\16\35\2\37\17!\20"+ - "#\21%\22\'\23)\24+\25-\26/\27\61\2\63\2\65\2\67\29\30;\2\5\2\3\4\f\4\2"+ - "\13\13\"\"\4\2((>>\4\2$$>>\4\2))>>\5\2\13\f\17\17\"\"\5\2\62;CHch\3\2"+ - "\62;\4\2/\60aa\5\2\u00b9\u00b9\u0302\u0371\u2041\u2042\n\2<\7"+ - "<\2\2>\6\3\2\2\2?@\7#\2\2@\b\3\2\2\2AB\7/\2\2B\n\3\2\2\2CD\7>\2\2DE\7"+ - "#\2\2EF\7/\2\2FG\7/\2\2GK\3\2\2\2HJ\13\2\2\2IH\3\2\2\2JM\3\2\2\2KL\3\2"+ - "\2\2KI\3\2\2\2LN\3\2\2\2MK\3\2\2\2NO\7/\2\2OP\7/\2\2PQ\7@\2\2Q\f\3\2\2"+ - "\2RS\7>\2\2ST\7#\2\2TU\7]\2\2UV\7E\2\2VW\7F\2\2WX\7C\2\2XY\7V\2\2YZ\7"+ - "C\2\2Z[\7]\2\2[_\3\2\2\2\\^\13\2\2\2]\\\3\2\2\2^a\3\2\2\2_`\3\2\2\2_]"+ - "\3\2\2\2`b\3\2\2\2a_\3\2\2\2bc\7_\2\2cd\7_\2\2de\7@\2\2e\16\3\2\2\2fg"+ - "\7>\2\2gh\7#\2\2hl\3\2\2\2ik\13\2\2\2ji\3\2\2\2kn\3\2\2\2lm\3\2\2\2lj"+ - "\3\2\2\2mo\3\2\2\2nl\3\2\2\2op\7@\2\2pq\3\2\2\2qr\b\7\2\2r\20\3\2\2\2"+ - "st\7(\2\2tu\5-\26\2uv\7=\2\2v\22\3\2\2\2wx\7(\2\2xy\7%\2\2y{\3\2\2\2z"+ - "|\5\63\31\2{z\3\2\2\2|}\3\2\2\2}{\3\2\2\2}~\3\2\2\2~\177\3\2\2\2\177\u0080"+ - "\7=\2\2\u0080\u008d\3\2\2\2\u0081\u0082\7(\2\2\u0082\u0083\7%\2\2\u0083"+ - "\u0084\7z\2\2\u0084\u0086\3\2\2\2\u0085\u0087\5\61\30\2\u0086\u0085\3"+ - "\2\2\2\u0087\u0088\3\2\2\2\u0088\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089"+ - "\u008a\3\2\2\2\u008a\u008b\7=\2\2\u008b\u008d\3\2\2\2\u008cw\3\2\2\2\u008c"+ - "\u0081\3\2\2\2\u008d\24\3\2\2\2\u008e\u0094\t\2\2\2\u008f\u0091\7\17\2"+ - "\2\u0090\u008f\3\2\2\2\u0090\u0091\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0094"+ - "\7\f\2\2\u0093\u008e\3\2\2\2\u0093\u0090\3\2\2\2\u0094\u0095\3\2\2\2\u0095"+ - "\u0093\3\2\2\2\u0095\u0096\3\2\2\2\u0096\26\3\2\2\2\u0097\u0098\7>\2\2"+ - "\u0098\u0099\3\2\2\2\u0099\u009a\b\13\3\2\u009a\30\3\2\2\2\u009b\u009c"+ - "\7>\2\2\u009c\u009d\7\61\2\2\u009d\u009e\3\2\2\2\u009e\u009f\b\f\3\2\u009f"+ - "\32\3\2\2\2\u00a0\u00a1\7>\2\2\u00a1\u00a2\7A\2\2\u00a2\u00a3\7z\2\2\u00a3"+ - "\u00a4\7o\2\2\u00a4\u00a5\7n\2\2\u00a5\u00a6\3\2\2\2\u00a6\u00a7\5/\27"+ - "\2\u00a7\u00a8\3\2\2\2\u00a8\u00a9\b\r\3\2\u00a9\34\3\2\2\2\u00aa\u00ab"+ - "\7>\2\2\u00ab\u00ac\7A\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00ae\5-\26\2\u00ae"+ - "\u00af\3\2\2\2\u00af\u00b0\b\16\4\2\u00b0\u00b1\b\16\5\2\u00b1\36\3\2"+ - "\2\2\u00b2\u00b4\n\3\2\2\u00b3\u00b2\3\2\2\2\u00b4\u00b5\3\2\2\2\u00b5"+ - "\u00b3\3\2\2\2\u00b5\u00b6\3\2\2\2\u00b6 \3\2\2\2\u00b7\u00b8\7@\2\2\u00b8"+ - "\u00b9\3\2\2\2\u00b9\u00ba\b\20\6\2\u00ba\"\3\2\2\2\u00bb\u00bc\7A\2\2"+ - "\u00bc\u00bd\7@\2\2\u00bd\u00be\3\2\2\2\u00be\u00bf\b\21\6\2\u00bf$\3"+ - "\2\2\2\u00c0\u00c1\7\61\2\2\u00c1\u00c2\7@\2\2\u00c2\u00c3\3\2\2\2\u00c3"+ - "\u00c4\b\22\6\2\u00c4&\3\2\2\2\u00c5\u00c6\7\61\2\2\u00c6(\3\2\2\2\u00c7"+ - "\u00c8\7?\2\2\u00c8*\3\2\2\2\u00c9\u00cd\7$\2\2\u00ca\u00cc\n\4\2\2\u00cb"+ - "\u00ca\3\2\2\2\u00cc\u00cf\3\2\2\2\u00cd\u00cb\3\2\2\2\u00cd\u00ce\3\2"+ - "\2\2\u00ce\u00d0\3\2\2\2\u00cf\u00cd\3\2\2\2\u00d0\u00da\7$\2\2\u00d1"+ - "\u00d5\7)\2\2\u00d2\u00d4\n\5\2\2\u00d3\u00d2\3\2\2\2\u00d4\u00d7\3\2"+ - "\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2\u00d6\u00d8\3\2\2\2\u00d7"+ - "\u00d5\3\2\2\2\u00d8\u00da\7)\2\2\u00d9\u00c9\3\2\2\2\u00d9\u00d1\3\2"+ - "\2\2\u00da,\3\2\2\2\u00db\u00df\5\67\33\2\u00dc\u00de\5\65\32\2\u00dd"+ - "\u00dc\3\2\2\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0\3\2"+ - "\2\2\u00e0.\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2\u00e3\t\6\2\2\u00e3\u00e4"+ - "\3\2\2\2\u00e4\u00e5\b\27\2\2\u00e5\60\3\2\2\2\u00e6\u00e7\t\7\2\2\u00e7"+ - "\62\3\2\2\2\u00e8\u00e9\t\b\2\2\u00e9\64\3\2\2\2\u00ea\u00ef\5\67\33\2"+ - "\u00eb\u00ef\t\t\2\2\u00ec\u00ef\5\63\31\2\u00ed\u00ef\t\n\2\2\u00ee\u00ea"+ - "\3\2\2\2\u00ee\u00eb\3\2\2\2\u00ee\u00ec\3\2\2\2\u00ee\u00ed\3\2\2\2\u00ef"+ - "\66\3\2\2\2\u00f0\u00f2\t\13\2\2\u00f1\u00f0\3\2\2\2\u00f28\3\2\2\2\u00f3"+ - "\u00f4\7A\2\2\u00f4\u00f5\7@\2\2\u00f5\u00f6\3\2\2\2\u00f6\u00f7\b\34"+ - "\6\2\u00f7:\3\2\2\2\u00f8\u00f9\13\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00fb"+ - "\b\35\4\2\u00fb<\3\2\2\2\25\2\3\4K_l}\u0088\u008c\u0090\u0093\u0095\u00b5"+ - "\u00cd\u00d5\u00d9\u00df\u00ee\u00f1\7\b\2\2\7\3\2\5\2\2\7\4\2\6\2\2"; + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\34\u0116\b\1\b\1"+ + "\b\1\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t"+ + "\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21"+ + "\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30"+ + "\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37"+ + "\t\37\4 \t \4!\t!\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5"+ + "\3\6\3\6\3\6\3\6\3\7\3\7\7\7Z\n\7\f\7\16\7]\13\7\3\7\3\7\3\b\3\b\3\b\3"+ + "\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\7\bl\n\b\f\b\16\bo\13\b\3\b\3\b\3\b\3\b"+ + "\3\t\3\t\3\t\3\t\7\ty\n\t\f\t\16\t|\13\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3"+ + "\n\3\13\3\13\3\13\3\13\6\13\u008a\n\13\r\13\16\13\u008b\3\13\3\13\3\13"+ + "\3\13\3\13\3\13\3\13\6\13\u0095\n\13\r\13\16\13\u0096\3\13\3\13\5\13\u009b"+ + "\n\13\3\f\3\f\5\f\u009f\n\f\3\f\6\f\u00a2\n\f\r\f\16\f\u00a3\3\r\3\r\3"+ + "\r\3\r\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17"+ + "\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\21\6\21\u00c2\n\21"+ + "\r\21\16\21\u00c3\3\22\6\22\u00c7\n\22\r\22\16\22\u00c8\3\22\3\22\3\23"+ + "\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\26\3\26"+ + "\3\26\3\26\3\26\3\27\3\27\3\30\3\30\3\31\3\31\7\31\u00e5\n\31\f\31\16"+ + "\31\u00e8\13\31\3\31\3\31\3\31\7\31\u00ed\n\31\f\31\16\31\u00f0\13\31"+ + "\3\31\5\31\u00f3\n\31\3\32\3\32\7\32\u00f7\n\32\f\32\16\32\u00fa\13\32"+ + "\3\33\3\33\3\33\3\33\3\34\3\34\3\35\3\35\3\36\3\36\3\36\3\36\3\36\5\36"+ + "\u0109\n\36\3\37\5\37\u010c\n\37\3 \3 \3 \3 \3 \3!\3!\3!\3!\5[mz\2\"\6"+ + "\3\b\4\n\5\f\6\16\7\20\b\22\t\24\n\26\13\30\f\32\r\34\16\36\17 \20\"\2"+ + "$\21&\22(\23*\24,\25.\26\60\27\62\30\64\31\66\328\33:\2<\2>\2@\2B\34D"+ + "\2\6\2\3\4\5\r\4\2\13\13\"\"\4\2((>>\5\2((//>>\4\2$$>>\4\2))>>\5\2\13"+ + "\f\17\17\"\"\5\2\62;CHch\3\2\62;\4\2\60\60aa\5\2\u00b9\u00b9\u0302\u0371"+ + "\u2041\u2042\n\2<\u0108\3\2\2\2@\u010b\3\2\2\2B\u010d\3\2\2\2D\u0112\3\2\2\2FG\7<\2\2"+ + "G\7\3\2\2\2HI\7#\2\2I\t\3\2\2\2JK\7/\2\2K\13\3\2\2\2LM\7>\2\2MN\5\b\3"+ + "\2NO\5\n\4\2OP\5\n\4\2PQ\3\2\2\2QR\b\5\2\2R\r\3\2\2\2ST\5\n\4\2TU\5\n"+ + "\4\2UV\7@\2\2V\17\3\2\2\2W[\5\f\5\2XZ\13\2\2\2YX\3\2\2\2Z]\3\2\2\2[\\"+ + "\3\2\2\2[Y\3\2\2\2\\^\3\2\2\2][\3\2\2\2^_\5\16\6\2_\21\3\2\2\2`a\7>\2"+ + "\2ab\7#\2\2bc\7]\2\2cd\7E\2\2de\7F\2\2ef\7C\2\2fg\7V\2\2gh\7C\2\2hi\7"+ + "]\2\2im\3\2\2\2jl\13\2\2\2kj\3\2\2\2lo\3\2\2\2mn\3\2\2\2mk\3\2\2\2np\3"+ + "\2\2\2om\3\2\2\2pq\7_\2\2qr\7_\2\2rs\7@\2\2s\23\3\2\2\2tu\7>\2\2uv\7#"+ + "\2\2vz\3\2\2\2wy\13\2\2\2xw\3\2\2\2y|\3\2\2\2z{\3\2\2\2zx\3\2\2\2{}\3"+ + "\2\2\2|z\3\2\2\2}~\7@\2\2~\177\3\2\2\2\177\u0080\b\t\3\2\u0080\25\3\2"+ + "\2\2\u0081\u0082\7(\2\2\u0082\u0083\5\66\32\2\u0083\u0084\7=\2\2\u0084"+ + "\27\3\2\2\2\u0085\u0086\7(\2\2\u0086\u0087\7%\2\2\u0087\u0089\3\2\2\2"+ + "\u0088\u008a\5<\35\2\u0089\u0088\3\2\2\2\u008a\u008b\3\2\2\2\u008b\u0089"+ + "\3\2\2\2\u008b\u008c\3\2\2\2\u008c\u008d\3\2\2\2\u008d\u008e\7=\2\2\u008e"+ + "\u009b\3\2\2\2\u008f\u0090\7(\2\2\u0090\u0091\7%\2\2\u0091\u0092\7z\2"+ + "\2\u0092\u0094\3\2\2\2\u0093\u0095\5:\34\2\u0094\u0093\3\2\2\2\u0095\u0096"+ + "\3\2\2\2\u0096\u0094\3\2\2\2\u0096\u0097\3\2\2\2\u0097\u0098\3\2\2\2\u0098"+ + "\u0099\7=\2\2\u0099\u009b\3\2\2\2\u009a\u0085\3\2\2\2\u009a\u008f\3\2"+ + "\2\2\u009b\31\3\2\2\2\u009c\u00a2\t\2\2\2\u009d\u009f\7\17\2\2\u009e\u009d"+ + "\3\2\2\2\u009e\u009f\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a2\7\f\2\2\u00a1"+ + "\u009c\3\2\2\2\u00a1\u009e\3\2\2\2\u00a2\u00a3\3\2\2\2\u00a3\u00a1\3\2"+ + "\2\2\u00a3\u00a4\3\2\2\2\u00a4\33\3\2\2\2\u00a5\u00a6\7>\2\2\u00a6\u00a7"+ + "\3\2\2\2\u00a7\u00a8\b\r\4\2\u00a8\35\3\2\2\2\u00a9\u00aa\7>\2\2\u00aa"+ + "\u00ab\7\61\2\2\u00ab\u00ac\3\2\2\2\u00ac\u00ad\b\16\4\2\u00ad\37\3\2"+ + "\2\2\u00ae\u00af\7>\2\2\u00af\u00b0\7A\2\2\u00b0\u00b1\7z\2\2\u00b1\u00b2"+ + "\7o\2\2\u00b2\u00b3\7n\2\2\u00b3\u00b4\3\2\2\2\u00b4\u00b5\58\33\2\u00b5"+ + "\u00b6\3\2\2\2\u00b6\u00b7\b\17\4\2\u00b7!\3\2\2\2\u00b8\u00b9\7>\2\2"+ + "\u00b9\u00ba\7A\2\2\u00ba\u00bb\3\2\2\2\u00bb\u00bc\5\66\32\2\u00bc\u00bd"+ + "\3\2\2\2\u00bd\u00be\b\20\5\2\u00be\u00bf\b\20\6\2\u00bf#\3\2\2\2\u00c0"+ + "\u00c2\n\3\2\2\u00c1\u00c0\3\2\2\2\u00c2\u00c3\3\2\2\2\u00c3\u00c1\3\2"+ + "\2\2\u00c3\u00c4\3\2\2\2\u00c4%\3\2\2\2\u00c5\u00c7\n\4\2\2\u00c6\u00c5"+ + "\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8\u00c6\3\2\2\2\u00c8\u00c9\3\2\2\2\u00c9"+ + "\u00ca\3\2\2\2\u00ca\u00cb\b\22\3\2\u00cb\'\3\2\2\2\u00cc\u00cd\5\16\6"+ + "\2\u00cd\u00ce\3\2\2\2\u00ce\u00cf\b\23\7\2\u00cf)\3\2\2\2\u00d0\u00d1"+ + "\7@\2\2\u00d1\u00d2\3\2\2\2\u00d2\u00d3\b\24\7\2\u00d3+\3\2\2\2\u00d4"+ + "\u00d5\7A\2\2\u00d5\u00d6\7@\2\2\u00d6\u00d7\3\2\2\2\u00d7\u00d8\b\25"+ + "\7\2\u00d8-\3\2\2\2\u00d9\u00da\7\61\2\2\u00da\u00db\7@\2\2\u00db\u00dc"+ + "\3\2\2\2\u00dc\u00dd\b\26\7\2\u00dd/\3\2\2\2\u00de\u00df\7\61\2\2\u00df"+ + "\61\3\2\2\2\u00e0\u00e1\7?\2\2\u00e1\63\3\2\2\2\u00e2\u00e6\7$\2\2\u00e3"+ + "\u00e5\n\5\2\2\u00e4\u00e3\3\2\2\2\u00e5\u00e8\3\2\2\2\u00e6\u00e4\3\2"+ + "\2\2\u00e6\u00e7\3\2\2\2\u00e7\u00e9\3\2\2\2\u00e8\u00e6\3\2\2\2\u00e9"+ + "\u00f3\7$\2\2\u00ea\u00ee\7)\2\2\u00eb\u00ed\n\6\2\2\u00ec\u00eb\3\2\2"+ + "\2\u00ed\u00f0\3\2\2\2\u00ee\u00ec\3\2\2\2\u00ee\u00ef\3\2\2\2\u00ef\u00f1"+ + "\3\2\2\2\u00f0\u00ee\3\2\2\2\u00f1\u00f3\7)\2\2\u00f2\u00e2\3\2\2\2\u00f2"+ + "\u00ea\3\2\2\2\u00f3\65\3\2\2\2\u00f4\u00f8\5@\37\2\u00f5\u00f7\5>\36"+ + "\2\u00f6\u00f5\3\2\2\2\u00f7\u00fa\3\2\2\2\u00f8\u00f6\3\2\2\2\u00f8\u00f9"+ + "\3\2\2\2\u00f9\67\3\2\2\2\u00fa\u00f8\3\2\2\2\u00fb\u00fc\t\7\2\2\u00fc"+ + "\u00fd\3\2\2\2\u00fd\u00fe\b\33\3\2\u00fe9\3\2\2\2\u00ff\u0100\t\b\2\2"+ + "\u0100;\3\2\2\2\u0101\u0102\t\t\2\2\u0102=\3\2\2\2\u0103\u0109\5@\37\2"+ + "\u0104\u0109\5\n\4\2\u0105\u0109\t\n\2\2\u0106\u0109\5<\35\2\u0107\u0109"+ + "\t\13\2\2\u0108\u0103\3\2\2\2\u0108\u0104\3\2\2\2\u0108\u0105\3\2\2\2"+ + "\u0108\u0106\3\2\2\2\u0108\u0107\3\2\2\2\u0109?\3\2\2\2\u010a\u010c\t"+ + "\f\2\2\u010b\u010a\3\2\2\2\u010cA\3\2\2\2\u010d\u010e\7A\2\2\u010e\u010f"+ + "\7@\2\2\u010f\u0110\3\2\2\2\u0110\u0111\b \7\2\u0111C\3\2\2\2\u0112\u0113"+ + "\13\2\2\2\u0113\u0114\3\2\2\2\u0114\u0115\b!\5\2\u0115E\3\2\2\2\27\2\3"+ + "\4\5[mz\u008b\u0096\u009a\u009e\u00a1\u00a3\u00c3\u00c8\u00e6\u00ee\u00f2"+ + "\u00f8\u0108\u010b\b\7\3\2\b\2\2\7\4\2\5\2\2\7\5\2\6\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.tokens b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.tokens index 74655e025..cdf1f8f41 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.tokens +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLLexer.tokens @@ -1,31 +1,35 @@ COLON=1 NOT=2 DASH=3 -COMMENT=4 -CDATA=5 -DTD=6 -EntityRef=7 -CharRef=8 -SEA_WS=9 -OPEN=10 -OPEN_SLASH=11 -XMLDeclOpen=12 -TEXT=13 -CLOSE=14 -SPECIAL_CLOSE=15 -SLASH_CLOSE=16 -SLASH=17 -EQUALS=18 -STRING=19 -Name=20 -S=21 -PI=22 +COMMENT_START=4 +COMMENT_END=5 +COMMENT=6 +CDATA=7 +DTD=8 +EntityRef=9 +CharRef=10 +SEA_WS=11 +OPEN=12 +OPEN_SLASH=13 +XMLDeclOpen=14 +TEXT=15 +CommentText=16 +CommentModeEnd=17 +CLOSE=18 +SPECIAL_CLOSE=19 +SLASH_CLOSE=20 +SLASH=21 +EQUALS=22 +STRING=23 +Name=24 +S=25 +PI=26 ':'=1 '!'=2 '-'=3 -'<'=10 -''=14 -'/>'=16 -'/'=17 -'='=18 +'<'=12 +''=18 +'/>'=20 +'/'=21 +'='=22 diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.interp b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.interp index 987ea54e7..5f4d64a3d 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.interp +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.interp @@ -9,10 +9,14 @@ null null null null +null +null '<' '' null '/>' @@ -28,6 +32,8 @@ null COLON NOT DASH +COMMENT_START +COMMENT_END COMMENT CDATA DTD @@ -38,6 +44,8 @@ OPEN OPEN_SLASH XMLDeclOpen TEXT +CommentText +CommentModeEnd CLOSE SPECIAL_CLOSE SLASH_CLOSE @@ -63,4 +71,4 @@ misc atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 24, 112, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 3, 2, 5, 2, 26, 10, 2, 3, 2, 7, 2, 29, 10, 2, 12, 2, 14, 2, 32, 11, 2, 3, 2, 3, 2, 7, 2, 36, 10, 2, 12, 2, 14, 2, 39, 11, 2, 3, 3, 3, 3, 7, 3, 43, 10, 3, 12, 3, 14, 3, 46, 11, 3, 3, 3, 3, 3, 3, 4, 5, 4, 51, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 58, 10, 4, 3, 4, 5, 4, 61, 10, 4, 7, 4, 63, 10, 4, 12, 4, 14, 4, 66, 11, 4, 3, 5, 3, 5, 5, 5, 70, 10, 5, 3, 6, 3, 6, 3, 6, 7, 6, 75, 10, 6, 12, 6, 14, 6, 78, 11, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 7, 7, 89, 10, 7, 12, 7, 14, 7, 92, 11, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 5, 9, 99, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 2, 2, 13, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 2, 5, 3, 2, 9, 10, 4, 2, 11, 11, 15, 15, 5, 2, 6, 6, 11, 11, 24, 24, 2, 115, 2, 25, 3, 2, 2, 2, 4, 40, 3, 2, 2, 2, 6, 50, 3, 2, 2, 2, 8, 69, 3, 2, 2, 2, 10, 71, 3, 2, 2, 2, 12, 85, 3, 2, 2, 2, 14, 95, 3, 2, 2, 2, 16, 98, 3, 2, 2, 2, 18, 104, 3, 2, 2, 2, 20, 107, 3, 2, 2, 2, 22, 109, 3, 2, 2, 2, 24, 26, 5, 4, 3, 2, 25, 24, 3, 2, 2, 2, 25, 26, 3, 2, 2, 2, 26, 30, 3, 2, 2, 2, 27, 29, 5, 22, 12, 2, 28, 27, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 33, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 37, 5, 8, 5, 2, 34, 36, 5, 22, 12, 2, 35, 34, 3, 2, 2, 2, 36, 39, 3, 2, 2, 2, 37, 35, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 3, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 40, 44, 7, 14, 2, 2, 41, 43, 5, 16, 9, 2, 42, 41, 3, 2, 2, 2, 43, 46, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 47, 3, 2, 2, 2, 46, 44, 3, 2, 2, 2, 47, 48, 7, 17, 2, 2, 48, 5, 3, 2, 2, 2, 49, 51, 5, 20, 11, 2, 50, 49, 3, 2, 2, 2, 50, 51, 3, 2, 2, 2, 51, 64, 3, 2, 2, 2, 52, 58, 5, 8, 5, 2, 53, 58, 5, 14, 8, 2, 54, 58, 7, 7, 2, 2, 55, 58, 7, 24, 2, 2, 56, 58, 7, 6, 2, 2, 57, 52, 3, 2, 2, 2, 57, 53, 3, 2, 2, 2, 57, 54, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 57, 56, 3, 2, 2, 2, 58, 60, 3, 2, 2, 2, 59, 61, 5, 20, 11, 2, 60, 59, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 63, 3, 2, 2, 2, 62, 57, 3, 2, 2, 2, 63, 66, 3, 2, 2, 2, 64, 62, 3, 2, 2, 2, 64, 65, 3, 2, 2, 2, 65, 7, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 67, 70, 5, 10, 6, 2, 68, 70, 5, 12, 7, 2, 69, 67, 3, 2, 2, 2, 69, 68, 3, 2, 2, 2, 70, 9, 3, 2, 2, 2, 71, 72, 7, 12, 2, 2, 72, 76, 7, 22, 2, 2, 73, 75, 5, 16, 9, 2, 74, 73, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 79, 3, 2, 2, 2, 78, 76, 3, 2, 2, 2, 79, 80, 7, 16, 2, 2, 80, 81, 5, 6, 4, 2, 81, 82, 7, 13, 2, 2, 82, 83, 7, 22, 2, 2, 83, 84, 7, 16, 2, 2, 84, 11, 3, 2, 2, 2, 85, 86, 7, 12, 2, 2, 86, 90, 7, 22, 2, 2, 87, 89, 5, 16, 9, 2, 88, 87, 3, 2, 2, 2, 89, 92, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 90, 91, 3, 2, 2, 2, 91, 93, 3, 2, 2, 2, 92, 90, 3, 2, 2, 2, 93, 94, 7, 18, 2, 2, 94, 13, 3, 2, 2, 2, 95, 96, 9, 2, 2, 2, 96, 15, 3, 2, 2, 2, 97, 99, 5, 18, 10, 2, 98, 97, 3, 2, 2, 2, 98, 99, 3, 2, 2, 2, 99, 100, 3, 2, 2, 2, 100, 101, 7, 22, 2, 2, 101, 102, 7, 20, 2, 2, 102, 103, 7, 21, 2, 2, 103, 17, 3, 2, 2, 2, 104, 105, 7, 22, 2, 2, 105, 106, 7, 3, 2, 2, 106, 19, 3, 2, 2, 2, 107, 108, 9, 3, 2, 2, 108, 21, 3, 2, 2, 2, 109, 110, 9, 4, 2, 2, 110, 23, 3, 2, 2, 2, 14, 25, 30, 37, 44, 50, 57, 60, 64, 69, 76, 90, 98] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 28, 112, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 3, 2, 5, 2, 26, 10, 2, 3, 2, 7, 2, 29, 10, 2, 12, 2, 14, 2, 32, 11, 2, 3, 2, 3, 2, 7, 2, 36, 10, 2, 12, 2, 14, 2, 39, 11, 2, 3, 3, 3, 3, 7, 3, 43, 10, 3, 12, 3, 14, 3, 46, 11, 3, 3, 3, 3, 3, 3, 4, 5, 4, 51, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 58, 10, 4, 3, 4, 5, 4, 61, 10, 4, 7, 4, 63, 10, 4, 12, 4, 14, 4, 66, 11, 4, 3, 5, 3, 5, 5, 5, 70, 10, 5, 3, 6, 3, 6, 3, 6, 7, 6, 75, 10, 6, 12, 6, 14, 6, 78, 11, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 7, 7, 89, 10, 7, 12, 7, 14, 7, 92, 11, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 5, 9, 99, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 2, 2, 13, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 2, 5, 3, 2, 11, 12, 4, 2, 13, 13, 17, 17, 5, 2, 8, 8, 13, 13, 28, 28, 2, 115, 2, 25, 3, 2, 2, 2, 4, 40, 3, 2, 2, 2, 6, 50, 3, 2, 2, 2, 8, 69, 3, 2, 2, 2, 10, 71, 3, 2, 2, 2, 12, 85, 3, 2, 2, 2, 14, 95, 3, 2, 2, 2, 16, 98, 3, 2, 2, 2, 18, 104, 3, 2, 2, 2, 20, 107, 3, 2, 2, 2, 22, 109, 3, 2, 2, 2, 24, 26, 5, 4, 3, 2, 25, 24, 3, 2, 2, 2, 25, 26, 3, 2, 2, 2, 26, 30, 3, 2, 2, 2, 27, 29, 5, 22, 12, 2, 28, 27, 3, 2, 2, 2, 29, 32, 3, 2, 2, 2, 30, 28, 3, 2, 2, 2, 30, 31, 3, 2, 2, 2, 31, 33, 3, 2, 2, 2, 32, 30, 3, 2, 2, 2, 33, 37, 5, 8, 5, 2, 34, 36, 5, 22, 12, 2, 35, 34, 3, 2, 2, 2, 36, 39, 3, 2, 2, 2, 37, 35, 3, 2, 2, 2, 37, 38, 3, 2, 2, 2, 38, 3, 3, 2, 2, 2, 39, 37, 3, 2, 2, 2, 40, 44, 7, 16, 2, 2, 41, 43, 5, 16, 9, 2, 42, 41, 3, 2, 2, 2, 43, 46, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 44, 45, 3, 2, 2, 2, 45, 47, 3, 2, 2, 2, 46, 44, 3, 2, 2, 2, 47, 48, 7, 21, 2, 2, 48, 5, 3, 2, 2, 2, 49, 51, 5, 20, 11, 2, 50, 49, 3, 2, 2, 2, 50, 51, 3, 2, 2, 2, 51, 64, 3, 2, 2, 2, 52, 58, 5, 8, 5, 2, 53, 58, 5, 14, 8, 2, 54, 58, 7, 9, 2, 2, 55, 58, 7, 28, 2, 2, 56, 58, 7, 8, 2, 2, 57, 52, 3, 2, 2, 2, 57, 53, 3, 2, 2, 2, 57, 54, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 57, 56, 3, 2, 2, 2, 58, 60, 3, 2, 2, 2, 59, 61, 5, 20, 11, 2, 60, 59, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 63, 3, 2, 2, 2, 62, 57, 3, 2, 2, 2, 63, 66, 3, 2, 2, 2, 64, 62, 3, 2, 2, 2, 64, 65, 3, 2, 2, 2, 65, 7, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 67, 70, 5, 10, 6, 2, 68, 70, 5, 12, 7, 2, 69, 67, 3, 2, 2, 2, 69, 68, 3, 2, 2, 2, 70, 9, 3, 2, 2, 2, 71, 72, 7, 14, 2, 2, 72, 76, 7, 26, 2, 2, 73, 75, 5, 16, 9, 2, 74, 73, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 79, 3, 2, 2, 2, 78, 76, 3, 2, 2, 2, 79, 80, 7, 20, 2, 2, 80, 81, 5, 6, 4, 2, 81, 82, 7, 15, 2, 2, 82, 83, 7, 26, 2, 2, 83, 84, 7, 20, 2, 2, 84, 11, 3, 2, 2, 2, 85, 86, 7, 14, 2, 2, 86, 90, 7, 26, 2, 2, 87, 89, 5, 16, 9, 2, 88, 87, 3, 2, 2, 2, 89, 92, 3, 2, 2, 2, 90, 88, 3, 2, 2, 2, 90, 91, 3, 2, 2, 2, 91, 93, 3, 2, 2, 2, 92, 90, 3, 2, 2, 2, 93, 94, 7, 22, 2, 2, 94, 13, 3, 2, 2, 2, 95, 96, 9, 2, 2, 2, 96, 15, 3, 2, 2, 2, 97, 99, 5, 18, 10, 2, 98, 97, 3, 2, 2, 2, 98, 99, 3, 2, 2, 2, 99, 100, 3, 2, 2, 2, 100, 101, 7, 26, 2, 2, 101, 102, 7, 24, 2, 2, 102, 103, 7, 25, 2, 2, 103, 17, 3, 2, 2, 2, 104, 105, 7, 26, 2, 2, 105, 106, 7, 3, 2, 2, 106, 19, 3, 2, 2, 2, 107, 108, 9, 3, 2, 2, 108, 21, 3, 2, 2, 2, 109, 110, 9, 4, 2, 2, 110, 23, 3, 2, 2, 2, 14, 25, 30, 37, 44, 50, 57, 60, 64, 69, 76, 90, 98] \ No newline at end of file diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.java b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.java index 9f7fd8d5e..292aa0ead 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.java +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.java @@ -17,9 +17,10 @@ public class XMLParser extends Parser { protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int - COLON=1, NOT=2, DASH=3, COMMENT=4, CDATA=5, DTD=6, EntityRef=7, CharRef=8, - SEA_WS=9, OPEN=10, OPEN_SLASH=11, XMLDeclOpen=12, TEXT=13, CLOSE=14, SPECIAL_CLOSE=15, - SLASH_CLOSE=16, SLASH=17, EQUALS=18, STRING=19, Name=20, S=21, PI=22; + COLON=1, NOT=2, DASH=3, COMMENT_START=4, COMMENT_END=5, COMMENT=6, CDATA=7, + DTD=8, EntityRef=9, CharRef=10, SEA_WS=11, OPEN=12, OPEN_SLASH=13, XMLDeclOpen=14, + TEXT=15, CommentText=16, CommentModeEnd=17, CLOSE=18, SPECIAL_CLOSE=19, + SLASH_CLOSE=20, SLASH=21, EQUALS=22, STRING=23, Name=24, S=25, PI=26; public static final int RULE_document = 0, RULE_prolog = 1, RULE_content = 2, RULE_element = 3, RULE_nonEmptyClosingElement = 4, RULE_emptyClosingElement = 5, RULE_reference = 6, @@ -35,17 +36,18 @@ public class XMLParser extends Parser { private static String[] makeLiteralNames() { return new String[] { - null, "':'", "'!'", "'-'", null, null, null, null, null, null, "'<'", - "''", null, "'/>'", "'/'", "'='" + null, "':'", "'!'", "'-'", null, null, null, null, null, null, null, + null, "'<'", "''", null, "'/>'", "'/'", + "'='" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { - null, "COLON", "NOT", "DASH", "COMMENT", "CDATA", "DTD", "EntityRef", - "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", "XMLDeclOpen", "TEXT", "CLOSE", - "SPECIAL_CLOSE", "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", "Name", - "S", "PI" + null, "COLON", "NOT", "DASH", "COMMENT_START", "COMMENT_END", "COMMENT", + "CDATA", "DTD", "EntityRef", "CharRef", "SEA_WS", "OPEN", "OPEN_SLASH", + "XMLDeclOpen", "TEXT", "CommentText", "CommentModeEnd", "CLOSE", "SPECIAL_CLOSE", + "SLASH_CLOSE", "SLASH", "EQUALS", "STRING", "Name", "S", "PI" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -876,7 +878,7 @@ public class XMLParser extends Parser { } public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\30p\4\2\t\2\4\3\t"+ + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\34p\4\2\t\2\4\3\t"+ "\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4"+ "\f\t\f\3\2\5\2\32\n\2\3\2\7\2\35\n\2\f\2\16\2 \13\2\3\2\3\2\7\2$\n\2\f"+ "\2\16\2\'\13\2\3\3\3\3\7\3+\n\3\f\3\16\3.\13\3\3\3\3\3\3\4\5\4\63\n\4"+ @@ -884,26 +886,26 @@ public class XMLParser extends Parser { "\3\5\5\5F\n\5\3\6\3\6\3\6\7\6K\n\6\f\6\16\6N\13\6\3\6\3\6\3\6\3\6\3\6"+ "\3\6\3\7\3\7\3\7\7\7Y\n\7\f\7\16\7\\\13\7\3\7\3\7\3\b\3\b\3\t\5\tc\n\t"+ "\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\13\3\13\3\f\3\f\3\f\2\2\r\2\4\6\b\n\f\16"+ - "\20\22\24\26\2\5\3\2\t\n\4\2\13\13\17\17\5\2\6\6\13\13\30\30\2s\2\31\3"+ - "\2\2\2\4(\3\2\2\2\6\62\3\2\2\2\bE\3\2\2\2\nG\3\2\2\2\fU\3\2\2\2\16_\3"+ - "\2\2\2\20b\3\2\2\2\22h\3\2\2\2\24k\3\2\2\2\26m\3\2\2\2\30\32\5\4\3\2\31"+ + "\20\22\24\26\2\5\3\2\13\f\4\2\r\r\21\21\5\2\b\b\r\r\34\34\2s\2\31\3\2"+ + "\2\2\4(\3\2\2\2\6\62\3\2\2\2\bE\3\2\2\2\nG\3\2\2\2\fU\3\2\2\2\16_\3\2"+ + "\2\2\20b\3\2\2\2\22h\3\2\2\2\24k\3\2\2\2\26m\3\2\2\2\30\32\5\4\3\2\31"+ "\30\3\2\2\2\31\32\3\2\2\2\32\36\3\2\2\2\33\35\5\26\f\2\34\33\3\2\2\2\35"+ " \3\2\2\2\36\34\3\2\2\2\36\37\3\2\2\2\37!\3\2\2\2 \36\3\2\2\2!%\5\b\5"+ "\2\"$\5\26\f\2#\"\3\2\2\2$\'\3\2\2\2%#\3\2\2\2%&\3\2\2\2&\3\3\2\2\2\'"+ - "%\3\2\2\2(,\7\16\2\2)+\5\20\t\2*)\3\2\2\2+.\3\2\2\2,*\3\2\2\2,-\3\2\2"+ - "\2-/\3\2\2\2.,\3\2\2\2/\60\7\21\2\2\60\5\3\2\2\2\61\63\5\24\13\2\62\61"+ - "\3\2\2\2\62\63\3\2\2\2\63@\3\2\2\2\64:\5\b\5\2\65:\5\16\b\2\66:\7\7\2"+ - "\2\67:\7\30\2\28:\7\6\2\29\64\3\2\2\29\65\3\2\2\29\66\3\2\2\29\67\3\2"+ + "%\3\2\2\2(,\7\20\2\2)+\5\20\t\2*)\3\2\2\2+.\3\2\2\2,*\3\2\2\2,-\3\2\2"+ + "\2-/\3\2\2\2.,\3\2\2\2/\60\7\25\2\2\60\5\3\2\2\2\61\63\5\24\13\2\62\61"+ + "\3\2\2\2\62\63\3\2\2\2\63@\3\2\2\2\64:\5\b\5\2\65:\5\16\b\2\66:\7\t\2"+ + "\2\67:\7\34\2\28:\7\b\2\29\64\3\2\2\29\65\3\2\2\29\66\3\2\2\29\67\3\2"+ "\2\298\3\2\2\2:<\3\2\2\2;=\5\24\13\2<;\3\2\2\2<=\3\2\2\2=?\3\2\2\2>9\3"+ "\2\2\2?B\3\2\2\2@>\3\2\2\2@A\3\2\2\2A\7\3\2\2\2B@\3\2\2\2CF\5\n\6\2DF"+ - "\5\f\7\2EC\3\2\2\2ED\3\2\2\2F\t\3\2\2\2GH\7\f\2\2HL\7\26\2\2IK\5\20\t"+ - "\2JI\3\2\2\2KN\3\2\2\2LJ\3\2\2\2LM\3\2\2\2MO\3\2\2\2NL\3\2\2\2OP\7\20"+ - "\2\2PQ\5\6\4\2QR\7\r\2\2RS\7\26\2\2ST\7\20\2\2T\13\3\2\2\2UV\7\f\2\2V"+ - "Z\7\26\2\2WY\5\20\t\2XW\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[\3\2\2\2[]\3\2\2"+ - "\2\\Z\3\2\2\2]^\7\22\2\2^\r\3\2\2\2_`\t\2\2\2`\17\3\2\2\2ac\5\22\n\2b"+ - "a\3\2\2\2bc\3\2\2\2cd\3\2\2\2de\7\26\2\2ef\7\24\2\2fg\7\25\2\2g\21\3\2"+ - "\2\2hi\7\26\2\2ij\7\3\2\2j\23\3\2\2\2kl\t\3\2\2l\25\3\2\2\2mn\t\4\2\2"+ - "n\27\3\2\2\2\16\31\36%,\629<@ELZb"; + "\5\f\7\2EC\3\2\2\2ED\3\2\2\2F\t\3\2\2\2GH\7\16\2\2HL\7\32\2\2IK\5\20\t"+ + "\2JI\3\2\2\2KN\3\2\2\2LJ\3\2\2\2LM\3\2\2\2MO\3\2\2\2NL\3\2\2\2OP\7\24"+ + "\2\2PQ\5\6\4\2QR\7\17\2\2RS\7\32\2\2ST\7\24\2\2T\13\3\2\2\2UV\7\16\2\2"+ + "VZ\7\32\2\2WY\5\20\t\2XW\3\2\2\2Y\\\3\2\2\2ZX\3\2\2\2Z[\3\2\2\2[]\3\2"+ + "\2\2\\Z\3\2\2\2]^\7\26\2\2^\r\3\2\2\2_`\t\2\2\2`\17\3\2\2\2ac\5\22\n\2"+ + "ba\3\2\2\2bc\3\2\2\2cd\3\2\2\2de\7\32\2\2ef\7\30\2\2fg\7\31\2\2g\21\3"+ + "\2\2\2hi\7\32\2\2ij\7\3\2\2j\23\3\2\2\2kl\t\3\2\2l\25\3\2\2\2mn\t\4\2"+ + "\2n\27\3\2\2\2\16\31\36%,\629<@ELZb"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.tokens b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.tokens index 74655e025..cdf1f8f41 100644 --- a/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.tokens +++ b/lexers/src/main/java/com/itsaky/androidide/lexers/xml/XMLParser.tokens @@ -1,31 +1,35 @@ COLON=1 NOT=2 DASH=3 -COMMENT=4 -CDATA=5 -DTD=6 -EntityRef=7 -CharRef=8 -SEA_WS=9 -OPEN=10 -OPEN_SLASH=11 -XMLDeclOpen=12 -TEXT=13 -CLOSE=14 -SPECIAL_CLOSE=15 -SLASH_CLOSE=16 -SLASH=17 -EQUALS=18 -STRING=19 -Name=20 -S=21 -PI=22 +COMMENT_START=4 +COMMENT_END=5 +COMMENT=6 +CDATA=7 +DTD=8 +EntityRef=9 +CharRef=10 +SEA_WS=11 +OPEN=12 +OPEN_SLASH=13 +XMLDeclOpen=14 +TEXT=15 +CommentText=16 +CommentModeEnd=17 +CLOSE=18 +SPECIAL_CLOSE=19 +SLASH_CLOSE=20 +SLASH=21 +EQUALS=22 +STRING=23 +Name=24 +S=25 +PI=26 ':'=1 '!'=2 '-'=3 -'<'=10 -''=14 -'/>'=16 -'/'=17 -'='=18 +'<'=12 +''=18 +'/>'=20 +'/'=21 +'='=22 diff --git a/lexers/src/test/java/com/itsaky/androidide/lexers/BaseLexerTest.kt b/lexers/src/test/java/com/itsaky/androidide/lexers/BaseLexerTest.kt new file mode 100644 index 000000000..6dd6248c4 --- /dev/null +++ b/lexers/src/test/java/com/itsaky/androidide/lexers/BaseLexerTest.kt @@ -0,0 +1,39 @@ +/* + * This file is part of AndroidIDE. + * + * AndroidIDE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AndroidIDE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with AndroidIDE. If not, see . + */ + +package com.itsaky.androidide.lexers + +import com.google.common.truth.Truth.assertThat +import org.antlr.v4.runtime.CharStream +import org.antlr.v4.runtime.CharStreams +import org.antlr.v4.runtime.Token + +/** + * Base class for lexer tests. + * + * @author Akash Yadav + */ +open class BaseLexerTest { + protected open fun createStream(input: String): CharStream = CharStreams.fromString(input) + + protected open fun ensureTokenSequence(tokens: List, expectedTypes: List) { + assertThat(tokens.size).isEqualTo(expectedTypes.size) + for ((index, token) in tokens.withIndex()) { + assertThat(token.type).isEqualTo(expectedTypes[index]) + } + } +} diff --git a/lexers/src/test/java/com/itsaky/androidide/lexers/xml/XMLLexerTest.kt b/lexers/src/test/java/com/itsaky/androidide/lexers/xml/XMLLexerTest.kt new file mode 100644 index 000000000..dd3210f80 --- /dev/null +++ b/lexers/src/test/java/com/itsaky/androidide/lexers/xml/XMLLexerTest.kt @@ -0,0 +1,115 @@ +/* + * This file is part of AndroidIDE. + * + * AndroidIDE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AndroidIDE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with AndroidIDE. If not, see . + */ +package com.itsaky.androidide.lexers.xml + +import com.itsaky.androidide.lexers.BaseLexerTest +import com.itsaky.androidide.lexers.xml.XMLLexer.CLOSE +import com.itsaky.androidide.lexers.xml.XMLLexer.COMMENT +import com.itsaky.androidide.lexers.xml.XMLLexer.COMMENT_END +import com.itsaky.androidide.lexers.xml.XMLLexer.COMMENT_MODE +import com.itsaky.androidide.lexers.xml.XMLLexer.COMMENT_START +import com.itsaky.androidide.lexers.xml.XMLLexer.CommentModeEnd +import com.itsaky.androidide.lexers.xml.XMLLexer.EQUALS +import com.itsaky.androidide.lexers.xml.XMLLexer.Name +import com.itsaky.androidide.lexers.xml.XMLLexer.OPEN +import com.itsaky.androidide.lexers.xml.XMLLexer.OPEN_SLASH +import com.itsaky.androidide.lexers.xml.XMLLexer.SLASH_CLOSE +import com.itsaky.androidide.lexers.xml.XMLLexer.STRING +import com.itsaky.androidide.lexers.xml.XMLLexer.TEXT +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +/** @author Akash Yadav */ +@RunWith(JUnit4::class) +class XMLLexerTest : BaseLexerTest() { + + @Test + fun emptyClosingTagTest() { + val lexer = XMLLexer(createStream("")) + val tokens = lexer.allTokens + ensureTokenSequence(tokens, listOf(OPEN, Name, Name, EQUALS, STRING, SLASH_CLOSE)) + } + + @Test + fun nonEmptyClosingTagTest() { + val lexer = XMLLexer(createStream("")) + val tokens = lexer.allTokens + ensureTokenSequence( + tokens, + listOf(OPEN, Name, Name, EQUALS, STRING, CLOSE, OPEN_SLASH, Name, CLOSE) + ) + } + + @Test + fun singleLineIncompleteTokensTest() { + val lexer = XMLLexer(createStream("")) + val tokens = lexer.allTokens + ensureTokenSequence(tokens, listOf(COMMENT)) + } + + @Test + fun commentStartTest() { + val lexer = XMLLexer(createStream("")) + val tokens = lexer.allTokens + ensureTokenSequence(tokens, listOf(COMMENT_END)) + } + + @Test + fun incompleteCommentStartTest() { + val lexer = XMLLexer(createStream("")) + lexer.pushMode(COMMENT_MODE) + val tokens = lexer.allTokens + ensureTokenSequence(tokens, listOf(CommentModeEnd)) + } + + @Test + fun incompleteCommentEndBeforeTextTest() { + val lexer = XMLLexer(createStream("Comment text --> Not in comment")) + lexer.pushMode(COMMENT_MODE) + val tokens = lexer.allTokens + ensureTokenSequence(tokens, listOf(CommentModeEnd, TEXT)) + } +}