From 77b888bda10c7aa022221add7ec33e6e8141002c Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Sat, 17 May 2025 10:46:51 +0200 Subject: [PATCH] IJPL-163136 introduce XML lexer GitOrigin-RevId: d98b50c28df6cc86ce964d6432e5518f498e5e8b --- .../syntax-util/api-dump-experimental.txt | 18 + .../platform/syntax/util/lexer/FilterLexer.kt | 66 + .../testFramework/syntax/LexerTestCase.kt | 9 +- xml/tests/BUILD.bazel | 2 + .../src/com/intellij/xml/XmlLexerTest.java | 16 +- .../impl/cache/impl/idCache/XmlIdIndexer.java | 4 +- .../impl/idCache/XmlIndexPatternBuilder.java | 4 +- ...eckValidXmlInScriptBodyInspectionBase.java | 4 +- xml/xml-parser/BUILD.bazel | 1 + xml/xml-parser/intellij.xml.parser.iml | 1 + .../src/com/intellij/lexer/XHtmlLexer.java | 4 +- .../intellij/lexer/XmlHighlightingLexer.kt | 2 +- .../src/com/intellij/lexer/XmlLexer.kt | 39 +- .../intellij/lang/xml/XMLParserDefinition.kt | 4 +- xml/xml-syntax/BUILD.bazel | 4 + .../intellij/xml/syntax/lexer/__XmlLexer.kt | 1170 +++++++++++++++++ xml/xml-syntax/intellij.xml.syntax.iml | 4 + .../com/intellij/xml/syntax/lexer/XmlLexer.kt | 72 + .../intellij/xml/syntax/lexer/_XmlLexer.flex | 175 +++ 19 files changed, 1561 insertions(+), 38 deletions(-) create mode 100644 platform/syntax/syntax-util/src/com/intellij/platform/syntax/util/lexer/FilterLexer.kt create mode 100644 xml/xml-syntax/gen/com/intellij/xml/syntax/lexer/__XmlLexer.kt create mode 100644 xml/xml-syntax/src/com/intellij/xml/syntax/lexer/XmlLexer.kt create mode 100644 xml/xml-syntax/src/com/intellij/xml/syntax/lexer/_XmlLexer.flex diff --git a/platform/syntax/syntax-util/api-dump-experimental.txt b/platform/syntax/syntax-util/api-dump-experimental.txt index 636e8fe29ac9..f48daa4d409e 100644 --- a/platform/syntax/syntax-util/api-dump-experimental.txt +++ b/platform/syntax/syntax-util/api-dump-experimental.txt @@ -23,6 +23,24 @@ - getTokenStart():I - getTokenType():com.intellij.platform.syntax.SyntaxElementType - start(java.lang.CharSequence,I,I,I):V +*f:com.intellij.platform.syntax.util.lexer.FilterLexer +- com.intellij.platform.syntax.util.lexer.DelegateLexer +- (com.intellij.platform.syntax.lexer.Lexer,com.intellij.platform.syntax.util.lexer.FilterLexer$Filter):V +- (com.intellij.platform.syntax.lexer.Lexer,com.intellij.platform.syntax.util.lexer.FilterLexer$Filter,Z[]):V +- b:(com.intellij.platform.syntax.lexer.Lexer,com.intellij.platform.syntax.util.lexer.FilterLexer$Filter,Z[],I,kotlin.jvm.internal.DefaultConstructorMarker):V +- advance():V +- getCurrentPosition():com.intellij.platform.syntax.lexer.LexerPosition +- f:getOriginal():com.intellij.platform.syntax.lexer.Lexer +- f:getPrevTokenEnd():I +- f:locateToken():V +- restore(com.intellij.platform.syntax.lexer.LexerPosition):V +- start(java.lang.CharSequence,I,I,I):V +*:com.intellij.platform.syntax.util.lexer.FilterLexer$Filter +- a:reject(com.intellij.platform.syntax.SyntaxElementType):Z +*f:com.intellij.platform.syntax.util.lexer.FilterLexer$SetFilter +- com.intellij.platform.syntax.util.lexer.FilterLexer$Filter +- (com.intellij.platform.syntax.SyntaxElementTypeSet):V +- reject(com.intellij.platform.syntax.SyntaxElementType):Z *c:com.intellij.platform.syntax.util.lexer.FlexAdapter - com.intellij.platform.syntax.util.lexer.LexerBase - (com.intellij.platform.syntax.util.lexer.FlexLexer):V diff --git a/platform/syntax/syntax-util/src/com/intellij/platform/syntax/util/lexer/FilterLexer.kt b/platform/syntax/syntax-util/src/com/intellij/platform/syntax/util/lexer/FilterLexer.kt new file mode 100644 index 000000000000..6b664c42a481 --- /dev/null +++ b/platform/syntax/syntax-util/src/com/intellij/platform/syntax/util/lexer/FilterLexer.kt @@ -0,0 +1,66 @@ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.platform.syntax.util.lexer + +import com.intellij.platform.syntax.SyntaxElementType +import com.intellij.platform.syntax.SyntaxElementTypeSet +import com.intellij.platform.syntax.lexer.Lexer +import com.intellij.platform.syntax.lexer.LexerPosition +import org.jetbrains.annotations.ApiStatus +import kotlin.jvm.JvmOverloads + +@ApiStatus.Experimental +class FilterLexer @JvmOverloads constructor( + original: Lexer, + private val filter: Filter?, + private val stateFilter: BooleanArray? = null +) : DelegateLexer(original) { + var prevTokenEnd: Int = 0 + private set + + interface Filter { + fun reject(type: SyntaxElementType): Boolean + } + + class SetFilter(private val set: SyntaxElementTypeSet) : Filter { + override fun reject(type: SyntaxElementType): Boolean = type in set + } + + val original: Lexer + get() = delegate + + override fun start(buffer: CharSequence, startOffset: Int, endOffset: Int, initialState: Int) { + super.start(buffer, startOffset, endOffset, initialState) + prevTokenEnd = -1 + locateToken() + } + + + override fun advance() { + prevTokenEnd = delegate.getTokenEnd() + super.advance() + locateToken() + } + + override fun getCurrentPosition(): LexerPosition { + return delegate.getCurrentPosition() + } + + override fun restore(position: LexerPosition) { + delegate.restore(position) + this.prevTokenEnd = -1 + } + + fun locateToken() { + while (true) { + val delegate = delegate + val tokenType = delegate.getTokenType() ?: break + if (filter == null || !filter.reject(tokenType)) { + if (stateFilter == null || !stateFilter[delegate.getState()]) { + break + } + } + delegate.advance() + } + } +} + diff --git a/platform/testFramework/src/com/intellij/testFramework/syntax/LexerTestCase.kt b/platform/testFramework/src/com/intellij/testFramework/syntax/LexerTestCase.kt index c2466e4362bf..66f82a9e72ee 100644 --- a/platform/testFramework/src/com/intellij/testFramework/syntax/LexerTestCase.kt +++ b/platform/testFramework/src/com/intellij/testFramework/syntax/LexerTestCase.kt @@ -18,11 +18,8 @@ abstract class LexerTestCase : UsefulTestCase() { protected abstract fun createLexer(): Lexer - fun doTest(text: String, expected: String) { - doTest(text, expected, createLexer()) - } - - private fun doTest(text: String, expected: String? = null, lexer: Lexer = createLexer()) { + @JvmOverloads + protected fun doTest(text: String, expected: String? = null, lexer: Lexer = createLexer()) { val result = printTokens(lexer, text, 0) if (expected != null) { @@ -37,7 +34,7 @@ abstract class LexerTestCase : UsefulTestCase() { return printTokens(text, start, lexer) } - protected fun getPathToTestDataFile(extension: String): String { + protected open fun getPathToTestDataFile(extension: String): String { return IdeaTestExecutionPolicy.getHomePathWithPolicy() + "/" + this.dirPath + "/" + getTestName(true) + extension } diff --git a/xml/tests/BUILD.bazel b/xml/tests/BUILD.bazel index 02efebfd1b1f..f413e64e63cd 100644 --- a/xml/tests/BUILD.bazel +++ b/xml/tests/BUILD.bazel @@ -61,6 +61,8 @@ jvm_library( "//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark_test_lib", "//platform/polySymbols:polySymbols-testFramework", "//libraries/xerces", + "//platform/syntax/syntax-scripts:scripts", + "//xml/xml-syntax:syntax", ], runtime_deps = [ ":tests_test_resources", diff --git a/xml/tests/src/com/intellij/xml/XmlLexerTest.java b/xml/tests/src/com/intellij/xml/XmlLexerTest.java index 3d47efdcd382..60be77e943da 100644 --- a/xml/tests/src/com/intellij/xml/XmlLexerTest.java +++ b/xml/tests/src/com/intellij/xml/XmlLexerTest.java @@ -1,14 +1,14 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.xml; -import com.intellij.lang.xml.XMLParserDefinition; -import com.intellij.lexer.FilterLexer; -import com.intellij.lexer.Lexer; -import com.intellij.lexer.XmlLexer; -import com.intellij.testFramework.LexerTestCase; +import com.intellij.platform.syntax.lexer.Lexer; +import com.intellij.platform.syntax.util.lexer.FilterLexer; import com.intellij.testFramework.ParsingTestCase; import com.intellij.testFramework.PlatformTestUtil; +import com.intellij.testFramework.syntax.LexerTestCase; import com.intellij.tools.ide.metrics.benchmark.Benchmark; +import com.intellij.xml.syntax.XmlSyntaxDefinition; +import com.intellij.xml.syntax.lexer.XmlLexer; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -60,8 +60,10 @@ public class XmlLexerTest extends LexerTestCase { PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/psi/xml", fileName); final XmlLexer lexer = new XmlLexer(); - final FilterLexer filterLexer = new FilterLexer(new XmlLexer(), - new FilterLexer.SetFilter(new XMLParserDefinition().getWhitespaceTokens())); + final FilterLexer filterLexer = new com.intellij.platform.syntax.util.lexer.FilterLexer( + new XmlLexer(), + new FilterLexer.SetFilter(XmlSyntaxDefinition.INSTANCE.getWHITESPACES()) + ); Benchmark.newBenchmark("XML Lexer Performance on " + fileName, () -> { for (int i = 0; i < 10; i++) { diff --git a/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java b/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java index a36491500196..141f3faa9d11 100644 --- a/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java +++ b/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java @@ -2,7 +2,7 @@ package com.intellij.psi.impl.cache.impl.idCache; import com.intellij.lexer.Lexer; -import com.intellij.lexer.XmlLexer; +import com.intellij.lexer.XmlLexerKt; import com.intellij.psi.impl.cache.impl.OccurrenceConsumer; import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; import org.jetbrains.annotations.NotNull; @@ -14,6 +14,6 @@ public class XmlIdIndexer extends LexerBasedIdIndexer { } static XmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) { - return new XmlFilterLexer(new XmlLexer(), consumer); + return new XmlFilterLexer(XmlLexerKt.createXmlLexer(), consumer); } } diff --git a/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIndexPatternBuilder.java b/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIndexPatternBuilder.java index 33316d537470..7467e239528b 100644 --- a/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIndexPatternBuilder.java +++ b/xml/xml-analysis-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIndexPatternBuilder.java @@ -2,7 +2,7 @@ package com.intellij.psi.impl.cache.impl.idCache; import com.intellij.lexer.Lexer; -import com.intellij.lexer.XmlLexer; +import com.intellij.lexer.XmlLexerKt; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.search.IndexPatternBuilder; import com.intellij.psi.tree.IElementType; @@ -18,7 +18,7 @@ public class XmlIndexPatternBuilder implements IndexPatternBuilder { @Override public @Nullable Lexer getIndexingLexer(@NotNull PsiFile file) { if (file instanceof XmlFile) { - return new XmlLexer(); + return XmlLexerKt.createXmlLexer(); } return null; } diff --git a/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java b/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java index ecd92553b720..b7ee7c91ce9a 100644 --- a/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java +++ b/xml/xml-analysis-impl/src/com/intellij/xml/util/CheckValidXmlInScriptBodyInspectionBase.java @@ -8,7 +8,7 @@ import com.intellij.codeInspection.ProblemsHolder; import com.intellij.codeInspection.XmlSuppressableInspectionTool; import com.intellij.ide.highlighter.XmlLikeFileType; import com.intellij.lexer.Lexer; -import com.intellij.lexer.XmlLexer; +import com.intellij.lexer.XmlLexerKt; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; @@ -46,7 +46,7 @@ public class CheckValidXmlInScriptBodyInspectionBase extends XmlSuppressableInsp if (fileType instanceof XmlLikeFileType) { synchronized(CheckValidXmlInScriptBodyInspectionBase.class) { - if (myXmlLexer == null) myXmlLexer = new XmlLexer(); + if (myXmlLexer == null) myXmlLexer = XmlLexerKt.createXmlLexer(); final XmlTagValue tagValue = tag.getValue(); final String tagBodyText = tagValue.getText(); diff --git a/xml/xml-parser/BUILD.bazel b/xml/xml-parser/BUILD.bazel index ef69eba03236..346459d2a475 100644 --- a/xml/xml-parser/BUILD.bazel +++ b/xml/xml-parser/BUILD.bazel @@ -21,6 +21,7 @@ jvm_library( "//platform/syntax/syntax-api:syntax", "//platform/syntax/syntax-psi:psi", "//xml/xml-syntax:syntax", + "//platform/syntax/syntax-util:util", ], runtime_deps = [":parser_resources"] ) diff --git a/xml/xml-parser/intellij.xml.parser.iml b/xml/xml-parser/intellij.xml.parser.iml index 38c31d85d85a..0ac59ca444bb 100644 --- a/xml/xml-parser/intellij.xml.parser.iml +++ b/xml/xml-parser/intellij.xml.parser.iml @@ -17,5 +17,6 @@ + \ No newline at end of file diff --git a/xml/xml-parser/src/com/intellij/lexer/XHtmlLexer.java b/xml/xml-parser/src/com/intellij/lexer/XHtmlLexer.java index f152b364096e..14cfe6d92e2d 100644 --- a/xml/xml-parser/src/com/intellij/lexer/XHtmlLexer.java +++ b/xml/xml-parser/src/com/intellij/lexer/XHtmlLexer.java @@ -31,11 +31,11 @@ public class XHtmlLexer extends HtmlLexer { } public XHtmlLexer() { - this(new XmlLexer(true)); + this(XmlLexerKt.createXmlLexer(true)); } public XHtmlLexer(boolean highlightMode) { - this(new XmlLexer(true), highlightMode); + this(XmlLexerKt.createXmlLexer(true), highlightMode); } @Override diff --git a/xml/xml-parser/src/com/intellij/lexer/XmlHighlightingLexer.kt b/xml/xml-parser/src/com/intellij/lexer/XmlHighlightingLexer.kt index 48eab28e2a72..1fcf215f2f24 100644 --- a/xml/xml-parser/src/com/intellij/lexer/XmlHighlightingLexer.kt +++ b/xml/xml-parser/src/com/intellij/lexer/XmlHighlightingLexer.kt @@ -5,7 +5,7 @@ import com.intellij.psi.tree.IElementType import com.intellij.psi.xml.XmlTokenType class XmlHighlightingLexer : - DelegateLexer(XmlLexer()) { + DelegateLexer(createXmlLexer()) { override fun getTokenType(): IElementType? { var tokenType = delegate.tokenType diff --git a/xml/xml-parser/src/com/intellij/lexer/XmlLexer.kt b/xml/xml-parser/src/com/intellij/lexer/XmlLexer.kt index b85aa64fd2df..c29642c4e6cd 100644 --- a/xml/xml-parser/src/com/intellij/lexer/XmlLexer.kt +++ b/xml/xml-parser/src/com/intellij/lexer/XmlLexer.kt @@ -1,23 +1,32 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.lexer +import com.intellij.platform.syntax.psi.asTokenSet +import com.intellij.platform.syntax.psi.lexer.LexerAdapter import com.intellij.psi.tree.TokenSet -import com.intellij.psi.xml.XmlTokenType +import com.intellij.psi.xml.xmlElementTypeConverter +import com.intellij.xml.syntax.lexer.XmlLexer +import org.jetbrains.annotations.ApiStatus -class XmlLexer(baseLexer: Lexer) : - MergingLexerAdapter(baseLexer, TOKENS_TO_MERGE) { +/** + * Obsolete: Use [com.intellij.xml.syntax.lexer.XmlLexer] instead. This class is kept for binary compatibility and won't be developed further. + * + * If you still need an instance of [com.intellij.lexer.Lexer], use [createXmlLexer] function which returns a new XmlLexer instance wrapped into an adapter. + */ +@ApiStatus.Obsolete +class XmlLexer(baseLexer: Lexer) : MergingLexerAdapter(baseLexer, TOKENS_TO_MERGE) { + @Suppress("unused") // used by external plugins @JvmOverloads - constructor(conditionalCommentsSupport: Boolean = false) : - this(_XmlLexer(__XmlLexer(null), conditionalCommentsSupport)) - - private companion object { - private val TOKENS_TO_MERGE = TokenSet.create( - XmlTokenType.XML_DATA_CHARACTERS, - XmlTokenType.XML_TAG_CHARACTERS, - XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN, - XmlTokenType.XML_PI_TARGET, - XmlTokenType.XML_COMMENT_CHARACTERS, - ) - } + constructor(conditionalCommentsSupport: Boolean = false) : this(_XmlLexer(__XmlLexer(null), conditionalCommentsSupport)) } + +@JvmOverloads +fun createXmlLexer(conditionalCommentsSupport: Boolean = false): Lexer = + LexerAdapter( + XmlLexer(conditionalCommentsSupport), + xmlElementTypeConverter + ) + +private val TOKENS_TO_MERGE: TokenSet = + com.intellij.xml.syntax.lexer.TOKENS_TO_MERGE.asTokenSet(xmlElementTypeConverter) diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.kt b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.kt index af453f06d560..7f0153cc8ca5 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.kt +++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.kt @@ -9,6 +9,8 @@ import com.intellij.lang.ParserDefinition.SpaceRequirements import com.intellij.lang.PsiParser import com.intellij.lexer.Lexer import com.intellij.lexer.XmlLexer +import com.intellij.lexer.createXmlLexer +import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.psi.FileViewProvider import com.intellij.psi.PsiElement @@ -26,7 +28,7 @@ open class XMLParserDefinition : ParserDefinition { override fun createLexer(project: Project?): Lexer = - XmlLexer() + createXmlLexer() override fun getFileNodeType(): IFileElementType = XmlElementType.XML_FILE diff --git a/xml/xml-syntax/BUILD.bazel b/xml/xml-syntax/BUILD.bazel index b337f08a9fdf..e5629510010e 100644 --- a/xml/xml-syntax/BUILD.bazel +++ b/xml/xml-syntax/BUILD.bazel @@ -15,6 +15,10 @@ jvm_library( deps = [ "@lib//:kotlin-stdlib", "//platform/syntax/syntax-api:syntax", + "//platform/util/multiplatform", + "@lib//:jetbrains-annotations", + "//platform/syntax/syntax-i18n:i18n", + "//platform/syntax/syntax-util:util", ], runtime_deps = [":syntax_resources"] ) diff --git a/xml/xml-syntax/gen/com/intellij/xml/syntax/lexer/__XmlLexer.kt b/xml/xml-syntax/gen/com/intellij/xml/syntax/lexer/__XmlLexer.kt new file mode 100644 index 000000000000..ee1652983fbc --- /dev/null +++ b/xml/xml-syntax/gen/com/intellij/xml/syntax/lexer/__XmlLexer.kt @@ -0,0 +1,1170 @@ +// Generated by JFlex 1.10.14 http://jflex.de/ (tweaked for IntelliJ platform) +// source: _XmlLexer.flex + + /* It's an automatically generated code. Do not modify it. */ +package com.intellij.xml.syntax.lexer + +import com.intellij.platform.syntax.SyntaxElementType +import com.intellij.platform.syntax.util.lexer.FlexLexer +import com.intellij.xml.syntax.XmlSyntaxTokenType +import com.intellij.xml.syntax.XmlSyntaxElementType + +class __XmlLexer : FlexLexer { +companion object { + /** This character denotes the end of file */ + private const val YYEOF = -1 + + /** initial size of the lookahead buffer */ + private const val ZZ_BUFFERSIZE: Int = 16384 + + /** lexical states */ + public const val YYINITIAL: Int = 0 + public const val TAG: Int = 2 + public const val PROCESSING_INSTRUCTION: Int = 4 + public const val PI_ANY: Int = 6 + public const val END_TAG: Int = 8 + public const val COMMENT: Int = 10 + public const val ATTR_LIST: Int = 12 + public const val ATTR: Int = 14 + public const val ATTR_VALUE_START: Int = 16 + public const val ATTR_VALUE_DQ: Int = 18 + public const val ATTR_VALUE_SQ: Int = 20 + public const val DTD_MARKUP: Int = 22 + public const val DOCTYPE: Int = 24 + public const val CDATA: Int = 26 + public const val C_COMMENT_START: Int = 28 + public const val C_COMMENT_END: Int = 30 + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + @JvmStatic + private val ZZ_LEXSTATE: IntArray = intArrayOf( + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, + 8, 8, 9, 9, 10, 10, 8, 8, 11, 11, 12, 12, 13, 13, 14, 14 + ) + + /** + * Top-level table for translating characters to character classes + */ + private const val ZZ_CMAP_TOP_PACKED_0: String = + "\u0001\u0000\u0001\u0100\u0001\u0200\u0001\u0300\u0001\u0400\u0001\u0500\u0001\u0600\u0001\u0700"+ + "\u0001\u0800\u0001\u0900\u0001\u0a00\u0001\u0b00\u0001\u0c00\u0001\u0d00\u0001\u0e00\u0001\u0f00"+ + "\u0001\u1000\u0001\u0100\u0001\u1100\u0001\u1200\u0001\u1300\u0001\u0100\u0001\u1400\u0001\u1500"+ + "\u0001\u1600\u0001\u1700\u0001\u1800\u0001\u1900\u0001\u1a00\u0001\u1b00\u0001\u0100\u0001\u1c00"+ + "\u0001\u1d00\u0001\u1e00\u000a\u1f00\u0001\u2000\u0001\u2100\u0001\u2200\u0001\u1f00\u0001\u2300"+ + "\u0001\u2400\u0002\u1f00\u0019\u0100\u0001\u2500\u0051\u0100\u0001\u2600\u0004\u0100\u0001\u2700"+ + "\u0001\u0100\u0001\u2800\u0001\u2900\u0001\u2a00\u0001\u2b00\u0001\u2c00\u0001\u2d00\u002b\u0100"+ + "\u0001\u2e00\u0021\u1f00\u0001\u0100\u0001\u2f00\u0001\u3000\u0001\u0100\u0001\u3100\u0001\u3200"+ + "\u0001\u3300\u0001\u3400\u0001\u1f00\u0001\u3500\u0001\u3600\u0001\u3700\u0001\u3800\u0001\u0100"+ + "\u0001\u3900\u0001\u3a00\u0001\u3b00\u0001\u3c00\u0001\u3d00\u0001\u3e00\u0001\u3f00\u0001\u1f00"+ + "\u0001\u4000\u0001\u4100\u0001\u4200\u0001\u4300\u0001\u4400\u0001\u4500\u0001\u4600\u0001\u4700"+ + "\u0001\u4800\u0001\u4900\u0001\u4a00\u0001\u4b00\u0001\u1f00\u0001\u4c00\u0001\u4d00\u0001\u4e00"+ + "\u0001\u1f00\u0003\u0100\u0001\u4f00\u0001\u5000\u0001\u5100\u000a\u1f00\u0004\u0100\u0001\u5200"+ + "\u000f\u1f00\u0002\u0100\u0001\u5300\u0021\u1f00\u0002\u0100\u0001\u5400\u0001\u5500\u0002\u1f00"+ + "\u0001\u5600\u0001\u5700\u0017\u0100\u0001\u5800\u0002\u0100\u0001\u5900\u0025\u1f00\u0001\u0100"+ + "\u0001\u5a00\u0001\u5b00\u0009\u1f00\u0001\u5c00\u0017\u1f00\u0001\u5d00\u0001\u5e00\u0001\u5f00"+ + "\u0001\u6000\u0009\u1f00\u0001\u6100\u0001\u6200\u0005\u1f00\u0001\u6300\u0001\u6400\u0004\u1f00"+ + "\u0001\u6500\u0011\u1f00\u00a6\u0100\u0001\u6600\u0010\u0100\u0001\u6700\u0001\u6800\u0015\u0100"+ + "\u0001\u6900\u001c\u0100\u0001\u6a00\u000c\u1f00\u0002\u0100\u0001\u6b00\u0e05\u1f00" + + @JvmStatic + private fun zzUnpackcmap_top(): IntArray { + val result: IntArray = IntArray(4352) + var offset: Int = 0 + offset = zzUnpackcmap_top(ZZ_CMAP_TOP_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpackcmap_top(packed: String , offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length + while (i < l) { + var count: Int = packed[i++].code + var value: Int = packed[i++].code + do + result[j++] = value + while (--count > 0) + } + return j + } + + @JvmStatic + private val ZZ_CMAP_TOP: IntArray = zzUnpackcmap_top() + + + /** + * Second-level tables for translating characters to character classes + */ + private const val ZZ_CMAP_BLOCKS_PACKED_0: String = + "\u0009\u0000\u0002\u0001\u0001\u0000\u0002\u0001\u0012\u0000\u0001\u0001\u0001\u0002\u0001\u0003"+ + "\u0001\u0004\u0001\u0005\u0001\u0006\u0001\u0007\u0001\u0008\u0002\u0009\u0003\u0000\u0001\u000a"+ + "\u0001\u000b\u0001\u000c\u000a\u000d\u0001\u000e\u0001\u000f\u0001\u0010\u0001\u0011\u0001\u0012"+ + "\u0001\u0013\u0001\u0000\u0001\u0014\u0001\u0015\u0001\u0016\u0001\u0017\u0001\u0018\u0001\u0019"+ + "\u0002\u001a\u0001\u001b\u0002\u001a\u0001\u001c\u0001\u001d\u0001\u001a\u0001\u001e\u0001\u001f"+ + "\u0002\u001a\u0001\u0020\u0001\u0021\u0001\u0022\u0003\u001a\u0001\u0023\u0001\u001a\u0001\u0024"+ + "\u0001\u0025\u0001\u0026\u0001\u0000\u0001\u0027\u0001\u0000\u0001\u0028\u0001\u0029\u0004\u0019"+ + "\u0001\u002a\u0004\u001a\u0001\u002b\u0001\u002c\u0001\u002d\u0001\u002e\u0001\u002f\u0001\u0030"+ + "\u0001\u001a\u0001\u0031\u0001\u0032\u0001\u0033\u0002\u001a\u0001\u0034\u0002\u001a\u0001\u0035"+ + "\u0001\u0009\u0001\u0036\u0007\u0000\u0001\u0037\u0024\u0000\u0001\u001a\u000a\u0000\u0001\u001a"+ + "\u0004\u0000\u0001\u001a\u0005\u0000\u0017\u001a\u0001\u0000\u001f\u001a\u0001\u0000\u01ca\u001a"+ + "\u0004\u0000\u000c\u001a\u000e\u0000\u0005\u001a\u0007\u0000\u0001\u001a\u0001\u0000\u0001\u001a"+ + "\u0081\u0000\u0005\u001a\u0001\u0000\u0002\u001a\u0002\u0000\u0004\u001a\u0001\u0000\u0001\u001a"+ + "\u0006\u0000\u0001\u001a\u0001\u0000\u0003\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0014\u001a"+ + "\u0001\u0000\u0053\u001a\u0001\u0000\u008b\u001a\u0008\u0000\u00a6\u001a\u0001\u0000\u0026\u001a"+ + "\u0002\u0000\u0001\u001a\u0006\u0000\u0029\u001a\u0047\u0000\u001b\u001a\u0004\u0000\u0004\u001a"+ + "\u002d\u0000\u002b\u001a\u0023\u0000\u0002\u001a\u0001\u0000\u0063\u001a\u0001\u0000\u0001\u001a"+ + "\u000f\u0000\u0002\u001a\u0007\u0000\u0002\u001a\u000a\u0000\u0003\u001a\u0002\u0000\u0001\u001a"+ + "\u0010\u0000\u0001\u001a\u0001\u0000\u001e\u001a\u001d\u0000\u0059\u001a\u000b\u0000\u0001\u001a"+ + "\u0018\u0000\u0021\u001a\u0009\u0000\u0002\u001a\u0004\u0000\u0001\u001a\u0005\u0000\u0016\u001a"+ + "\u0004\u0000\u0001\u001a\u0009\u0000\u0001\u001a\u0003\u0000\u0001\u001a\u0017\u0000\u0019\u001a"+ + "\u0007\u0000\u000b\u001a\u0035\u0000\u0015\u001a\u0001\u0000\u0008\u001a\u0046\u0000\u0036\u001a"+ + "\u0003\u0000\u0001\u001a\u0012\u0000\u0001\u001a\u0007\u0000\u000a\u001a\u000f\u0000\u0010\u001a"+ + "\u0004\u0000\u0008\u001a\u0002\u0000\u0002\u001a\u0002\u0000\u0016\u001a\u0001\u0000\u0007\u001a"+ + "\u0001\u0000\u0001\u001a\u0003\u0000\u0004\u001a\u0003\u0000\u0001\u001a\u0010\u0000\u0001\u001a"+ + "\u000d\u0000\u0002\u001a\u0001\u0000\u0003\u001a\u000e\u0000\u0002\u001a\u000a\u0000\u0001\u001a"+ + "\u0008\u0000\u0006\u001a\u0004\u0000\u0002\u001a\u0002\u0000\u0016\u001a\u0001\u0000\u0007\u001a"+ + "\u0001\u0000\u0002\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u0002\u001a\u001f\u0000\u0004\u001a"+ + "\u0001\u0000\u0001\u001a\u0013\u0000\u0003\u001a\u0010\u0000\u0009\u001a\u0001\u0000\u0003\u001a"+ + "\u0001\u0000\u0016\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u0005\u001a"+ + "\u0003\u0000\u0001\u001a\u0012\u0000\u0001\u001a\u000f\u0000\u0002\u001a\u0017\u0000\u0001\u001a"+ + "\u000b\u0000\u0008\u001a\u0002\u0000\u0002\u001a\u0002\u0000\u0016\u001a\u0001\u0000\u0007\u001a"+ + "\u0001\u0000\u0002\u001a\u0001\u0000\u0005\u001a\u0003\u0000\u0001\u001a\u001e\u0000\u0002\u001a"+ + "\u0001\u0000\u0003\u001a\u000f\u0000\u0001\u001a\u0011\u0000\u0001\u001a\u0001\u0000\u0006\u001a"+ + "\u0003\u0000\u0003\u001a\u0001\u0000\u0004\u001a\u0003\u0000\u0002\u001a\u0001\u0000\u0001\u001a"+ + "\u0001\u0000\u0002\u001a\u0003\u0000\u0002\u001a\u0003\u0000\u0003\u001a\u0003\u0000\u000c\u001a"+ + "\u0016\u0000\u0001\u001a\u0034\u0000\u0008\u001a\u0001\u0000\u0003\u001a\u0001\u0000\u0017\u001a"+ + "\u0001\u0000\u0010\u001a\u0003\u0000\u0001\u001a\u001a\u0000\u0003\u001a\u0005\u0000\u0002\u001a"+ + "\u001e\u0000\u0001\u001a\u0004\u0000\u0008\u001a\u0001\u0000\u0003\u001a\u0001\u0000\u0017\u001a"+ + "\u0001\u0000\u000a\u001a\u0001\u0000\u0005\u001a\u0003\u0000\u0001\u001a\u0020\u0000\u0001\u001a"+ + "\u0001\u0000\u0002\u001a\u000f\u0000\u0002\u001a\u0012\u0000\u0008\u001a\u0001\u0000\u0003\u001a"+ + "\u0001\u0000\u0029\u001a\u0002\u0000\u0001\u001a\u0010\u0000\u0001\u001a\u0005\u0000\u0003\u001a"+ + "\u0008\u0000\u0003\u001a\u0018\u0000\u0006\u001a\u0005\u0000\u0012\u001a\u0003\u0000\u0018\u001a"+ + "\u0001\u0000\u0009\u001a\u0001\u0000\u0001\u001a\u0002\u0000\u0007\u001a\u003a\u0000\u0030\u001a"+ + "\u0001\u0000\u0002\u001a\u000c\u0000\u0007\u001a\u003a\u0000\u0002\u001a\u0001\u0000\u0001\u001a"+ + "\u0001\u0000\u0005\u001a\u0001\u0000\u0018\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u000a\u001a"+ + "\u0001\u0000\u0002\u001a\u0009\u0000\u0001\u001a\u0002\u0000\u0005\u001a\u0001\u0000\u0001\u001a"+ + "\u0015\u0000\u0004\u001a\u0020\u0000\u0001\u001a\u003f\u0000\u0008\u001a\u0001\u0000\u0024\u001a"+ + "\u001b\u0000\u0005\u001a\u0073\u0000\u002b\u001a\u0014\u0000\u0001\u001a\u0010\u0000\u0006\u001a"+ + "\u0004\u0000\u0004\u001a\u0003\u0000\u0001\u001a\u0003\u0000\u0002\u001a\u0007\u0000\u0003\u001a"+ + "\u0004\u0000\u000d\u001a\u000c\u0000\u0001\u001a\u0011\u0000\u0026\u001a\u0001\u0000\u0001\u001a"+ + "\u0005\u0000\u0001\u001a\u0002\u0000\u002b\u001a\u0001\u0000\u004d\u001a\u0001\u0000\u0004\u001a"+ + "\u0002\u0000\u0007\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0004\u001a\u0002\u0000\u0029\u001a"+ + "\u0001\u0000\u0004\u001a\u0002\u0000\u0021\u001a\u0001\u0000\u0004\u001a\u0002\u0000\u0007\u001a"+ + "\u0001\u0000\u0001\u001a\u0001\u0000\u0004\u001a\u0002\u0000\u000f\u001a\u0001\u0000\u0039\u001a"+ + "\u0001\u0000\u0004\u001a\u0002\u0000\u0043\u001a\u0025\u0000\u0010\u001a\u0010\u0000\u0056\u001a"+ + "\u0002\u0000\u0006\u001a\u0003\u0000\u016c\u001a\u0002\u0000\u0011\u001a\u0001\u0000\u001a\u001a"+ + "\u0005\u0000\u004b\u001a\u0006\u0000\u0008\u001a\u0007\u0000\u000d\u001a\u0001\u0000\u0004\u001a"+ + "\u000e\u0000\u0012\u001a\u000e\u0000\u0012\u001a\u000e\u0000\u000d\u001a\u0001\u0000\u0003\u001a"+ + "\u000f\u0000\u0034\u001a\u0023\u0000\u0001\u001a\u0004\u0000\u0001\u001a\u0043\u0000\u0059\u001a"+ + "\u0007\u0000\u0005\u001a\u0002\u0000\u0022\u001a\u0001\u0000\u0001\u001a\u0005\u0000\u0046\u001a"+ + "\u000a\u0000\u001f\u001a\u0031\u0000\u001e\u001a\u0002\u0000\u0005\u001a\u000b\u0000\u002c\u001a"+ + "\u0004\u0000\u001a\u001a\u0036\u0000\u0017\u001a\u0009\u0000\u0035\u001a\u0052\u0000\u0001\u001a"+ + "\u005d\u0000\u002f\u001a\u0011\u0000\u0007\u001a\u0037\u0000\u001e\u001a\u000d\u0000\u0002\u001a"+ + "\u000a\u0000\u002c\u001a\u001a\u0000\u0024\u001a\u0029\u0000\u0003\u001a\u000a\u0000\u0024\u001a"+ + "\u0002\u0000\u0009\u001a\u0007\u0000\u002b\u001a\u0002\u0000\u0003\u001a\u0029\u0000\u0004\u001a"+ + "\u0001\u0000\u0006\u001a\u0001\u0000\u0002\u001a\u0003\u0000\u0001\u001a\u0005\u0000\u00c0\u001a"+ + "\u0040\u0000\u0016\u001a\u0002\u0000\u0006\u001a\u0002\u0000\u0026\u001a\u0002\u0000\u0006\u001a"+ + "\u0002\u0000\u0008\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a"+ + "\u0001\u0000\u001f\u001a\u0002\u0000\u0035\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0001\u001a"+ + "\u0003\u0000\u0003\u001a\u0001\u0000\u0007\u001a\u0003\u0000\u0004\u001a\u0002\u0000\u0006\u001a"+ + "\u0004\u0000\u000d\u001a\u0005\u0000\u0003\u001a\u0001\u0000\u0007\u001a\u002b\u0000\u0002\u0037"+ + "\u0047\u0000\u0001\u001a\u000d\u0000\u0001\u001a\u0010\u0000\u000d\u001a\u0065\u0000\u0001\u001a"+ + "\u0004\u0000\u0001\u001a\u0002\u0000\u000a\u001a\u0001\u0000\u0001\u001a\u0003\u0000\u0005\u001a"+ + "\u0006\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0004\u001a"+ + "\u0001\u0000\u000b\u001a\u0002\u0000\u0004\u001a\u0005\u0000\u0005\u001a\u0004\u0000\u0001\u001a"+ + "\u0034\u0000\u0002\u001a\u017b\u0000\u002f\u001a\u0001\u0000\u002f\u001a\u0001\u0000\u0085\u001a"+ + "\u0006\u0000\u0004\u001a\u0003\u0000\u0002\u001a\u000c\u0000\u0026\u001a\u0001\u0000\u0001\u001a"+ + "\u0005\u0000\u0001\u001a\u0002\u0000\u0038\u001a\u0007\u0000\u0001\u001a\u0010\u0000\u0017\u001a"+ + "\u0009\u0000\u0007\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0007\u001a"+ + "\u0001\u0000\u0007\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0007\u001a"+ + "\u0050\u0000\u0001\u001a\u00d5\u0000\u0002\u001a\u002a\u0000\u0005\u001a\u0005\u0000\u0002\u001a"+ + "\u0004\u0000\u0056\u001a\u0006\u0000\u0003\u001a\u0001\u0000\u005a\u001a\u0001\u0000\u0004\u001a"+ + "\u0005\u0000\u002b\u001a\u0001\u0000\u005e\u001a\u0011\u0000\u001b\u001a\u0035\u0000\u00c6\u001a"+ + "\u004a\u0000\u00f0\u001a\u0010\u0000\u008d\u001a\u0043\u0000\u002e\u001a\u0002\u0000\u000d\u001a"+ + "\u0003\u0000\u0010\u001a\u000a\u0000\u0002\u001a\u0014\u0000\u002f\u001a\u0010\u0000\u001f\u001a"+ + "\u0002\u0000\u0046\u001a\u0031\u0000\u0009\u001a\u0002\u0000\u0067\u001a\u0002\u0000\u0035\u001a"+ + "\u0002\u0000\u0005\u001a\u0030\u0000\u000b\u001a\u0001\u0000\u0003\u001a\u0001\u0000\u0004\u001a"+ + "\u0001\u0000\u0017\u001a\u001d\u0000\u0034\u001a\u000e\u0000\u0032\u001a\u003e\u0000\u0006\u001a"+ + "\u0003\u0000\u0001\u001a\u0001\u0000\u0002\u001a\u000b\u0000\u001c\u001a\u000a\u0000\u0017\u001a"+ + "\u0019\u0000\u001d\u001a\u0007\u0000\u002f\u001a\u001c\u0000\u0001\u001a\u0010\u0000\u0005\u001a"+ + "\u0001\u0000\u000a\u001a\u000a\u0000\u0005\u001a\u0001\u0000\u0029\u001a\u0017\u0000\u0003\u001a"+ + "\u0001\u0000\u0008\u001a\u0014\u0000\u0017\u001a\u0003\u0000\u0001\u001a\u0003\u0000\u0032\u001a"+ + "\u0001\u0000\u0001\u001a\u0003\u0000\u0002\u001a\u0002\u0000\u0005\u001a\u0002\u0000\u0001\u001a"+ + "\u0001\u0000\u0001\u001a\u0018\u0000\u0003\u001a\u0002\u0000\u000b\u001a\u0007\u0000\u0003\u001a"+ + "\u000c\u0000\u0006\u001a\u0002\u0000\u0006\u001a\u0002\u0000\u0006\u001a\u0009\u0000\u0007\u001a"+ + "\u0001\u0000\u0007\u001a\u0001\u0000\u002b\u001a\u0001\u0000\u000c\u001a\u0008\u0000\u0073\u001a"+ + "\u001d\u0000\u00a4\u001a\u000c\u0000\u0017\u001a\u0004\u0000\u0031\u001a\u0004\u0000\u006e\u001a"+ + "\u0002\u0000\u006a\u001a\u0026\u0000\u0007\u001a\u000c\u0000\u0005\u001a\u0005\u0000\u0001\u001a"+ + "\u0001\u0000\u000a\u001a\u0001\u0000\u000d\u001a\u0001\u0000\u0005\u001a\u0001\u0000\u0001\u001a"+ + "\u0001\u0000\u0002\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u006c\u001a\u0021\u0000\u006b\u001a"+ + "\u0012\u0000\u0040\u001a\u0002\u0000\u0036\u001a\u0028\u0000\u000c\u001a\u0074\u0000\u0005\u001a"+ + "\u0001\u0000\u0087\u001a\u0024\u0000\u001a\u001a\u0006\u0000\u001a\u001a\u000b\u0000\u0059\u001a"+ + "\u0003\u0000\u0006\u001a\u0002\u0000\u0006\u001a\u0002\u0000\u0006\u001a\u0002\u0000\u0003\u001a"+ + "\u0023\u0000\u000c\u001a\u0001\u0000\u001a\u001a\u0001\u0000\u0013\u001a\u0001\u0000\u0002\u001a"+ + "\u0001\u0000\u000f\u001a\u0002\u0000\u000e\u001a\u0022\u0000\u007b\u001a\u0085\u0000\u001d\u001a"+ + "\u0003\u0000\u0031\u001a\u002f\u0000\u0020\u001a\u000d\u0000\u0014\u001a\u0001\u0000\u0008\u001a"+ + "\u0006\u0000\u0026\u001a\u000a\u0000\u001e\u001a\u0002\u0000\u0024\u001a\u0004\u0000\u0008\u001a"+ + "\u0030\u0000\u009e\u001a\u0012\u0000\u0024\u001a\u0004\u0000\u0024\u001a\u0004\u0000\u0028\u001a"+ + "\u0008\u0000\u0034\u001a\u009c\u0000\u0037\u001a\u0009\u0000\u0016\u001a\u000a\u0000\u0008\u001a"+ + "\u0098\u0000\u0006\u001a\u0002\u0000\u0001\u001a\u0001\u0000\u002c\u001a\u0001\u0000\u0002\u001a"+ + "\u0003\u0000\u0001\u001a\u0002\u0000\u0017\u001a\u000a\u0000\u0017\u001a\u0009\u0000\u001f\u001a"+ + "\u0041\u0000\u0013\u001a\u0001\u0000\u0002\u001a\u000a\u0000\u0016\u001a\u000a\u0000\u001a\u001a"+ + "\u0046\u0000\u0038\u001a\u0006\u0000\u0002\u001a\u0040\u0000\u0001\u001a\u000f\u0000\u0004\u001a"+ + "\u0001\u0000\u0003\u001a\u0001\u0000\u001d\u001a\u002a\u0000\u001d\u001a\u0003\u0000\u001d\u001a"+ + "\u0023\u0000\u0008\u001a\u0001\u0000\u001c\u001a\u001b\u0000\u0036\u001a\u000a\u0000\u0016\u001a"+ + "\u000a\u0000\u0013\u001a\u000d\u0000\u0012\u001a\u006e\u0000\u0049\u001a\u0037\u0000\u0033\u001a"+ + "\u000d\u0000\u0033\u001a\u000d\u0000\u0024\u001a\u00dc\u0000\u001d\u001a\u000a\u0000\u0001\u001a"+ + "\u0008\u0000\u0016\u001a\u009a\u0000\u0017\u001a\u000c\u0000\u0035\u001a\u004b\u0000\u002d\u001a"+ + "\u0020\u0000\u0019\u001a\u001a\u0000\u0024\u001a\u001d\u0000\u0001\u001a\u000b\u0000\u0023\u001a"+ + "\u0003\u0000\u0001\u001a\u000c\u0000\u0030\u001a\u000e\u0000\u0004\u001a\u0015\u0000\u0001\u001a"+ + "\u0001\u0000\u0001\u001a\u0023\u0000\u0012\u001a\u0001\u0000\u0019\u001a\u0054\u0000\u0007\u001a"+ + "\u0001\u0000\u0001\u001a\u0001\u0000\u0004\u001a\u0001\u0000\u000f\u001a\u0001\u0000\u000a\u001a"+ + "\u0007\u0000\u002f\u001a\u0026\u0000\u0008\u001a\u0002\u0000\u0002\u001a\u0002\u0000\u0016\u001a"+ + "\u0001\u0000\u0007\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u0005\u001a\u0003\u0000\u0001\u001a"+ + "\u0012\u0000\u0001\u001a\u000c\u0000\u0005\u001a\u009e\u0000\u0035\u001a\u0012\u0000\u0004\u001a"+ + "\u0014\u0000\u0001\u001a\u0020\u0000\u0030\u001a\u0014\u0000\u0002\u001a\u0001\u0000\u0001\u001a"+ + "\u00b8\u0000\u002f\u001a\u0029\u0000\u0004\u001a\u0024\u0000\u0030\u001a\u0014\u0000\u0001\u001a"+ + "\u003b\u0000\u002b\u001a\u000d\u0000\u0001\u001a\u0047\u0000\u001b\u001a\u00e5\u0000\u002c\u001a"+ + "\u0074\u0000\u0040\u001a\u001f\u0000\u0001\u001a\u00a0\u0000\u0008\u001a\u0002\u0000\u0027\u001a"+ + "\u0010\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u001c\u0000\u0001\u001a\u000a\u0000\u0028\u001a"+ + "\u0007\u0000\u0001\u001a\u0015\u0000\u0001\u001a\u000b\u0000\u002e\u001a\u0013\u0000\u0001\u001a"+ + "\u0022\u0000\u0039\u001a\u0007\u0000\u0009\u001a\u0001\u0000\u0025\u001a\u0011\u0000\u0001\u001a"+ + "\u0031\u0000\u001e\u001a\u0070\u0000\u0007\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u0026\u001a"+ + "\u0015\u0000\u0001\u001a\u0019\u0000\u0006\u001a\u0001\u0000\u0002\u001a\u0001\u0000\u0020\u001a"+ + "\u000e\u0000\u0001\u001a\u0147\u0000\u0013\u001a\u000d\u0000\u009a\u001a\u00e6\u0000\u00c4\u001a"+ + "\u00bc\u0000\u002f\u001a\u00d1\u0000\u0047\u001a\u00b9\u0000\u0039\u001a\u0007\u0000\u001f\u001a"+ + "\u0071\u0000\u001e\u001a\u0012\u0000\u0030\u001a\u0010\u0000\u0004\u001a\u001f\u0000\u0015\u001a"+ + "\u0005\u0000\u0013\u001a\u00b0\u0000\u0040\u001a\u0080\u0000\u004b\u001a\u0005\u0000\u0001\u001a"+ + "\u0042\u0000\u000d\u001a\u0040\u0000\u0002\u001a\u0001\u0000\u0001\u001a\u001c\u0000\u00f8\u001a"+ + "\u0008\u0000\u00f3\u001a\u000d\u0000\u001f\u001a\u0031\u0000\u0003\u001a\u0011\u0000\u0004\u001a"+ + "\u0008\u0000\u018c\u001a\u0004\u0000\u006b\u001a\u0005\u0000\u000d\u001a\u0003\u0000\u0009\u001a"+ + "\u0007\u0000\u000a\u001a\u0066\u0000\u0055\u001a\u0001\u0000\u0047\u001a\u0001\u0000\u0002\u001a"+ + "\u0002\u0000\u0001\u001a\u0002\u0000\u0002\u001a\u0002\u0000\u0004\u001a\u0001\u0000\u000c\u001a"+ + "\u0001\u0000\u0001\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0041\u001a\u0001\u0000\u0004\u001a"+ + "\u0002\u0000\u0008\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u001c\u001a\u0001\u0000\u0004\u001a"+ + "\u0001\u0000\u0005\u001a\u0001\u0000\u0001\u001a\u0003\u0000\u0007\u001a\u0001\u0000\u0154\u001a"+ + "\u0002\u0000\u0019\u001a\u0001\u0000\u0019\u001a\u0001\u0000\u001f\u001a\u0001\u0000\u0019\u001a"+ + "\u0001\u0000\u001f\u001a\u0001\u0000\u0019\u001a\u0001\u0000\u001f\u001a\u0001\u0000\u0019\u001a"+ + "\u0001\u0000\u001f\u001a\u0001\u0000\u0019\u001a\u0001\u0000\u0008\u001a\u0034\u0000\u002d\u001a"+ + "\u000a\u0000\u0007\u001a\u0010\u0000\u0001\u001a\u0171\u0000\u002c\u001a\u0014\u0000\u00c5\u001a"+ + "\u003b\u0000\u0044\u001a\u0007\u0000\u0001\u001a\u00b4\u0000\u0004\u001a\u0001\u0000\u001b\u001a"+ + "\u0001\u0000\u0002\u001a\u0001\u0000\u0001\u001a\u0002\u0000\u0001\u001a\u0001\u0000\u000a\u001a"+ + "\u0001\u0000\u0004\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0006\u0000\u0001\u001a"+ + "\u0004\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0003\u001a"+ + "\u0001\u0000\u0002\u001a\u0001\u0000\u0001\u001a\u0002\u0000\u0001\u001a\u0001\u0000\u0001\u001a"+ + "\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u0002\u001a"+ + "\u0001\u0000\u0001\u001a\u0002\u0000\u0004\u001a\u0001\u0000\u0007\u001a\u0001\u0000\u0004\u001a"+ + "\u0001\u0000\u0004\u001a\u0001\u0000\u0001\u001a\u0001\u0000\u000a\u001a\u0001\u0000\u0011\u001a"+ + "\u0005\u0000\u0003\u001a\u0001\u0000\u0005\u001a\u0001\u0000\u0011\u001a\u0044\u0000\u00d7\u001a"+ + "\u0029\u0000\u0035\u001a\u000b\u0000\u00de\u001a\u0002\u0000\u0182\u001a\u000e\u0000\u0131\u001a"+ + "\u001f\u0000\u001e\u001a\u00e2\u0000" + + @JvmStatic + private fun zzUnpackcmap_blocks(): IntArray { + val result: IntArray = IntArray(27648) + var offset: Int = 0 + offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpackcmap_blocks(packed: String , offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length + while (i < l) { + var count: Int = packed[i++].code + var value: Int = packed[i++].code + do + result[j++] = value + while (--count > 0) + } + return j + } + + @JvmStatic + private val ZZ_CMAP_BLOCKS: IntArray = zzUnpackcmap_blocks() + + /** + * Translates DFA states to action switch labels. + */ + private const val ZZ_ACTION_PACKED_0: String = + "\u0001\u0001\u000e\u0000\u0001\u0001\u0001\u0002\u0001\u0001\u0001\u0003\u0001\u0004\u0001\u0001"+ + "\u0001\u0002\u0001\u0003\u0001\u0005\u0001\u0003\u0001\u0006\u0001\u0003\u0001\u0007\u0001\u0008"+ + "\u0001\u0003\u0001\u0008\u0004\u0009\u0001\u000a\u0001\u000b\u0001\u000c\u0001\u000b\u0001\u000d"+ + "\u0001\u000e\u0001\u000f\u0001\u0010\u0001\u000f\u0001\u0011\u0001\u000f\u0001\u0012\u0001\u000f"+ + "\u0001\u0013\u0001\u0014\u0002\u0013\u0001\u000c\u0005\u0013\u0001\u0015\u0002\u000a\u0001\u0016"+ + "\u0002\u0001\u0004\u0017\u0001\u000b\u0001\u0017\u0001\u0018\u0001\u0019\u0007\u0000\u0001\u001a"+ + "\u0001\u001b\u0001\u001c\u0001\u0006\u0001\u0000\u0001\u0008\u0001\u001d\u0001\u0008\u0001\u000a"+ + "\u0002\u0000\u0001\u000e\u0001\u001e\u0001\u0000\u0001\u001e\u0001\u0000\u0002\u000a\u0001\u0000"+ + "\u0001\u0016\u0001\u0000\u0001\u001f\u0001\u0019\u0003\u0000\u0001\u0020\u0008\u0000\u0001\u0021"+ + "\u0001\u0022\u0001\u0023\u0001\u001e\u0001\u0024\u0002\u000a\u0001\u0025\u0001\u0026\u0002\u0000"+ + "\u0001\u0027\u0002\u0000\u0002\u000a\u0002\u0000\u0002\u000a\u0002\u0000\u0001\u0028\u0001\u0029"+ + "\u0004\u0000\u0001\u002a\u0001\u002b" + + @JvmStatic + private fun zzUnpackAction(): IntArray { + val result: IntArray = IntArray(144) + var offset: Int = 0 + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpackAction(packed: String , offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length + while (i < l) { + var count: Int = packed[i++].code + var value: Int = packed[i++].code + do + result[j++] = value + while (--count > 0) + } + return j + } + + @JvmStatic + private val ZZ_ACTION: IntArray = zzUnpackAction() + + + /** + * Translates a state to a row index in the transition table + */ + private const val ZZ_ROWMAP_PACKED_0: String = + "\u0000\u0000\u0000\u0038\u0000\u0070\u0000\u00a8\u0000\u00e0\u0000\u0118\u0000\u0150\u0000\u0188"+ + "\u0000\u01c0\u0000\u01f8\u0000\u0230\u0000\u0268\u0000\u02a0\u0000\u02d8\u0000\u0310\u0000\u0348"+ + "\u0000\u0380\u0000\u03b8\u0000\u03f0\u0000\u0428\u0000\u0460\u0000\u0498\u0000\u04d0\u0000\u0508"+ + "\u0000\u0540\u0000\u0578\u0000\u05b0\u0000\u04d0\u0000\u05e8\u0000\u0620\u0000\u0658\u0000\u04d0"+ + "\u0000\u03f0\u0000\u05b0\u0000\u0620\u0000\u0690\u0000\u04d0\u0000\u06c8\u0000\u0700\u0000\u04d0"+ + "\u0000\u0738\u0000\u04d0\u0000\u04d0\u0000\u03f0\u0000\u04d0\u0000\u05b0\u0000\u04d0\u0000\u0508"+ + "\u0000\u04d0\u0000\u04d0\u0000\u0770\u0000\u07a8\u0000\u03f0\u0000\u05b0\u0000\u07e0\u0000\u0818"+ + "\u0000\u0850\u0000\u0888\u0000\u04d0\u0000\u08c0\u0000\u08f8\u0000\u0930\u0000\u04d0\u0000\u0968"+ + "\u0000\u04d0\u0000\u03f0\u0000\u09a0\u0000\u05b0\u0000\u09d8\u0000\u0a10\u0000\u04d0\u0000\u0a48"+ + "\u0000\u0a80\u0000\u0ab8\u0000\u0af0\u0000\u0b28\u0000\u0b60\u0000\u0b98\u0000\u0bd0\u0000\u04d0"+ + "\u0000\u04d0\u0000\u04d0\u0000\u0c08\u0000\u0c40\u0000\u0c78\u0000\u04d0\u0000\u0cb0\u0000\u0ce8"+ + "\u0000\u0d20\u0000\u0d58\u0000\u0d90\u0000\u0dc8\u0000\u0e00\u0000\u0e38\u0000\u0e70\u0000\u0ea8"+ + "\u0000\u0ee0\u0000\u0f18\u0000\u04d0\u0000\u0f50\u0000\u04d0\u0000\u04d0\u0000\u0f88\u0000\u0fc0"+ + "\u0000\u0ff8\u0000\u04d0\u0000\u1030\u0000\u1068\u0000\u10a0\u0000\u10d8\u0000\u1110\u0000\u1148"+ + "\u0000\u1180\u0000\u11b8\u0000\u05e8\u0000\u04d0\u0000\u04d0\u0000\u04d0\u0000\u04d0\u0000\u11f0"+ + "\u0000\u1228\u0000\u04d0\u0000\u04d0\u0000\u1260\u0000\u1298\u0000\u04d0\u0000\u12d0\u0000\u1308"+ + "\u0000\u1340\u0000\u1378\u0000\u13b0\u0000\u13e8\u0000\u1420\u0000\u1458\u0000\u1490\u0000\u14c8"+ + "\u0000\u0690\u0000\u0690\u0000\u1500\u0000\u1538\u0000\u1570\u0000\u15a8\u0000\u04d0\u0000\u04d0" + + @JvmStatic + private fun zzUnpackRowMap(): IntArray { + val result: IntArray = IntArray(144) + var offset: Int = 0 + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpackRowMap(packed: String, offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length - 1 + while (i < l) { + val high: Int = packed[i++].code shl 16 + result[j++] = high or packed[i++].code + } + return j + } + + @JvmStatic + private val ZZ_ROWMAP: IntArray = zzUnpackRowMap() + + /** + * The transition table of the DFA + */ + private const val ZZ_TRANS_PACKED_0: String = + "\u0001\u0010\u0001\u0011\u0002\u0010\u0002\u0012\u0001\u0010\u0001\u0013\u0008\u0010\u0001\u0014"+ + "\u0014\u0010\u0001\u0015\u0011\u0010\u0001\u0016\u0001\u0017\u0001\u0018\u0005\u0017\u0001\u0013"+ + "\u0004\u0017\u0001\u0019\u0001\u0017\u0001\u001a\u0001\u0017\u0001\u001b\u0001\u0017\u0001\u001c"+ + "\u0001\u0017\u0010\u001a\u0003\u0017\u000e\u001a\u0002\u0017\u0001\u0018\u0007\u0017\u0001\u0013"+ + "\u0006\u0017\u0001\u001d\u0001\u0017\u0001\u001b\u0002\u0017\u0001\u001e\u0010\u001d\u0003\u0017"+ + "\u000d\u001d\u0001\u001f\u0003\u0017\u0001\u0020\u0001\u0018\u0005\u0020\u0001\u0021\u0008\u0020"+ + "\u0001\u0022\u0002\u0020\u0001\u0023\u0023\u0020\u0001\u0018\u0001\u0017\u0001\u0018\u0005\u0017"+ + "\u0001\u0013\u0006\u0017\u0001\u0024\u0001\u0017\u0001\u001b\u0001\u0017\u0001\u001c\u0001\u0017"+ + "\u0010\u0024\u0003\u0017\u000e\u0024\u0002\u0017\u0001\u0018\u000a\u0025\u0001\u0026\u0005\u0025"+ + "\u0001\u0027\u0013\u0025\u0001\u0028\u0013\u0025\u0001\u0017\u0001\u0018\u0005\u0017\u0001\u0013"+ + "\u0006\u0017\u0001\u0029\u0001\u0017\u0001\u001b\u0003\u0017\u0010\u0029\u0003\u0017\u000e\u0029"+ + "\u0002\u0017\u0001\u0018\u0001\u002a\u0001\u0018\u0001\u002a\u0001\u002b\u0003\u002a\u0001\u002c"+ + "\u0001\u002d\u0007\u002a\u0001\u002e\u0001\u002f\u0025\u002a\u0001\u0030\u0007\u0017\u0001\u0013"+ + "\u0008\u0017\u0001\u001b\u0027\u0017\u0003\u0031\u0001\u0032\u0002\u0033\u0001\u0034\u0001\u0035"+ + "\u0008\u0031\u0001\u0036\u002b\u0031\u0002\u0037\u0001\u0038\u0001\u0035\u0001\u0032\u0007\u0031"+ + "\u0001\u0036\u0027\u0031\u0001\u0017\u0001\u0018\u0001\u0017\u0001\u0039\u0003\u0017\u0001\u0013"+ + "\u0001\u003a\u0005\u0017\u0001\u0024\u0001\u0017\u0001\u001b\u0001\u0017\u0001\u003b\u0001\u0017"+ + "\u000b\u0024\u0001\u003c\u0001\u003d\u0003\u0024\u0001\u003e\u0002\u0017\u000e\u0024\u0002\u0017"+ + "\u0001\u0018\u0026\u003f\u0001\u0040\u0011\u003f\u0007\u0041\u0001\u0042\u0002\u0041\u0001\u0043"+ + "\u0005\u0041\u0001\u0044\u0003\u0041\u0010\u0045\u0002\u0041\u0001\u0046\u0001\u0041\u000d\u0045"+ + "\u000a\u0041\u0001\u0042\u0002\u0041\u0001\u0043\u0005\u0041\u0001\u0044\u0003\u0041\u0010\u0045"+ + "\u0002\u0041\u0001\u0047\u0001\u0041\u000d\u0045\u0003\u0041\u0001\u0010\u0001\u0000\u0002\u0010"+ + "\u0002\u0000\u0001\u0010\u0001\u0000\u0008\u0010\u0001\u0000\u0014\u0010\u0001\u0015\u0012\u0010"+ + "\u0001\u0000\u0001\u0011\u0035\u0000\u0001\u0011\u0035\u0000\u0001\u0048\u0006\u0000\u0001\u0049"+ + "\u0009\u0000\u0001\u004a\u0005\u0000\u0010\u004a\u0003\u0000\u0001\u004a\u0001\u004b\u0001\u004a"+ + "\u0002\u004c\u0001\u004a\u0001\u004d\u0002\u004a\u0001\u004e\u0004\u004a\u0005\u0000\u0001\u004f"+ + "\u0009\u0000\u0001\u0050\u0006\u0000\u0001\u0051\u0024\u0000\u0001\u0010\u0001\u0000\u0005\u0010"+ + "\u0001\u0000\u0008\u0010\u0001\u0000\u0014\u0010\u0001\u0015\u0013\u0010\u0001\u0011\u0002\u0010"+ + "\u0002\u0000\u0001\u0010\u0001\u0000\u0008\u0010\u0001\u0000\u0014\u0010\u0001\u0015\u0011\u0010"+ + "\u0001\u0016\u0039\u0000\u0001\u0018\u0035\u0000\u0001\u0018\u0012\u0000\u0001\u0052\u002f\u0000"+ + "\u0002\u001a\u0001\u0000\u0001\u001a\u0001\u0053\u0005\u0000\u0010\u001a\u0003\u0000\u000e\u001a"+ + "\u0005\u0000\u0001\u0054\u003f\u0000\u0002\u001d\u0001\u0000\u0001\u001d\u0001\u0055\u0005\u0000"+ + "\u0010\u001d\u0003\u0000\u000e\u001d\u0015\u0000\u0001\u0056\u002f\u0000\u0002\u001d\u0001\u0000"+ + "\u0001\u001d\u0001\u0055\u0005\u0000\u0010\u001d\u0003\u0000\u0005\u001d\u0001\u0057\u0008\u001d"+ + "\u000d\u0000\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000\u0010\u0024\u0003\u0000"+ + "\u000e\u0024\u0003\u0000\u000a\u0025\u0001\u0059\u002d\u0025\u0002\u0000\u0001\u005a\u003f\u0000"+ + "\u0002\u0029\u0001\u0000\u0001\u0029\u0001\u005b\u0005\u0000\u0010\u0029\u0003\u0000\u000e\u0029"+ + "\u0038\u0000\u0001\u005c\u0013\u0000\u0001\u005d\u005b\u0000\u0001\u005e\u0013\u0000\u0001\u005f"+ + "\u0026\u0000\u0003\u0039\u0001\u0031\u0034\u0039\u0008\u003a\u0001\u0031\u002f\u003a\u000a\u0000"+ + "\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000\u000e\u0024\u0001\u0060\u0001\u0024"+ + "\u0003\u0000\u000e\u0024\u000d\u0000\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000"+ + "\u000f\u0024\u0001\u0061\u0003\u0000\u000e\u0024\u0003\u0000\u0003\u003e\u0001\u0062\u0022\u003e"+ + "\u0001\u0063\u0011\u003e\u0026\u0000\u0001\u0064\u001b\u0000\u0001\u0059\u002e\u0000\u0002\u0045"+ + "\u0004\u0000\u0001\u0045\u0001\u0000\u0001\u0045\u0001\u0000\u0001\u0045\u0001\u0000\u0001\u0045"+ + "\u0006\u0000\u0010\u0045\u0004\u0000\u000d\u0045\u0002\u0000\u0001\u0045\u0012\u0000\u0001\u0065"+ + "\u0025\u0000\u0010\u0048\u0001\u0000\u0025\u0048\u0001\u0066\u0001\u0048\u000d\u0000\u0001\u0067"+ + "\u0026\u0000\u0001\u0068\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a"+ + "\u0004\u0000\u0010\u004a\u0003\u0000\u000e\u004a\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a"+ + "\u0001\u0069\u0001\u006a\u0004\u0000\u0010\u004a\u0003\u0000\u0005\u004a\u0001\u006b\u0002\u004a"+ + "\u0001\u006c\u0005\u004a\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a"+ + "\u0004\u0000\u0010\u004a\u0003\u0000\u000b\u004a\u0001\u006d\u0002\u004a\u000d\u0000\u0002\u004a"+ + "\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a\u0004\u0000\u0010\u004a\u0003\u0000\u0002\u004a"+ + "\u0001\u006e\u000b\u004a\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a"+ + "\u0004\u0000\u0010\u004a\u0003\u0000\u000c\u004a\u0001\u006f\u0001\u004a\u000d\u0000\u0001\u0070"+ + "\u000c\u0000\u0001\u0071\u000c\u0000\u0001\u0072\u001d\u0000\u0002\u0053\u0001\u0000\u0001\u0053"+ + "\u0006\u0000\u0010\u0053\u0003\u0000\u000e\u0053\u000d\u0000\u0001\u0070\u0019\u0000\u0001\u0072"+ + "\u001d\u0000\u0002\u0055\u0001\u0000\u0001\u0055\u0006\u0000\u0010\u0055\u0003\u0000\u000e\u0055"+ + "\u000d\u0000\u0002\u001d\u0001\u0000\u0001\u001d\u0001\u0055\u0005\u0000\u0010\u001d\u0003\u0000"+ + "\u0004\u001d\u0001\u0073\u0009\u001d\u000d\u0000\u0002\u0058\u0001\u0000\u0001\u0058\u0006\u0000"+ + "\u0010\u0058\u0003\u0000\u000e\u0058\u0015\u0000\u0001\u0074\u0049\u0000\u0001\u0075\u001d\u0000"+ + "\u0002\u005b\u0001\u0000\u0001\u005b\u0006\u0000\u0010\u005b\u0003\u0000\u000e\u005b\u0003\u0000"+ + "\u0003\u005c\u0001\u0000\u0032\u005c\u0001\u0076\u0001\u005c\u0003\u005d\u0001\u0000\u0002\u005d"+ + "\u0001\u0077\u0031\u005d\u0008\u005e\u0001\u0000\u002d\u005e\u0001\u0076\u0001\u005e\u0006\u005f"+ + "\u0001\u0077\u0001\u005f\u0001\u0000\u002f\u005f\u000a\u0000\u0002\u0024\u0001\u0000\u0001\u0024"+ + "\u0001\u0058\u0005\u0000\u0001\u0024\u0001\u0078\u000e\u0024\u0003\u0000\u000e\u0024\u000d\u0000"+ + "\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000\u000c\u0024\u0001\u0079\u0003\u0024"+ + "\u0003\u0000\u000e\u0024\u0003\u0000\u0003\u0062\u0001\u003e\u0034\u0062\u0012\u0000\u0001\u007a"+ + "\u0032\u0000\u0001\u0067\u0001\u0000\u0001\u007b\u0035\u0000\u0001\u007c\u0006\u0000\u0006\u007c"+ + "\u000e\u0000\u0002\u007c\u0018\u0000\u0002\u0069\u0001\u0000\u0001\u0069\u0001\u0000\u0001\u006a"+ + "\u0004\u0000\u0010\u0069\u0003\u0000\u000e\u0069\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a"+ + "\u0001\u0069\u0001\u006a\u0004\u0000\u0010\u004a\u0003\u0000\u0008\u004a\u0001\u006d\u0005\u004a"+ + "\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a\u0004\u0000\u0010\u004a"+ + "\u0003\u0000\u0007\u004a\u0001\u007d\u0006\u004a\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a"+ + "\u0001\u0069\u0001\u007b\u0004\u0000\u0010\u004a\u0003\u0000\u000e\u004a\u000d\u0000\u0002\u004a"+ + "\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a\u0004\u0000\u0010\u004a\u0003\u0000\u000a\u004a"+ + "\u0001\u006b\u0003\u004a\u000d\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a"+ + "\u0004\u0000\u0010\u004a\u0003\u0000\u0007\u004a\u0001\u004c\u0006\u004a\u000d\u0000\u0001\u007e"+ + "\u004b\u0000\u0001\u007f\u002f\u0000\u0001\u0080\u002b\u0000\u0002\u0024\u0001\u0000\u0001\u0024"+ + "\u0001\u0058\u0005\u0000\u0008\u0024\u0001\u0081\u0007\u0024\u0003\u0000\u000e\u0024\u000d\u0000"+ + "\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000\u000d\u0024\u0001\u0082\u0002\u0024"+ + "\u0003\u0000\u000e\u0024\u0010\u0000\u0001\u007c\u0001\u0000\u0001\u007b\u0004\u0000\u0006\u007c"+ + "\u000e\u0000\u0002\u007c\u0018\u0000\u0002\u004a\u0001\u0000\u0001\u004a\u0001\u0069\u0001\u006a"+ + "\u0004\u0000\u0010\u004a\u0003\u0000\u000a\u004a\u0001\u006d\u0003\u004a\u0019\u0000\u0001\u0083"+ + "\u0038\u0000\u0001\u0084\u002a\u0000\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000"+ + "\u0007\u0024\u0001\u0085\u0008\u0024\u0003\u0000\u000e\u0024\u000d\u0000\u0002\u0024\u0001\u0000"+ + "\u0001\u0024\u0001\u0058\u0005\u0000\u0004\u0024\u0001\u0086\u000b\u0024\u0003\u0000\u000e\u0024"+ + "\u0024\u0000\u0001\u0087\u002a\u0000\u0001\u0088\u002d\u0000\u0002\u0024\u0001\u0000\u0001\u0024"+ + "\u0001\u0058\u0005\u0000\u0002\u0024\u0001\u0089\u000d\u0024\u0003\u0000\u000e\u0024\u000d\u0000"+ + "\u0002\u0024\u0001\u0000\u0001\u0024\u0001\u0058\u0005\u0000\u0009\u0024\u0001\u008a\u0006\u0024"+ + "\u0003\u0000\u000e\u0024\u0026\u0000\u0001\u008b\u0035\u0000\u0001\u008c\u0035\u0000\u0001\u008d"+ + "\u002c\u0000\u0001\u008e\u003b\u0000\u0001\u008f\u0043\u0000\u0001\u0090\u0013\u0000" + + @JvmStatic + private fun zzUnpacktrans(): IntArray { + val result: IntArray = IntArray(5600) + var offset: Int = 0 + offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpacktrans(packed: String , offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length + while (i < l) { + var count: Int = packed[i++].code + var value: Int = packed[i++].code + value-- + do + result[j++] = value + while (--count > 0) + } + return j + } + + @JvmStatic + private val ZZ_TRANS: IntArray = zzUnpacktrans() + + + /* error codes */ + private const val ZZ_UNKNOWN_ERROR = 0 + private const val ZZ_NO_MATCH = 1 + private const val ZZ_PUSHBACK_2BIG = 2 + + /* error messages for the codes above */ + @JvmStatic + val ZZ_ERROR_MSG = arrayOf( + "Unknown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + ) + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state {@code aState} + */ + private const val ZZ_ATTRIBUTE_PACKED_0: String = + "\u0001\u0001\u000e\u0000\u0007\u0001\u0001\u0009\u0004\u0001\u0001\u0009\u0003\u0001\u0001\u0009"+ + "\u0004\u0001\u0001\u0009\u0002\u0001\u0001\u0009\u0001\u0001\u0002\u0009\u0001\u0001\u0001\u0009"+ + "\u0001\u0001\u0001\u0009\u0001\u0001\u0002\u0009\u0008\u0001\u0001\u0009\u0003\u0001\u0001\u0009"+ + "\u0001\u0001\u0001\u0009\u0005\u0001\u0001\u0009\u0001\u0001\u0007\u0000\u0003\u0009\u0001\u0001"+ + "\u0001\u0000\u0001\u0001\u0001\u0009\u0002\u0001\u0002\u0000\u0002\u0001\u0001\u0000\u0001\u0001"+ + "\u0001\u0000\u0002\u0001\u0001\u0000\u0001\u0009\u0001\u0000\u0002\u0009\u0003\u0000\u0001\u0009"+ + "\u0008\u0000\u0001\u0001\u0004\u0009\u0002\u0001\u0002\u0009\u0002\u0000\u0001\u0009\u0002\u0000"+ + "\u0002\u0001\u0002\u0000\u0002\u0001\u0002\u0000\u0002\u0001\u0004\u0000\u0002\u0009" + + @JvmStatic + private fun zzUnpackAttribute(): IntArray { + val result: IntArray = IntArray(144) + var offset: Int = 0 + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result) + return result + } + + @JvmStatic + private fun zzUnpackAttribute(packed: String , offset: Int, result: IntArray): Int { + var i: Int = 0 /* index in packed string */ + var j: Int = offset /* index in unpacked array */ + val l: Int = packed.length + while (i < l) { + var count: Int = packed[i++].code + var value: Int = packed[i++].code + do + result[j++] = value + while (--count > 0) + } + return j + } + + @JvmStatic + private val ZZ_ATTRIBUTE: IntArray = zzUnpackAttribute() + +} + /** the current state of the DFA */ + private var zzState = 0 + + /** the current lexical state */ + private var zzLexicalState = YYINITIAL + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private var zzBuffer: CharSequence = "" + + /** the textposition at the last accepting state */ + private var zzMarkedPos = 0 + + /** the current text position in the buffer */ + private var zzCurrentPos = 0 + + /** startRead marks the beginning of the yytext() string in the buffer */ + private var zzStartRead = 0 + + /** endRead marks the last character in the buffer, that has been read + from input */ + private var zzEndRead = 0 + + /** + * Whether the scanner is at the end of file. + * @see #yyatEOF + */ + private var zzAtEOF = false + + /** Number of newlines encountered up to the start of the matched text. */ + @Suppress("unused") + private var yyline: Int = 0 + + /** Number of characters from the last newline up to the start of the matched text. */ + @Suppress("unused") + protected var yycolumn: Int = 0 + + /** Number of characters up to the start of the matched text. */ + @Suppress("unused") + private var yychar: Long = 0 + + /** Whether the scanner is currently at the beginning of a line. */ + @Suppress("unused") + private var zzAtBOL: Boolean = false + + /** Whether the user-EOF-code has already been executed. */ + @Suppress("unused") + private var zzEOFDone: Boolean = false + + /* user code: */ + private var elTokenType = XmlSyntaxTokenType.XML_DATA_CHARACTERS + private var elTokenType2 = XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN + private var javaEmbeddedTokenType = XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN + private var myConditionalCommentsSupport: Boolean = false + + fun setConditionalCommentsSupport(b: Boolean) { + myConditionalCommentsSupport = b + } + + public fun setElTypes(_elTokenType: SyntaxElementType, _elTokenType2: SyntaxElementType) { + elTokenType = _elTokenType; + elTokenType2 = _elTokenType2; + } + + public fun setJavaEmbeddedType(_tokenType: SyntaxElementType) { + javaEmbeddedTokenType = _tokenType; + } + + private var myPrevState = YYINITIAL + + fun yyprevstate() = myPrevState + + private fun popState(): Int { + val prev = myPrevState + myPrevState = YYINITIAL + return prev + } + + fun pushState(state: Int){ + myPrevState = state + } + + + + /** Returns the maximum size of the scanner buffer, which limits the size of tokens. */ + private fun zzMaxBufferLen(): Int { + return Int.MAX_VALUE + } + + /** Whether the scanner buffer can grow to accommodate a larger token. */ + private fun zzCanGrow(): Boolean { + return true + } + + + override fun getTokenStart(): Int { + return zzStartRead + } + + override fun getTokenEnd(): Int { + return getTokenStart() + yylength() + } + + override fun reset(buffer: CharSequence, start: Int, end: Int, initialState: Int) { + zzBuffer = buffer + zzCurrentPos = start + zzMarkedPos = start + zzStartRead = start + zzAtEOF = false + zzAtBOL = true + zzEndRead = end + yybegin(initialState) + } + + /** + * Refills the input buffer. + * + * @return {@code false}, iff there was new input. + */ + private fun zzRefill(): Boolean { + return true + } + + + /** + * Returns the current lexical state. + */ + override fun yystate(): Int { + return zzLexicalState + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + override fun yybegin(newState: Int) { + zzLexicalState = newState + } + + + /** + * Returns the text matched by the current regular expression. + */ + fun yytext(): CharSequence { + return zzBuffer.subSequence(zzStartRead, zzMarkedPos) + } + + + /** + * Returns the character at position {@code pos} from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + fun yycharat(position: Int): Char { + return zzBuffer[zzStartRead + position] + } + + + /** + * Returns the length of the matched text region. + */ + fun yylength(): Int { + return zzMarkedPos - zzStartRead + } + + /** + * Implementation of the `codePointAt` method of `java.lang.Character` for CharSequences + * + * @param index the index of the character for which to retrieve the code point. + * @return the Unicode code point at the specified index. + * @throws IndexOutOfBoundsException if the index is outside the bounds of the character sequence. + */ + fun CharSequence.codePoint(index: Int): Int { + val high = this[index] + if (high.isHighSurrogate() && index + 1 < length) { + val low = this[index + 1] + if (low.isLowSurrogate()) { + val codePoint: String = "$high$low" + return codePoint.codePointAt(0) + } + } + return high.code + } + + /** Returns the character (Unicode code point) at the specified index. */ + internal fun String.codePointAt(index: Int): Int { + val high = this[index] + if (high.isHighSurrogate() && index + 1 < this.length) { + val low = this[index + 1] + if (low.isLowSurrogate()) { + return Char.toCodePoint(high, low) + } + } + return high.code + } + + internal fun CharSequence.offsetByCodePoints(index: Int, codePointOffset: Int): Int { + val length = this.length + if (index < 0 || index > length) throw IndexOutOfBoundsException() + + var x = index + if (codePointOffset >= 0) { + var i: Int = 0 + + while (x < length && i < codePointOffset) { + if (this[x++].isHighSurrogate() && x < length && this[x].isLowSurrogate()) x++ + i++ + } + + if (i < codePointOffset) throw IndexOutOfBoundsException() + + } else { + var i: Int = codePointOffset + + while (x > 0 && i < 0) { + if (this[--x].isLowSurrogate() && x > 0 && this[x - 1].isHighSurrogate()) x-- + i++ + } + + if (i < 0) { + throw IndexOutOfBoundsException() + } + } + + return x + } + + internal fun Char.Companion.toCodePoint(high: Char, low: Char): Int = + (((high - MIN_HIGH_SURROGATE) shl 10) or (low - MIN_LOW_SURROGATE)) + 0x10000 + + private fun charCount(codePoint: Int): Int = if (codePoint < 0x10000) 1 else 2 + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public fun yypushback(number: Int) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG) + + zzMarkedPos -= number + } + + + private fun zzScanError(errorCode: Int) { + val message = try { + ZZ_ERROR_MSG[errorCode] + } catch (e: IndexOutOfBoundsException) { + ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR] + } + + throw Error(message) + } + /** + * Translates raw input code points to DFA table row + */ + private fun zzCMap(input: Int): Int { + val offset: Int = input and 255 + return if(offset == input) ZZ_CMAP_BLOCKS[offset] else ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input shr 8] or offset] + } + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + */ + override fun advance(): SyntaxElementType? + { + var zzInput: Int = 0 + var zzAction: Int = 0 + + val zzTransL: IntArray = ZZ_TRANS + val zzRowMapL: IntArray = ZZ_ROWMAP + val zzAttrL: IntArray = ZZ_ATTRIBUTE + + while (true) { + // cached fields: + var zzCurrentPosL = 0 + var zzMarkedPosL: Int = zzMarkedPos + var zzEndReadL: Int = zzEndRead + var zzBufferL: CharSequence = zzBuffer + + zzAction = -1 + + zzCurrentPosL = zzMarkedPosL + zzCurrentPos = zzMarkedPosL + zzStartRead = zzMarkedPosL + + zzState = ZZ_LEXSTATE[zzLexicalState] + + // set up zzAction for empty match case: + var zzAttributes: Int = zzAttrL[zzState] + if ( (zzAttributes and 1) == 1 ) { + zzAction = zzState + } + + + zzForAction@ while (true) { + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL.codePoint(zzCurrentPosL) + zzCurrentPosL += charCount(zzInput) + } + else if (zzAtEOF) { + zzInput = YYEOF + break@zzForAction + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL + zzMarkedPos = zzMarkedPosL + val eof: Boolean = zzRefill() + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos + zzMarkedPosL = zzMarkedPos + zzBufferL = zzBuffer + zzEndReadL = zzEndRead + if (eof) { + zzInput = YYEOF + break@zzForAction + } + else { + zzInput = zzBufferL.codePoint(zzCurrentPosL) + zzCurrentPosL += charCount(zzInput) + } + } + val zzNext: Int = zzTransL[zzRowMapL[zzState] + zzCMap(zzInput)] + if (zzNext == -1) break@zzForAction + zzState = zzNext + + zzAttributes = zzAttrL[zzState] + if ( (zzAttributes and 1) == 1 ) { + zzAction = zzState + zzMarkedPosL = zzCurrentPosL + if ( (zzAttributes and 8) == 8 ) break@zzForAction + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL + + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true + return null + } + else { + when (if (zzAction < 0) zzAction else ZZ_ACTION[zzAction]) { + 1 -> { + return XmlSyntaxTokenType.XML_DATA_CHARACTERS; + } + // fall through + 44 -> break + 2 -> { + return XmlSyntaxTokenType.XML_REAL_WHITE_SPACE; + } + // fall through + 45 -> break + 3 -> { + if(yystate() == YYINITIAL){ + return XmlSyntaxTokenType.XML_BAD_CHARACTER; + } + else yybegin(popState()); yypushback(yylength()); + } + // fall through + 46 -> break + 4 -> { + yybegin(TAG); return XmlSyntaxTokenType.XML_START_TAG_START; + } + // fall through + 47 -> break + 5 -> { + return XmlSyntaxTokenType.XML_WHITE_SPACE; + } + // fall through + 48 -> break + 6 -> { + yybegin(ATTR_LIST); pushState(TAG); return XmlSyntaxTokenType.XML_NAME; + } + // fall through + 49 -> break + 7 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_TAG_END; + } + // fall through + 50 -> break + 8 -> { + yybegin(PI_ANY); return XmlSyntaxTokenType.XML_NAME; + } + // fall through + 51 -> break + 9 -> { + return XmlSyntaxTokenType.XML_TAG_CHARACTERS; + } + // fall through + 52 -> break + 10 -> { + return XmlSyntaxTokenType.XML_NAME; + } + // fall through + 53 -> break + 11 -> { + return XmlSyntaxTokenType.XML_COMMENT_CHARACTERS; + } + // fall through + 54 -> break + 12 -> { + return XmlSyntaxTokenType.XML_BAD_CHARACTER; + } + // fall through + 55 -> break + 13 -> { + if (myConditionalCommentsSupport) { + yybegin(C_COMMENT_START); + return XmlSyntaxTokenType.XML_CONDITIONAL_COMMENT_START; + } else return XmlSyntaxTokenType.XML_COMMENT_CHARACTERS; + } + // fall through + 56 -> break + 14 -> { + yybegin(ATTR); return XmlSyntaxTokenType.XML_NAME; + } + // fall through + 57 -> break + 15 -> { + yybegin(ATTR_LIST); yypushback(yylength()); + } + // fall through + 58 -> break + 16 -> { + yybegin(ATTR_VALUE_DQ); return XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER; + } + // fall through + 59 -> break + 17 -> { + yybegin(ATTR_VALUE_SQ); return XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER; + } + // fall through + 60 -> break + 18 -> { + return XmlSyntaxTokenType.XML_EQ; + } + // fall through + 61 -> break + 19 -> { + return XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN; + } + // fall through + 62 -> break + 20 -> { + yybegin(ATTR_LIST); return XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER; + } + // fall through + 63 -> break + 21 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_DOCTYPE_END; + } + // fall through + 64 -> break + 22 -> { + return XmlSyntaxElementType.XML_MARKUP_DECL; + } + // fall through + 65 -> break + 23 -> { + yybegin(COMMENT); return XmlSyntaxTokenType.XML_COMMENT_CHARACTERS; + } + // fall through + 66 -> break + 24 -> { + yybegin(COMMENT); return XmlSyntaxTokenType.XML_CONDITIONAL_COMMENT_END; + } + // fall through + 67 -> break + 25 -> { + return elTokenType; + } + // fall through + 68 -> break + 26 -> { + yybegin(END_TAG); return XmlSyntaxTokenType.XML_END_TAG_START; + } + // fall through + 69 -> break + 27 -> { + yybegin(PROCESSING_INSTRUCTION); return XmlSyntaxTokenType.XML_PI_START; + } + // fall through + 70 -> break + 28 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_EMPTY_ELEMENT_END; + } + // fall through + 71 -> break + 29 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_PI_END; + } + // fall through + 72 -> break + 30 -> { + return elTokenType2; + } + // fall through + 73 -> break + 31 -> { + yybegin(COMMENT); return XmlSyntaxTokenType.XML_CONDITIONAL_COMMENT_START_END; + } + // fall through + 74 -> break + 32 -> { + return XmlSyntaxTokenType.XML_ENTITY_REF_TOKEN; + } + // fall through + 75 -> break + 33 -> { + yybegin(ATTR_LIST); pushState(PROCESSING_INSTRUCTION); return XmlSyntaxTokenType.XML_NAME; + } + // fall through + 76 -> break + 34 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_COMMENT_END; + } + // fall through + 77 -> break + 35 -> { + if (myConditionalCommentsSupport) { + yybegin(C_COMMENT_END); + return XmlSyntaxTokenType.XML_CONDITIONAL_COMMENT_END_START; + } else return XmlSyntaxTokenType.XML_COMMENT_CHARACTERS; + } + // fall through + 78 -> break + 36 -> { + return javaEmbeddedTokenType; + } + // fall through + 79 -> break + 37 -> { + yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_CDATA_END; + } + // fall through + 80 -> break + 38 -> { + return XmlSyntaxTokenType.XML_CHAR_ENTITY_REF; + } + // fall through + 81 -> break + 39 -> { + yybegin(COMMENT); return XmlSyntaxTokenType.XML_COMMENT_START; + } + // fall through + 82 -> break + 40 -> { + return XmlSyntaxTokenType.XML_DOCTYPE_PUBLIC; + } + // fall through + 83 -> break + 41 -> { + return XmlSyntaxTokenType.XML_DOCTYPE_SYSTEM; + } + // fall through + 84 -> break + 42 -> { + yybegin(DOCTYPE); return XmlSyntaxTokenType.XML_DOCTYPE_START; + } + // fall through + 85 -> break + 43 -> { + yybegin(CDATA); return XmlSyntaxTokenType.XML_CDATA_START; + } + // fall through + 86 -> break + else -> + zzScanError(ZZ_NO_MATCH) + } + } + } + return null + } + + +} diff --git a/xml/xml-syntax/intellij.xml.syntax.iml b/xml/xml-syntax/intellij.xml.syntax.iml index d9e9557d7226..3a07524478fd 100644 --- a/xml/xml-syntax/intellij.xml.syntax.iml +++ b/xml/xml-syntax/intellij.xml.syntax.iml @@ -11,5 +11,9 @@ + + + + \ No newline at end of file diff --git a/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/XmlLexer.kt b/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/XmlLexer.kt new file mode 100644 index 000000000000..ff08386b1b90 --- /dev/null +++ b/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/XmlLexer.kt @@ -0,0 +1,72 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.xml.syntax.lexer + +import com.intellij.platform.syntax.SyntaxElementTypeSet +import com.intellij.platform.syntax.lexer.Lexer +import com.intellij.platform.syntax.syntaxElementTypeSetOf +import com.intellij.platform.syntax.util.lexer.FlexAdapter +import com.intellij.platform.syntax.util.lexer.MergingLexerAdapter +import com.intellij.xml.syntax.XmlSyntaxTokenType +import org.jetbrains.annotations.ApiStatus + +class XmlLexer(baseLexer: Lexer) : MergingLexerAdapter(baseLexer, TOKENS_TO_MERGE) { + + @JvmOverloads + constructor(conditionalCommentsSupport: Boolean = false) : + this(_XmlLexer(__XmlLexer(), conditionalCommentsSupport)) + +} + +@ApiStatus.Internal +val TOKENS_TO_MERGE: SyntaxElementTypeSet = syntaxElementTypeSetOf( + XmlSyntaxTokenType.XML_DATA_CHARACTERS, + XmlSyntaxTokenType.XML_TAG_CHARACTERS, + XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN, + XmlSyntaxTokenType.XML_PI_TARGET, + XmlSyntaxTokenType.XML_COMMENT_CHARACTERS, +) + +class _XmlLexer @JvmOverloads constructor( + flexLexer: __XmlLexer, + conditionalCommentsSupport: Boolean = false, +) : FlexAdapter(flexLexer) { + + private var myState: Int = __XmlLexer.YYINITIAL + + init { + flexLexer.setConditionalCommentsSupport(conditionalCommentsSupport) + } + + override fun getState(): Int = myState + + private fun packState() { + val flex = flex as __XmlLexer + this.myState = ((flex.yyprevstate() and STATE_MASK) shl STATE_SHIFT) or (flex.yystate() and STATE_MASK) + } + + private fun handleState(initialState: Int) { + val flex = flex as __XmlLexer + flex.yybegin(initialState and STATE_MASK) + flex.pushState((initialState shr STATE_SHIFT) and STATE_MASK) + packState() + } + + override fun start(buffer: CharSequence, startOffset: Int, endOffset: Int, initialState: Int) { + super.start(buffer, startOffset, endOffset, initialState) + handleState(initialState) + } + + override fun advance() { + super.advance() + packState() + } + + companion object { + private const val STATE_SHIFT = 5 + private val STATE_MASK = (1 shl STATE_SHIFT) - 1 + + init { + assert((STATE_MASK shl 1) <= HtmlLexerConstants.BASE_STATE_MASK) + } + } +} \ No newline at end of file diff --git a/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/_XmlLexer.flex b/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/_XmlLexer.flex new file mode 100644 index 000000000000..f7eaeb2d17d3 --- /dev/null +++ b/xml/xml-syntax/src/com/intellij/xml/syntax/lexer/_XmlLexer.flex @@ -0,0 +1,175 @@ + /* It's an automatically generated code. Do not modify it. */ +package com.intellij.xml.syntax.lexer + +import com.intellij.platform.syntax.SyntaxElementType +import com.intellij.platform.syntax.util.lexer.FlexLexer +import com.intellij.xml.syntax.XmlSyntaxTokenType +import com.intellij.xml.syntax.XmlSyntaxElementType +%% + +%{ + private var elTokenType = XmlSyntaxTokenType.XML_DATA_CHARACTERS + private var elTokenType2 = XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN + private var javaEmbeddedTokenType = XmlSyntaxTokenType.XML_ATTRIBUTE_VALUE_TOKEN + private var myConditionalCommentsSupport: Boolean = false + + fun setConditionalCommentsSupport(b: Boolean) { + myConditionalCommentsSupport = b + } + + public fun setElTypes(_elTokenType: SyntaxElementType, _elTokenType2: SyntaxElementType) { + elTokenType = _elTokenType; + elTokenType2 = _elTokenType2; + } + + public fun setJavaEmbeddedType(_tokenType: SyntaxElementType) { + javaEmbeddedTokenType = _tokenType; + } + + private var myPrevState = YYINITIAL + + fun yyprevstate() = myPrevState + + private fun popState(): Int { + val prev = myPrevState + myPrevState = YYINITIAL + return prev + } + + fun pushState(state: Int){ + myPrevState = state + } +%} + +%unicode +%class __XmlLexer +%public +%implements FlexLexer +%function advance +%type SyntaxElementType + +%state TAG +%state PROCESSING_INSTRUCTION +%state PI_ANY +%state END_TAG +%xstate COMMENT +%state ATTR_LIST +%state ATTR +%state ATTR_VALUE_START +%state ATTR_VALUE_DQ +%state ATTR_VALUE_SQ +%state DTD_MARKUP +%state DOCTYPE +%xstate CDATA +%state C_COMMENT_START +/* this state should be last, number of states should be less than 16 */ +%state C_COMMENT_END + +ALPHA=[:letter:] +DIGIT=[0-9] +WS=[\ \n\r\t\f\u2028\u2029\u0085] +S={WS}+ + +EL_EMBEDMENT_START="${" | "#{" +NAME=({ALPHA}|"_"|":")({ALPHA}|{DIGIT}|"_"|"."|"-")*(":"({ALPHA}|"_")?({ALPHA}|{DIGIT}|"_"|"."|"-")*)? + +END_COMMENT="-->" +CONDITIONAL_COMMENT_CONDITION=({ALPHA})({ALPHA}|{S}|{DIGIT}|"."|"("|")"|"|"|"!"|"&")* + +%% +"{ + "]]>" {yybegin(YYINITIAL); return XmlSyntaxTokenType.XML_CDATA_END; } + [^] {return XmlSyntaxTokenType.XML_DATA_CHARACTERS; } +} + +"