All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.vespa.schemals.schemadocument.parser.IdentifyDocumentSummaryInheritance Maven / Gradle / Ivy

There is a newer version: 8.458.13
Show newest version
package ai.vespa.schemals.schemadocument.parser;

import java.util.ArrayList;

import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.DiagnosticSeverity;

import ai.vespa.schemals.common.SchemaDiagnostic;
import ai.vespa.schemals.context.ParseContext;
import ai.vespa.schemals.parser.ast.identifierWithDashStr;
import ai.vespa.schemals.parser.ast.inheritsDocumentSummary;
import ai.vespa.schemals.tree.SchemaNode;

/**
 * IdentifyDocumentSummaryInheritance identifies a document-summary inheritance and adds it to a list to resolve later
 */
public class IdentifyDocumentSummaryInheritance extends Identifier {

	public IdentifyDocumentSummaryInheritance(ParseContext context) {
		super(context);
	}

	@Override
	public ArrayList identify(SchemaNode node) {
        ArrayList ret = new ArrayList<>();

        if (!node.isSchemaASTInstance(identifierWithDashStr.class)) return ret;
        if (node.getParent() == null || !node.getParent().isSchemaASTInstance(inheritsDocumentSummary.class)) return ret;

        if (!node.hasSymbol()) {
            ret.add(new SchemaDiagnostic.Builder()
                .setRange(node.getRange())
                .setMessage("Should be reference")
                .setSeverity(DiagnosticSeverity.Warning)
                .build());
        }

        context.addUnresolvedInheritanceNode(node);

        return ret;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy