use of org.jetbrains.lang.manifest.header.HeaderParser in project intellij-community by JetBrains.
the class HeaderAnnotator method annotate.
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
if (psiElement instanceof Header) {
Header header = (Header) psiElement;
String name = header.getName();
if (!isValidName(name)) {
holder.createAnnotation(HighlightSeverity.ERROR, header.getNameElement().getTextRange(), ManifestBundle.message("header.name.invalid"));
} else {
HeaderParser headerParser = myRepository.getHeaderParser(name);
if (headerParser != null) {
headerParser.annotate(header, holder);
}
}
}
}
use of org.jetbrains.lang.manifest.header.HeaderParser in project intellij-community by JetBrains.
the class ManifestParser method parseHeader.
private void parseHeader(PsiBuilder builder) {
PsiBuilder.Marker header = builder.mark();
String headerName = builder.getTokenText();
assert headerName != null : "[" + builder.getOriginalText() + "]@" + builder.getCurrentOffset();
builder.advanceLexer();
if (builder.getTokenType() == ManifestTokenType.COLON) {
builder.advanceLexer();
if (!expect(builder, ManifestTokenType.SIGNIFICANT_SPACE)) {
builder.error(ManifestBundle.message("manifest.whitespace.expected"));
}
HeaderParser headerParser = notNull(myRepository.getHeaderParser(headerName), StandardHeaderParser.INSTANCE);
headerParser.parse(builder);
} else {
PsiBuilder.Marker marker = builder.mark();
consumeHeaderValue(builder);
marker.error(ManifestBundle.message("manifest.colon.expected"));
}
header.done(ManifestElementType.HEADER);
}
Aggregations