Package net.percederberg.grammatica.parser

Examples of net.percederberg.grammatica.parser.ParseException


        if (child.getId() == Asn1Constants.IDENTIFIER_STRING) {
            name = getStringValue(child, 0);
            child = getChildAt(node, 1);
        }
        if (child.getId() != Asn1Constants.TYPE) {
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "referencing components is currently unsupported",
                child.getStartLine(),
                child.getStartColumn());
        }
View Full Code Here


        Boolean    strictLower = null;
        Boolean    strictUpper = null;
        Object     obj;

        if (list.size() == 0) {
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "no value specified in constraint",
                node.getStartLine(),
                node.getStartColumn());
        } else if (list.size() == 1) {
View Full Code Here

        MibValueSymbol  symbol;

        // Check value name
        name = getStringValue(getChildAt(node, 0), 0);
        if (currentMib.getSymbol(name) != null) {
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "a symbol '" + name + "' already present in the MIB",
                node.getStartLine(),
                node.getStartColumn());
        }
View Full Code Here

        child = getChildAt(node, 0);
        if (child.getId() == Asn1Constants.MODULE_REFERENCE) {
            name = getStringValue(child, 0);
            local = currentMib.getImport(name);
            if (local == null) {
                throw new ParseException(
                    ParseException.ANALYSIS_ERROR,
                    "referenced module not imported '" + name + "'",
                    child.getStartLine(),
                    child.getStartColumn());
            }
View Full Code Here

        NamedNumber   number;
        int           value;

        // Check for minimum number of components
        if (components.size() < 1) {
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "object identifier must contain at least one component",
                node.getStartLine(),
                node.getStartColumn());
        }

        // Analyze components
        for (int i = 0; i < components.size(); i++) {
            number = (NamedNumber) components.get(i);
            if (number.hasNumber()) {
                value = number.getNumber().intValue();
                if (parent == null && value == 0) {
                    parent = new ValueReference(getLocation(node),
                                                getContext(),
                                                DefaultContext.CCITT);
                } else if (parent == null && value == 1) {
                    parent = new ValueReference(getLocation(node),
                                                getContext(),
                                                DefaultContext.ISO);
                } else if (parent == null && value == 2) {
                    parent = new ValueReference(getLocation(node),
                                                getContext(),
                                                DefaultContext.JOINT_ISO_CCITT);
                } else if (parent instanceof ObjectIdentifierValue) {
                    try {
                        parent = new ObjectIdentifierValue(
                                        getLocation(node),
                                        (ObjectIdentifierValue) parent,
                                        number.getName(),
                                        value);
                    } catch (MibException e) {
                        log.addError(e.getLocation(), e.getMessage());
                        parent = null;
                    }
                } else {
                    parent = new ObjectIdentifierValue(
                                        getLocation(node),
                                        (ValueReference) parent,
                                        number.getName(),
                                        value);
                }
            } else if (parent != null) {
                throw new ParseException(
                    ParseException.ANALYSIS_ERROR,
                    "object identifier component '" + number.getName() +
                    "' has been previously defined, remove any " +
                    "components to the left",
                    node.getStartLine(),
View Full Code Here

            node.addValue(SnmpStatus.DEPRECATED);
        } else if (name.equals("obsolete")) {
            node.addValue(SnmpStatus.OBSOLETE);
        } else {
            node.addValue(SnmpStatus.CURRENT);
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "unrecognized status value: '" + name + "'",
                child.getStartLine(),
                child.getStartColumn());
        }
View Full Code Here

            node.addValue(SnmpAccess.NOT_ACCESSIBLE);
        } else if (name.equals("accessible-for-notify")) {
            node.addValue(SnmpAccess.ACCESSIBLE_FOR_NOTIFY);
        } else {
            node.addValue(SnmpAccess.READ_WRITE);
            throw new ParseException(
                ParseException.ANALYSIS_ERROR,
                "unrecognized access value: '" + name + "'",
                child.getStartLine(),
                child.getStartColumn());
        }
View Full Code Here

TOP

Related Classes of net.percederberg.grammatica.parser.ParseException

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.