From 8eea40a0dcfbc274d32be083803371e43e562baa Mon Sep 17 00:00:00 2001 From: Victor Turansky Date: Mon, 2 Dec 2024 17:02:07 +0200 Subject: [PATCH] WEB-67476 Separate `XmlParserBundle` GitOrigin-RevId: 1fc5b1306140d145eadaa9dd2d5037fae4d814be --- .../XmlStructuralSearchProfile.java | 6 +-- .../formatter/TemplateFormatUtil.java | 6 +-- .../compact/parser/DeclarationParsing.java | 4 +- .../relaxNG/compact/parser/RncParser.java | 4 +- .../analysis/XmlErrorQuickFixProvider.java | 4 +- .../HtmlClosingTagErrorFilter.java | 4 +- .../XmlWrongClosingTagNameInspection.java | 4 +- .../messages/XmlParserBundle.properties | 28 +++++++++++ .../messages/XmlPsiBundle.properties | 29 ------------ .../intellij/xml/parsing/XmlParserBundle.kt | 30 ++++++++++++ .../com/intellij/lang/html/HtmlParsing.java | 40 ++++++++-------- .../impl/source/parsing/xml/DtdParsing.java | 24 +++++----- .../impl/source/parsing/xml/XmlParsing.java | 46 +++++++++---------- 13 files changed, 129 insertions(+), 100 deletions(-) create mode 100644 xml/xml-psi-api/resources/messages/XmlParserBundle.properties create mode 100644 xml/xml-psi-api/src/com/intellij/xml/parsing/XmlParserBundle.kt diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java b/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java index a75f349885897..89c0e69e28749 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/XmlStructuralSearchProfile.java @@ -23,7 +23,7 @@ import com.intellij.structuralsearch.plugin.replace.impl.ReplacerUtil; import com.intellij.structuralsearch.plugin.ui.Configuration; import com.intellij.util.LocalTimeCounter; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import com.intellij.xml.util.HtmlUtil; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NonNls; @@ -146,11 +146,11 @@ public void visitErrorElement(@NotNull PsiErrorElement element) { super.visitErrorElement(element); final String errorDescription = element.getErrorDescription(); final PsiElement parent = element.getParent(); - if (parent instanceof XmlAttribute && XmlPsiBundle.message("xml.parsing.expected.attribute.eq.sign").equals(errorDescription)) { + if (parent instanceof XmlAttribute && XmlParserBundle.message("xml.parsing.expected.attribute.eq.sign").equals(errorDescription)) { return; } else if (parent instanceof XmlTag && - XmlPsiBundle.message("xml.parsing.named.element.is.not.closed", ((XmlTag)parent).getName()).equals(errorDescription)) { + XmlParserBundle.message("xml.parsing.named.element.is.not.closed", ((XmlTag)parent).getName()).equals(errorDescription)) { return; } throw new MalformedPatternException(errorDescription); diff --git a/xml/impl/src/com/intellij/xml/template/formatter/TemplateFormatUtil.java b/xml/impl/src/com/intellij/xml/template/formatter/TemplateFormatUtil.java index 8e4acda160250..1e190eb1f6c6a 100644 --- a/xml/impl/src/com/intellij/xml/template/formatter/TemplateFormatUtil.java +++ b/xml/impl/src/com/intellij/xml/template/formatter/TemplateFormatUtil.java @@ -17,7 +17,7 @@ import com.intellij.psi.templateLanguages.OuterLanguageElement; import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider; import com.intellij.util.text.TextRangeUtil; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,8 +30,8 @@ public final class TemplateFormatUtil { private static final List EMPTY_PSI_ELEMENT_LIST = new ArrayList<>(); private static final String[] IGNORABLE_ERROR_MESSAGES = { - XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing"), - XmlPsiBundle.message("xml.parsing.closing.tag.name.missing") + XmlParserBundle.message("xml.parsing.closing.tag.matches.nothing"), + XmlParserBundle.message("xml.parsing.closing.tag.name.missing") }; private TemplateFormatUtil() { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/DeclarationParsing.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/DeclarationParsing.java index 75a7aaa22403e..a0fed4fdeaad5 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/DeclarationParsing.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/DeclarationParsing.java @@ -18,7 +18,7 @@ import com.intellij.lang.PsiBuilder; import com.intellij.psi.tree.IElementType; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.intellij.plugins.relaxNG.RelaxngBundle; import org.intellij.plugins.relaxNG.compact.RncElementTypes; @@ -77,7 +77,7 @@ private void parseGrammarContent(boolean allowInclude) { } else if (IDENTIFIERS.contains(t)) { parseDefine(); } else { - error(XmlPsiBundle.message("xml.parsing.unexpected.token")); + error(XmlParserBundle.message("xml.parsing.unexpected.token")); advance(); } } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java index c4c303752a36a..92378ffdae9a8 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java @@ -20,7 +20,7 @@ import com.intellij.lang.PsiBuilder; import com.intellij.lang.PsiParser; import com.intellij.psi.tree.IElementType; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.intellij.plugins.relaxNG.compact.RncElementTypes; import org.jetbrains.annotations.NotNull; @@ -34,7 +34,7 @@ public class RncParser implements PsiParser { new PatternParsing(builder).parse(); while (!builder.eof()) { - builder.error(XmlPsiBundle.message("xml.parsing.unexpected.token")); + builder.error(XmlParserBundle.message("xml.parsing.unexpected.token")); builder.advanceLexer(); } diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java index 6c51991a950e1..b8febdf8f6435 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java @@ -6,7 +6,7 @@ import com.intellij.psi.PsiErrorElement; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlTag; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.jetbrains.annotations.NotNull; public class XmlErrorQuickFixProvider implements ErrorQuickFixProvider { @@ -17,7 +17,7 @@ public void registerErrorQuickFix(@NotNull final PsiErrorElement element, @NotNu return; } final String text = element.getErrorDescription(); - if (text.equals(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference"))) { + if (text.equals(XmlParserBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference"))) { highlightInfo.registerFix( new EscapeCharacterIntentionFix(element, new TextRange(0, 1), "&", "&"), null, null, null, null); diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/highlighting/HtmlClosingTagErrorFilter.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/highlighting/HtmlClosingTagErrorFilter.java index ebb72d93aa36e..a649d6e97a765 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInsight/highlighting/HtmlClosingTagErrorFilter.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/highlighting/HtmlClosingTagErrorFilter.java @@ -7,7 +7,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.xml.XmlToken; import com.intellij.psi.xml.XmlTokenType; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.jetbrains.annotations.NotNull; final class HtmlClosingTagErrorFilter extends HighlightErrorFilter { @@ -24,7 +24,7 @@ public static boolean skip(@NotNull PsiErrorElement element) { final PsiElement[] children = element.getChildren(); if (children.length > 0) { if (children[0] instanceof XmlToken && XmlTokenType.XML_END_TAG_START == ((XmlToken)children[0]).getTokenType()) { - if (XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing").equals(element.getErrorDescription())) { + if (XmlParserBundle.message("xml.parsing.closing.tag.matches.nothing").equals(element.getErrorDescription())) { return true; } } diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java index 446ba3487ff10..d12359c57c70f 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java @@ -19,7 +19,7 @@ import com.intellij.psi.xml.XmlToken; import com.intellij.psi.xml.XmlTokenType; import com.intellij.xml.analysis.XmlAnalysisBundle; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import com.intellij.xml.util.HtmlUtil; import com.intellij.xml.util.XmlTagUtil; import org.jetbrains.annotations.NotNull; @@ -59,7 +59,7 @@ else if (psiElement instanceof PsiErrorElement) { PsiFile psiFile = holder.getCurrentAnnotationSession().getFile(); if (HTMLLanguage.INSTANCE == psiFile.getViewProvider().getBaseLanguage() || HTMLLanguage.INSTANCE == psiElement.getLanguage()) { - String message = XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing"); + String message = XmlParserBundle.message("xml.parsing.closing.tag.matches.nothing"); if (message.equals(((PsiErrorElement)psiElement).getErrorDescription()) && psiFile.getContext() == null) { holder.newAnnotation(HighlightSeverity.WARNING, message).range(psiElement).withFix(new RemoveExtraClosingTagIntentionAction()).create(); diff --git a/xml/xml-psi-api/resources/messages/XmlParserBundle.properties b/xml/xml-psi-api/resources/messages/XmlParserBundle.properties new file mode 100644 index 0000000000000..89162fbb876e0 --- /dev/null +++ b/xml/xml-psi-api/resources/messages/XmlParserBundle.properties @@ -0,0 +1,28 @@ +dtd.parser.message.left.paren.or.entityref.or.empty.or.any.expected=( or entity ref or EMPTY or ANY expected +dtd.parser.message.literal.public.system.expected=Literal, PUBLIC or SYSTEM expected +dtd.parser.message.name.expected=XML name expected +dtd.parser.message.name.or.entity.ref.expected=XML name or entity ref expected +dtd.parser.message.rparen.expected=) expected +dtd.parser.message.whitespace.expected=Whitespace expected +dtd.parser.message.expected.prologue.tag.termination.expected='?>' expected + +xml.parsing.absent.root.tag=Valid XML document must have a root tag +xml.parsing.attribute.value.expected=Attribute value expected +xml.parsing.bad.character=Bad character +xml.parsing.closing.tag.is.not.done=Closing tag is not valid +xml.parsing.closing.tag.matches.nothing=Closing tag matches nothing +xml.parsing.closing.tag.name.missing=Closing tag name is missing +xml.parsing.expected.attribute.eq.sign== expected +xml.parsing.named.element.is.not.closed=Element {0} is not closed +xml.parsing.multiple.root.tags=Multiple root tags +xml.parsing.processing.instruction.name.expected=Processing instruction name expected +xml.parsing.tag.name.expected=Tag name expected +xml.parsing.tag.start.is.not.closed=Tag start is not closed +xml.parsing.top.level.element.is.not.completed=Top level element is not completed +xml.parsing.unclosed.attribute.value=Attribute value is not closed +xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference=Unescaped \\& or nonterminated character/entity reference +xml.parsing.unexpected.end.of.file=Unexpected end of file +xml.parsing.unexpected.token=Unexpected token +xml.parsing.unexpected.tokens=Unexpected tokens +xml.parsing.unterminated.processing.instruction=Processing instruction not terminated +xml.parsing.way.too.unbalanced=Way too unbalanced. Stopping attempt to balance tags properly at this point diff --git a/xml/xml-psi-api/resources/messages/XmlPsiBundle.properties b/xml/xml-psi-api/resources/messages/XmlPsiBundle.properties index 2768025159f65..777433ac18447 100644 --- a/xml/xml-psi-api/resources/messages/XmlPsiBundle.properties +++ b/xml/xml-psi-api/resources/messages/XmlPsiBundle.properties @@ -1,11 +1,3 @@ -dtd.parser.message.left.paren.or.entityref.or.empty.or.any.expected=( or entity ref or EMPTY or ANY expected -dtd.parser.message.literal.public.system.expected=Literal, PUBLIC or SYSTEM expected -dtd.parser.message.name.expected=XML name expected -dtd.parser.message.name.or.entity.ref.expected=XML name or entity ref expected -dtd.parser.message.rparen.expected=) expected -dtd.parser.message.whitespace.expected=Whitespace expected -dtd.parser.message.expected.prologue.tag.termination.expected='?>' expected - filetype.dtd.description=XML Document Type Definition filetype.html.description=HTML filetype.xhtml.description=XHTML @@ -23,27 +15,6 @@ xml.inspections.validate.external.resource.is.not.registered=External resource { xml.namespace.prefix=XML Namespace Prefix -xml.parsing.absent.root.tag=Valid XML document must have a root tag -xml.parsing.attribute.value.expected=Attribute value expected -xml.parsing.bad.character=Bad character -xml.parsing.closing.tag.is.not.done=Closing tag is not valid -xml.parsing.closing.tag.matches.nothing=Closing tag matches nothing -xml.parsing.closing.tag.name.missing=Closing tag name is missing -xml.parsing.expected.attribute.eq.sign== expected -xml.parsing.named.element.is.not.closed=Element {0} is not closed -xml.parsing.multiple.root.tags=Multiple root tags -xml.parsing.processing.instruction.name.expected=Processing instruction name expected -xml.parsing.tag.name.expected=Tag name expected -xml.parsing.tag.start.is.not.closed=Tag start is not closed -xml.parsing.top.level.element.is.not.completed=Top level element is not completed -xml.parsing.unclosed.attribute.value=Attribute value is not closed -xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference=Unescaped \\& or nonterminated character/entity reference -xml.parsing.unexpected.end.of.file=Unexpected end of file -xml.parsing.unexpected.token=Unexpected token -xml.parsing.unexpected.tokens=Unexpected tokens -xml.parsing.unterminated.processing.instruction=Processing instruction not terminated -xml.parsing.way.too.unbalanced=Way too unbalanced. Stopping attempt to balance tags properly at this point - xml.schema.validation.attr.not.allowed.with.ref=Attribute {0} is not allowed here when element reference is used xml.schema.validation.default.or.fixed.should.be.specified.but.not.both='default' and 'fixed' attributes should not be present in the same time xml.schema.validation.max.occurs.should.be.not.less.than.min.occurs=maxOccurs value should be greater than minOccurs value diff --git a/xml/xml-psi-api/src/com/intellij/xml/parsing/XmlParserBundle.kt b/xml/xml-psi-api/src/com/intellij/xml/parsing/XmlParserBundle.kt new file mode 100644 index 0000000000000..17696dd4a290b --- /dev/null +++ b/xml/xml-psi-api/src/com/intellij/xml/parsing/XmlParserBundle.kt @@ -0,0 +1,30 @@ +package com.intellij.xml.parsing + +import com.intellij.DynamicBundle +import org.jetbrains.annotations.Nls +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey +import java.util.function.Supplier + +object XmlParserBundle { + const val BUNDLE: @NonNls String = "messages.XmlParserBundle" + private val INSTANCE = DynamicBundle(XmlParserBundle::class.java, BUNDLE) + + @JvmStatic + fun message( + @PropertyKey(resourceBundle = BUNDLE) + key: String, + vararg params: Any?, + ): @Nls String { + return INSTANCE.getMessage(key = key, params = params) + } + + @JvmStatic + fun messagePointer( + @PropertyKey(resourceBundle = BUNDLE) + key: String, + vararg params: Any?, + ): Supplier { + return INSTANCE.getLazyMessage(key = key, params = params) + } +} diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlParsing.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlParsing.java index c539e949f8f83..d3a2c547d2edd 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlParsing.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlParsing.java @@ -14,7 +14,7 @@ import com.intellij.util.Processor; import com.intellij.util.ThreeState; import com.intellij.util.containers.Stack; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import com.intellij.xml.util.HtmlUtil; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -74,7 +74,7 @@ else if (tt == XmlTokenType.XML_END_TAG_START) { } } - tagEndError.error(XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing")); + tagEndError.error(XmlParserBundle.message("xml.parsing.closing.tag.matches.nothing")); } else if (hasCustomTopLevelContent()) { error = parseCustomTopLevelContent(error); @@ -88,7 +88,7 @@ else if (hasCustomTopLevelContent()) { flushIncompleteStackItemsWhile((item) -> true); if (error != null) { - error.error(XmlPsiBundle.message("xml.parsing.top.level.element.is.not.completed")); + error.error(XmlParserBundle.message("xml.parsing.top.level.element.is.not.completed")); } document.done(XmlElementType.HTML_DOCUMENT); @@ -138,7 +138,7 @@ protected void parseCustomTagHeaderContent() { protected static @Nullable PsiBuilder.Marker flushError(PsiBuilder.Marker error) { if (error != null) { - error.error(XmlPsiBundle.message("xml.parsing.unexpected.tokens")); + error.error(XmlParserBundle.message("xml.parsing.unexpected.tokens")); } return null; } @@ -150,7 +150,7 @@ private void parseDoctype() { while (token() != XmlTokenType.XML_DOCTYPE_END && !eof()) advance(); if (eof()) { - error(XmlPsiBundle.message("xml.parsing.unexpected.end.of.file")); + error(XmlParserBundle.message("xml.parsing.unexpected.end.of.file")); } else { advance(); @@ -191,7 +191,7 @@ public void parseTag() { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.tag.start.is.not.closed")); + error(XmlParserBundle.message("xml.parsing.tag.start.is.not.closed")); doneTag(); continue; } @@ -239,7 +239,7 @@ else if (tt == XmlTokenType.XML_BAD_CHARACTER) { xmlText = startText(xmlText); final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); + error.error(XmlParserBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); } else if (tt instanceof ICustomParsingType || tt instanceof ILazyParseableElementType) { xmlText = terminateText(xmlText); @@ -263,13 +263,13 @@ else if (token() == XmlTokenType.XML_END_TAG_START) { if (itemOnStack instanceof HtmlTagInfo tagOnStack && isTagFurtherInStack(endTagName)) { footer.rollbackTo(); if (!canClosingTagAutoClose(tagOnStack, endTagName)) { - error(XmlPsiBundle.message("xml.parsing.named.element.is.not.closed", tagOnStack.getOriginalName())); + error(XmlParserBundle.message("xml.parsing.named.element.is.not.closed", tagOnStack.getOriginalName())); } doneTag(); } else { if (token() == XmlTokenType.XML_TAG_END) advance(); - footer.error(XmlPsiBundle.message("xml.parsing.closing.tag.matches.nothing")); + footer.error(XmlParserBundle.message("xml.parsing.closing.tag.matches.nothing")); } continue; } @@ -278,12 +278,12 @@ else if (token() == XmlTokenType.XML_END_TAG_START) { token() != XmlTokenType.XML_START_TAG_START && token() != XmlTokenType.XML_END_TAG_START && !eof()) { - error(XmlPsiBundle.message("xml.parsing.unexpected.token")); + error(XmlParserBundle.message("xml.parsing.unexpected.token")); advance(); } } else { - error(XmlPsiBundle.message("xml.parsing.closing.tag.name.missing")); + error(XmlParserBundle.message("xml.parsing.closing.tag.name.missing")); } footer.drop(); @@ -291,7 +291,7 @@ else if (token() == XmlTokenType.XML_END_TAG_START) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.closing.tag.is.not.done")); + error(XmlParserBundle.message("xml.parsing.closing.tag.is.not.done")); } if (hasTags()) { @@ -321,7 +321,7 @@ else if (hasCustomTagContent()) { protected @NotNull String parseOpenTagName() { String originalTagName; if (token() != XmlTokenType.XML_NAME) { - error(XmlPsiBundle.message("xml.parsing.tag.name.expected")); + error(XmlParserBundle.message("xml.parsing.tag.name.expected")); originalTagName = ""; } else { @@ -535,7 +535,7 @@ protected void parseComment() { if (tt == XmlTokenType.XML_BAD_CHARACTER) { final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.bad.character")); + error.error(XmlParserBundle.message("xml.parsing.bad.character")); continue; } if (tt == XmlTokenType.XML_COMMENT_END) { @@ -591,7 +591,7 @@ protected void parseAttributeValue() { if (tt == XmlTokenType.XML_BAD_CHARACTER) { final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); + error.error(XmlParserBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); } else if (tt == XmlTokenType.XML_ENTITY_REF_TOKEN) { parseReference(); @@ -609,7 +609,7 @@ else if (hasCustomAttributeValueContent()) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.unclosed.attribute.value")); + error(XmlParserBundle.message("xml.parsing.unclosed.attribute.value")); } } else if (hasCustomAttributeValue()) { @@ -698,7 +698,7 @@ protected void parseProcessingInstruction() { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.expected.attribute.eq.sign")); + error(XmlParserBundle.message("xml.parsing.expected.attribute.eq.sign")); } parseAttributeValue(); } @@ -707,7 +707,7 @@ protected void parseProcessingInstruction() { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.unterminated.processing.instruction")); + error(XmlParserBundle.message("xml.parsing.unterminated.processing.instruction")); } pi.done(XmlElementType.XML_PROCESSING_INSTRUCTION); @@ -795,14 +795,14 @@ public void done(@NotNull PsiBuilder builder, @Nullable PsiBuilder.Marker before var myElementType = getHtmlTagElementType(this, myItemsStack.size() + 1); if (beforeMarker == null) { if (incomplete && isEndTagRequired(this)) { - builder.error(XmlPsiBundle.message("xml.parsing.named.element.is.not.closed", getOriginalName())); + builder.error(XmlParserBundle.message("xml.parsing.named.element.is.not.closed", getOriginalName())); } startMarker.done(myElementType); } else { if (incomplete && isEndTagRequired(this)) { beforeMarker.precede() - .errorBefore(XmlPsiBundle.message("xml.parsing.named.element.is.not.closed", getOriginalName()), beforeMarker); + .errorBefore(XmlParserBundle.message("xml.parsing.named.element.is.not.closed", getOriginalName()), beforeMarker); } startMarker.doneBefore(myElementType, beforeMarker); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java index e66e06b9062fe..311e7e99ee6f1 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/DtdParsing.java @@ -19,7 +19,7 @@ import com.intellij.psi.tree.TokenSet; import com.intellij.psi.xml.XmlElementType; import com.intellij.psi.xml.XmlEntityDecl; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.jetbrains.annotations.NotNull; public class DtdParsing extends XmlParsing implements XmlElementType { @@ -215,7 +215,7 @@ private boolean parseCompositeName() { if (myBuilder.getTokenType() == XML_LEFT_PAREN) { parseGroup(); } else { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.name.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.name.expected")); return true; } } @@ -227,7 +227,7 @@ private void parseEntityDeclContent() { if (tokenType != XML_ATTRIBUTE_VALUE_START_DELIMITER && tokenType != XML_DOCTYPE_PUBLIC && tokenType != XML_DOCTYPE_SYSTEM) { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.literal.public.system.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.literal.public.system.expected")); return; } @@ -488,7 +488,7 @@ private boolean consumeKeywordAsName(IElementType type) { private void doParseContentSpec(boolean topLevel) { if (!topLevel && myBuilder.rawLookup(0) != XML_WHITE_SPACE) { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.whitespace.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.whitespace.expected")); } else if (!topLevel) { final IElementType tokenType = myBuilder.getTokenType(); String tokenText; @@ -501,7 +501,7 @@ private void doParseContentSpec(boolean topLevel) { ) { PsiBuilder.Marker spec = myBuilder.mark(); spec.done(XML_ELEMENT_CONTENT_SPEC); - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.left.paren.or.entityref.or.empty.or.any.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.left.paren.or.entityref.or.empty.or.any.expected")); return; } } @@ -549,7 +549,7 @@ else if (consumeKeywordAsName(tokenType)) { endedWithDelimiter = false; } else { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.name.or.entity.ref.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.name.or.entity.ref.expected")); return false; } @@ -575,7 +575,7 @@ else if (consumeKeywordAsName(tokenType)) { } if (endedWithDelimiter && tokenType == XML_RIGHT_PAREN) { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.name.or.entity.ref.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.name.or.entity.ref.expected")); } return true; } @@ -590,7 +590,7 @@ private boolean parseGroup() { return true; } if (b) { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.rparen.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.rparen.expected")); group.done(XML_ELEMENT_CONTENT_GROUP); return false; } @@ -611,7 +611,7 @@ private void parseAttlistDecl() { if (tokenType == XML_LEFT_PAREN) { parseGroup(); } else { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.name.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.name.expected")); decl.done(XML_ATTLIST_DECL); return; } @@ -722,7 +722,7 @@ private void parseDecl() { addToken(); } else { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.expected.prologue.tag.termination.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.expected.prologue.tag.termination.expected")); } decl.done(XML_DECL); @@ -742,7 +742,7 @@ private void parseAttributeList() { if (lastPosition != -1) { if (lastPosition == myBuilder.getCurrentOffset()) { - myBuilder.error(XmlPsiBundle.message("dtd.parser.message.whitespace.expected")); + myBuilder.error(XmlParserBundle.message("dtd.parser.message.whitespace.expected")); lastPosition = -1; } } @@ -750,7 +750,7 @@ private void parseAttributeList() { addToken(); if (myBuilder.getTokenType() != XML_EQ) { - myBuilder.error(XmlPsiBundle.message("xml.parsing.expected.attribute.eq.sign")); + myBuilder.error(XmlParserBundle.message("xml.parsing.expected.attribute.eq.sign")); continue; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParsing.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParsing.java index c637dc953a3df..e0afa506f22c0 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParsing.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParsing.java @@ -9,7 +9,7 @@ import com.intellij.psi.tree.ILazyParseableElementType; import com.intellij.psi.xml.XmlTokenType; import com.intellij.util.containers.Stack; -import com.intellij.xml.psi.XmlPsiBundle; +import com.intellij.xml.parsing.XmlParserBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,13 +65,13 @@ else if (tt == XML_REAL_WHITE_SPACE) { } if (error != null) { - error.error(XmlPsiBundle.message("xml.parsing.top.level.element.is.not.completed")); + error.error(XmlParserBundle.message("xml.parsing.top.level.element.is.not.completed")); } if (rootTagCount == 0) { final PsiBuilder.Marker rootTag = mark(); error = mark(); - error.error(XmlPsiBundle.message("xml.parsing.absent.root.tag")); + error.error(XmlParserBundle.message("xml.parsing.absent.root.tag")); rootTag.done(XML_TAG); } @@ -80,7 +80,7 @@ else if (tt == XML_REAL_WHITE_SPACE) { private static @Nullable PsiBuilder.Marker flushError(PsiBuilder.Marker error) { if (error != null) { - error.error(XmlPsiBundle.message("xml.parsing.unexpected.tokens")); + error.error(XmlParserBundle.message("xml.parsing.unexpected.tokens")); } return null; } @@ -92,7 +92,7 @@ private void parseDoctype() { while (token() != XML_DOCTYPE_END && !eof()) advance(); if (eof()) { - error(XmlPsiBundle.message("xml.parsing.unexpected.end.of.file")); + error(XmlParserBundle.message("xml.parsing.unexpected.end.of.file")); } else { advance(); @@ -120,7 +120,7 @@ protected void parseTag(boolean multipleRootTagError) { if (!tagName.equals(endName) && myTagNamesStack.contains(endName)) { footer.rollbackTo(); myTagNamesStack.pop(); - tag.doneBefore(XML_TAG, content, XmlPsiBundle.message("xml.parsing.named.element.is.not.closed", tagName)); + tag.doneBefore(XML_TAG, content, XmlParserBundle.message("xml.parsing.named.element.is.not.closed", tagName)); content.drop(); return; } @@ -128,12 +128,12 @@ protected void parseTag(boolean multipleRootTagError) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.closing.tag.name.missing")); + error(XmlParserBundle.message("xml.parsing.closing.tag.name.missing")); } footer.drop(); while (token() != XmlTokenType.XML_TAG_END && token() != XmlTokenType.XML_START_TAG_START && token() != XmlTokenType.XML_END_TAG_START && !eof()) { - error(XmlPsiBundle.message("xml.parsing.unexpected.token")); + error(XmlParserBundle.message("xml.parsing.unexpected.token")); advance(); } @@ -141,11 +141,11 @@ protected void parseTag(boolean multipleRootTagError) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.closing.tag.is.not.done")); + error(XmlParserBundle.message("xml.parsing.closing.tag.is.not.done")); } } else { - error(XmlPsiBundle.message("xml.parsing.unexpected.end.of.file")); + error(XmlParserBundle.message("xml.parsing.unexpected.end.of.file")); } content.drop(); @@ -157,7 +157,7 @@ protected void parseTag(boolean multipleRootTagError) { if (multipleRootTagError) { final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.multiple.root.tags")); + error.error(XmlParserBundle.message("xml.parsing.multiple.root.tags")); } else { advance(); @@ -165,7 +165,7 @@ protected void parseTag(boolean multipleRootTagError) { final String tagName; if (token() != XML_NAME || myBuilder.rawLookup(-1) == TokenType.WHITE_SPACE) { - error(XmlPsiBundle.message("xml.parsing.tag.name.expected")); + error(XmlParserBundle.message("xml.parsing.tag.name.expected")); tagName = ""; } else { @@ -200,14 +200,14 @@ else if (tt == XML_CHAR_ENTITY_REF || tt == XML_ENTITY_REF_TOKEN) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.tag.start.is.not.closed")); + error(XmlParserBundle.message("xml.parsing.tag.start.is.not.closed")); myTagNamesStack.pop(); tag.done(XML_TAG); return null; } if (myTagNamesStack.size() > BALANCING_DEPTH_THRESHOLD) { - error(XmlPsiBundle.message("xml.parsing.way.too.unbalanced")); + error(XmlParserBundle.message("xml.parsing.way.too.unbalanced")); tag.done(XML_TAG); return null; } @@ -251,7 +251,7 @@ else if (tt == XML_BAD_CHARACTER) { xmlText = startText(xmlText); final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); + error.error(XmlParserBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); } else if (tt instanceof ICustomParsingType || tt instanceof ILazyParseableElementType) { xmlText = terminateText(xmlText); @@ -316,7 +316,7 @@ protected void parseComment() { else if (tt == XML_BAD_CHARACTER) { final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.bad.character")); + error.error(XmlParserBundle.message("xml.parsing.bad.character")); continue; } if (tt == XML_COMMENT_END) { @@ -350,7 +350,7 @@ private void parseAttribute() { parseAttributeValue(); } else { - error(XmlPsiBundle.message("xml.parsing.expected.attribute.eq.sign")); + error(XmlParserBundle.message("xml.parsing.expected.attribute.eq.sign")); } att.done(XML_ATTRIBUTE); } @@ -368,7 +368,7 @@ private void parseAttributeValue() { if (tt == XML_BAD_CHARACTER) { final PsiBuilder.Marker error = mark(); advance(); - error.error(XmlPsiBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); + error.error(XmlParserBundle.message("xml.parsing.unescaped.ampersand.or.nonterminated.character.entity.reference")); } else if (tt == XML_ENTITY_REF_TOKEN) { parseReference(); @@ -382,11 +382,11 @@ else if (tt == XML_ENTITY_REF_TOKEN) { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.unclosed.attribute.value")); + error(XmlParserBundle.message("xml.parsing.unclosed.attribute.value")); } } else { - error(XmlPsiBundle.message("xml.parsing.attribute.value.expected")); + error(XmlParserBundle.message("xml.parsing.attribute.value.expected")); } attValue.done(XML_ATTRIBUTE_VALUE); @@ -420,7 +420,7 @@ private void parseProcessingInstruction() { final PsiBuilder.Marker pi = mark(); advance(); if (token() != XML_NAME) { - error(XmlPsiBundle.message("xml.parsing.processing.instruction.name.expected")); + error(XmlParserBundle.message("xml.parsing.processing.instruction.name.expected")); } else { advance(); @@ -438,7 +438,7 @@ private void parseProcessingInstruction() { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.expected.attribute.eq.sign")); + error(XmlParserBundle.message("xml.parsing.expected.attribute.eq.sign")); } parseAttributeValue(); } @@ -448,7 +448,7 @@ private void parseProcessingInstruction() { advance(); } else { - error(XmlPsiBundle.message("xml.parsing.unterminated.processing.instruction")); + error(XmlParserBundle.message("xml.parsing.unterminated.processing.instruction")); } pi.done(XML_PROCESSING_INSTRUCTION);