Package com.asakusafw.dmdl

Examples of com.asakusafw.dmdl.Diagnostic


        if (definition == null) {
            throw new IllegalArgumentException("definition must not be null"); //$NON-NLS-1$
        }
        DmdlSemantics world = context.getWorld();
        if (world.findModelDeclaration(definition.name.identifier) != null) {
            report(new Diagnostic(
                    Diagnostic.Level.ERROR,
                    definition.name,
                    Messages.getString("DmdlAnalyzer.diagnosticModelDuplicated"), //$NON-NLS-1$
                    definition.name.identifier));
        } else {
View Full Code Here


                    AstSimpleName node = null;
                    ModelDeclaration md = context.getWorld().findModelDeclaration(modelName);
                    if (md != null) {
                        node = md.getName();
                    }
                    report(new Diagnostic(
                            Level.ERROR,
                            node,
                            Messages.getString("DmdlAnalyzer.diagnosticCyclicDependencies"), //$NON-NLS-1$
                            modelName,
                            loop));
View Full Code Here

        assert expression != null;
        LOG.debug("Resolving joined: {}", model.getName()); //$NON-NLS-1$
        List<ReduceTerm<AstJoin>> results = Lists.create();
        List<AstJoin> terms = extract(expression);
        if (terms.size() >= 3) {
            report(new Diagnostic(
                    Level.ERROR,
                    expression,
                    Messages.getString("DmdlAnalyzer.diagnosticTooManyJoinTerms"))); //$NON-NLS-1$
        }
        for (AstJoin term : terms) {
            LOG.debug("Resolving joined term: {} -> {}", model.getName(), term.reference.name); //$NON-NLS-1$
            ModelSymbol source = context.getWorld().createModelSymbol(term.reference.name);
            if (source.findDeclaration() == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        term.reference,
                        Messages.getString("DmdlAnalyzer.diagnosticMissingJoinModel"), //$NON-NLS-1$
                        term.reference.name));
                continue;
View Full Code Here

            }
        } else {
            Set<String> saw = Sets.create();
            for (AstPropertyMapping property : term.mapping.properties) {
                if (saw.contains(property.target.identifier)) {
                    report(new Diagnostic(
                            Level.ERROR,
                            property,
                            Messages.getString("DmdlAnalyzer.diagnosticDuplicatedJoinMappingProperty"), //$NON-NLS-1$
                            property.target.identifier));
                    continue;
                }
                saw.add(property.target.identifier);
                PropertyDeclaration sourceProp = sourceDecl.findPropertyDeclaration(property.source.identifier);
                if (sourceProp == null) {
                    report(new Diagnostic(
                            Level.ERROR,
                            sourceModel.getName(),
                            Messages.getString("DmdlAnalyzer.diagnosticMissingJoinProperty"), //$NON-NLS-1$
                            property.source.identifier,
                            sourceModel.getName().identifier));
View Full Code Here

                PropertySymbol target = factor.getTarget();
                Type declared = typeMap.get(target.getName().identifier);
                if (declared == null) {
                    typeMap.put(target.getName().identifier, target.findDeclaration().getType());
                } else if (groupingProperties.contains(target.getName().identifier) == false) {
                    report(new Diagnostic(
                            Level.ERROR,
                            term.getOriginalAst(),
                            Messages.getString("DmdlAnalyzer.diagnosticDuplicatedJoinGroupingProperty"), //$NON-NLS-1$
                            target.getName().identifier));
                    green = false;
View Full Code Here

        List<ReduceTerm<AstSummarize>> results = Lists.create();
        for (AstSummarize term : extract(expression)) {
            LOG.debug("Resolving summarized term: {} -> {}", model.getName(), term.reference.name); //$NON-NLS-1$
            ModelSymbol source = context.getWorld().createModelSymbol(term.reference.name);
            if (source.findDeclaration() == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        term.reference,
                        Messages.getString("DmdlAnalyzer.diagnosticMissingSummarizeModel"), //$NON-NLS-1$
                        term.reference.name));
                continue;
View Full Code Here

        assert decl != null;
        Map<String, PropertyDeclaration> results = new HashMap<String, PropertyDeclaration>();
        for (AstPropertyFolding property : term.folding.properties) {
            PropertyDeclaration original = decl.findPropertyDeclaration(property.source.identifier);
            if (original == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        source.getName(),
                        Messages.getString("DmdlAnalyzer.diagnosticMissingSummarizeFoldingProperty"), //$NON-NLS-1$
                        property.source.identifier,
                        source.getName().identifier));
                continue;
            }
            PropertyMappingKind mapping = resolveAggregateFunction(property.aggregator);
            if (mapping == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        property.aggregator,
                        Messages.getString("DmdlAnalyzer.diagnosticMissingSummarizeAggregateFunction"), //$NON-NLS-1$
                        property.aggregator.toString()));
                continue;
            }
            Type resolved = original.getType().map(mapping);
            if (resolved == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        property,
                        Messages.getString(
                                "DmdlAnalyzer.diagnosticInconsistentSummarizeAggregateFunction"), //$NON-NLS-1$
                        property.aggregator.toString(),
                        property.source.identifier,
                        original.getType()));
                continue;
            }
            PropertyDeclaration declared = model.findPropertyDeclaration(property.target.identifier);
            if (declared != null) {
                report(new Diagnostic(
                        Level.ERROR,
                        property.target,
                        Messages.getString("DmdlAnalyzer.diagnosticDuplicatedSummarizeProperty"), //$NON-NLS-1$
                        property.target.identifier));
                continue;
View Full Code Here

        } else {
            List<PropertySymbol> results = Lists.create();
            for (AstSimpleName name : grouping.properties) {
                PropertyDeclaration property = properties.get(name.identifier);
                if (property == null) {
                    report(new Diagnostic(
                            Level.ERROR,
                            name,
                            Messages.getString("DmdlAnalyzer.diagnosticMissingSummarizeGroupingProperty"), //$NON-NLS-1$
                            name.identifier));
                    continue;
View Full Code Here

        ReduceTerm<T> first = iter.next();
        List<PropertyDeclaration> firstSources = resolveGroupingSources(first);
        while (iter.hasNext()) {
            ReduceTerm<T> next = iter.next();
            if (first.getGrouping().size() != next.getGrouping().size()) {
                report(new Diagnostic(
                        Level.ERROR,
                        next.getOriginalAst(),
                        Messages.getString("DmdlAnalyzer.diagnosticInconsistentNumberGroupingProperties"), //$NON-NLS-1$
                        model.getName()));
                return false;
            }
            List<PropertyDeclaration> nextSources = resolveGroupingSources(next);
            assert firstSources.size() == nextSources.size();
            for (int i = 0, n = firstSources.size(); i < n; i++) {
                PropertyDeclaration left = firstSources.get(i);
                PropertyDeclaration right = nextSources.get(i);
                if (left.getType().isSame(right.getType()) == false) {
                    PropertySymbol rightSymbol = next.getGrouping().get(i);
                    report(new Diagnostic(
                            Level.ERROR,
                            rightSymbol.getOriginalAst(),
                            Messages.getString("DmdlAnalyzer.diagnosticInconsistentTypeGroupingProperty"), //$NON-NLS-1$
                            rightSymbol.getName()));
                    green = false;
View Full Code Here

        for (AstAttribute attribute : declaration.getAttributes()) {
            String name = attribute.name.toString();
            LOG.debug("Resolving attribute: {} -> {}", declaration.getName(), name); //$NON-NLS-1$
            AttributeDriver driver = context.findAttributeDriver(attribute);
            if (driver == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        attribute.name,
                        Messages.getString("DmdlAnalyzer.diagnosticUnknownAttribute"), //$NON-NLS-1$
                        name));
                continue;
View Full Code Here

TOP

Related Classes of com.asakusafw.dmdl.Diagnostic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.