Package com.asakusafw.dmdl

Examples of com.asakusafw.dmdl.Diagnostic


            throw new IllegalArgumentException("literalKind must not be null"); //$NON-NLS-1$
        }
        AstAttributeElement target = elements.remove(elementName);
        if (target == null) {
            if (mandatory) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        attribute.name,
                        Messages.getString("AttributeUtil.diagnosticMissingElement"), //$NON-NLS-1$
                        attribute.name.toString(),
                        elementName));
            }
            return null;
        } else if (isLiteral(target.value, literalKind) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    target,
                    Messages.getString("AttributeUtil.diagnosticNotLiteral"), //$NON-NLS-1$
                    attribute.name.toString(),
                    elementName,
View Full Code Here


                if (kind == accept) {
                    return true;
                }
            }
        }
        environment.report(new Diagnostic(
                Level.ERROR,
                attribute,
                Messages.getString("AttributeUtil.diagnosticInvalidTypeElement"), //$NON-NLS-1$
                declaration.getOwner().getName().identifier,
                declaration.getName().identifier,
View Full Code Here

            DmdlSemantics environment,
            AstNode targetNode,
            String targetLabel,
            String value) {
        if (value == null || value.isEmpty()) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    targetNode,
                    Messages.getString("AttributeUtil.diagnosticEmptyString"), //$NON-NLS-1$
                    targetLabel));
            return false;
View Full Code Here

            AstNode targetNode,
            String targetLabel,
            BigInteger value,
            Long minimum, Long maximum) {
        if (maximum != null && value.compareTo(BigInteger.valueOf(maximum)) > 0) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    targetNode,
                    Messages.getString("AttributeUtil.diagnosticNumberTooLarge"), //$NON-NLS-1$
                    targetLabel,
                    maximum,
                    value));
            return false;
        } else if (minimum != null && value.compareTo(BigInteger.valueOf(minimum)) < 0) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    targetNode,
                    Messages.getString("AttributeUtil.diagnosticNumberTooSmall"), //$NON-NLS-1$
                    targetLabel,
                    minimum,
View Full Code Here

        }
        String message = MessageFormat.format(
                Messages.getString("DmdlSyntaxException.errorSyntax"), //$NON-NLS-1$
                location,
                kind.getMessage(arguments));
        return new Diagnostic(Diagnostic.Level.ERROR, region, message);
    }
View Full Code Here

            DmdlSemantics environment,
            Declaration declaration,
            AstAttribute attribute) {
        assert attribute.name.toString().equals(getTargetName());
        if ((declaration instanceof ModelDeclaration) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    declaration.getOriginalAst(),
                    Messages.getString("ModelAttributeDriver.diagnosticInvalidAttribute"), //$NON-NLS-1$
                    getTargetName()));
            return;
View Full Code Here

            DmdlSemantics environment,
            Declaration declaration,
            AstAttribute attribute) {
        assert attribute.name.toString().equals(getTargetName());
        if ((declaration instanceof PropertyDeclaration) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    declaration.getOriginalAst(),
                    Messages.getString("PropertyAttributeDriver.diagnosticInvalidAttribute"), //$NON-NLS-1$
                    getTargetName()));
            return;
View Full Code Here

        assert attribute != null;
        Map<String, AstAttributeElement> elements = AttributeUtil.getElementMap(attribute);
        AstAttributeElement nameElement = elements.remove(ELEMENT_NAME);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
        if (nameElement == null) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    attribute.name,
                    Messages.getString("NamespaceDriver.diagnosticMissingElement"), //$NON-NLS-1$
                    TARGET_NAME,
                    ELEMENT_NAME));
            return null;
        } else if ((nameElement.value instanceof AstName) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    nameElement,
                    Messages.getString("NamespaceDriver.diagnosticInvalidNameElement"), //$NON-NLS-1$
                    TARGET_NAME,
                    ELEMENT_NAME));
View Full Code Here

        @Override
        public Void visitModelReference(ModelDeclaration model, AstModelReference node) {
            LOG.debug("processing model reference: {}", node); //$NON-NLS-1$
            ModelDeclaration decl = context.getWorld().findModelDeclaration(node.name.identifier);
            if (decl == null) {
                report(new Diagnostic(
                        Level.ERROR,
                        node.name,
                        Messages.getString("DmdlAnalyzer.diagnosticMissingModel"), //$NON-NLS-1$
                        node.name.identifier));
                return null;
            }
            for (PropertyDeclaration property : decl.getDeclaredProperties()) {
                PropertyDeclaration other = model.findPropertyDeclaration(property.getName().identifier);
                if (other != null) {
                    LOG.debug("property {} is duplicated", property.getSymbol()); //$NON-NLS-1$
                    if (property.getType().isSame(other.getType()) == false) {
                        report(new Diagnostic(
                                Level.ERROR,
                                node,
                                Messages.getString("DmdlAnalyzer.diagnosticInconsistentTypeProperty"), //$NON-NLS-1$
                                property.getName(),
                                model.getName()));
View Full Code Here

        public Void visitRecordDefinition(ModelDeclaration model, AstRecordDefinition node) {
            LOG.debug("processing record definition: {}", node); //$NON-NLS-1$
            Set<String> sawPropertyName = Sets.create();
            for (AstPropertyDefinition property : node.properties) {
                if (sawPropertyName.contains(property.name.identifier)) {
                    report(new Diagnostic(
                            Level.ERROR,
                            property.name,
                            Messages.getString("DmdlAnalyzer.diagnosticDuplicatedProperty"), //$NON-NLS-1$
                            property.name.identifier));
                }
                sawPropertyName.add(property.name.identifier);
                Type type = context.resolveType(property.type);
                if (type == null) {
                    report(new Diagnostic(
                            Level.ERROR,
                            property.type,
                            Messages.getString("DmdlAnalyzer.diagnosticUnknownTypeProperty"), //$NON-NLS-1$
                            property.type.toString()));
                    continue;
                }

                PropertyDeclaration other = model.findPropertyDeclaration(property.name.identifier);
                if (other != null) {
                    LOG.debug("property {} is duplicated", property.name); //$NON-NLS-1$
                    if (type.equals(other.getType()) == false) {
                        report(new Diagnostic(
                                Level.ERROR,
                                property.name,
                                Messages.getString(
                                        "DmdlAnalyzer.diagnosticInconsistentTypeRepordProperty"), //$NON-NLS-1$
                                property.name,
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.