Package net.percederberg.grammatica.parser

Examples of net.percederberg.grammatica.parser.Node


        MibContext     local = getContext();
        String         name = null;
        Object         value = null;
        FileLocation   loc = getLocation(node);
        Node           child;

        for (int i = 0; i < node.getChildCount(); i++) {
            child = node.getChildAt(i);
            switch (child.getId()) {
            case 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());
                }
                break;
            case Asn1Constants.IDENTIFIER_STRING:
                name = getStringValue(child, 0);
                break;
View Full Code Here


    protected Node exitSequenceOfType(Production node)
        throws ParseException {

        MibType     type;
        Constraint  c = null;
        Node        child;

        child = getChildAt(node, node.getChildCount() - 1);
        type = (MibType) getValue(child, 0);
        if (node.getChildCount() == 4) {
            child = getChildAt(node, 1);
View Full Code Here

        throws ParseException {

        MibType     type;
        MibTypeTag  tag;
        boolean     implicit = implicitTags;
        Node        child;

        child = getChildAt(node, 0);
        tag = (MibTypeTag) getValue(child, 0);
        child = getChildAt(node, 1);
        if (child.getId() == Asn1Constants.EXPLICIT_OR_IMPLICIT_TAG) {
            implicit = ((Boolean) getValue(child, 0)).booleanValue();
        }
        child = getChildAt(node, node.getChildCount() - 1);
        type = (MibType) getValue(child, 0);
        type.setTag(implicit, tag);
View Full Code Here

     * @return the node to add to the parse tree
     *
     * @throws ParseException if the node analysis discovered errors
     */
    protected Node exitClass(Production node) throws ParseException {
        Node  child = getChildAt(node, 0);
        int   category;

        if (child.getId() == Asn1Constants.UNIVERSAL) {
            category = MibTypeTag.UNIVERSAL_CATEGORY;
        } else if (child.getId() == Asn1Constants.APPLICATION) {
            category = MibTypeTag.APPLICATION_CATEGORY;
        } else if (child.getId() == Asn1Constants.PRIVATE) {
            category = MibTypeTag.PRIVATE_CATEGORY;
        } else {
            category = MibTypeTag.CONTEXT_SPECIFIC_CATEGORY;
        }
        node.addValue(new Integer(category));
View Full Code Here

     * @throws ParseException if the node analysis discovered errors
     */
    protected Node exitExplicitOrImplicitTag(Production node)
        throws ParseException {

        Node  child = getChildAt(node, 0);

        if (child.getId() == Asn1Constants.EXPLICIT) {
            node.addValue(Boolean.FALSE);
        } else {
            node.addValue(Boolean.TRUE);
        }
        return node;
View Full Code Here

    protected Node exitElementType(Production node)
        throws ParseException {

        String   name = null;
        MibType  type;
        Node     child;

        child = getChildAt(node, 0);
        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());
        }
        type = new ElementType(name, (MibType) getValue(child, 0));
        type.setComment(MibAnalyzerUtil.getComments(node));
        node.addValue(type);
        return node;
View Full Code Here

     *
     * @return the node to add to the parse tree
     */
    protected Node exitNamedNumberList(Production node) {
        MibValueSymbol  symbol;
        Node            child;

        for (int i = 0; i < node.getChildCount(); i++) {
            child = node.getChildAt(i);
            if (child.getId() == Asn1Constants.NAMED_NUMBER) {
                symbol = (MibValueSymbol) child.getValue(0);
                symbol.setComment(MibAnalyzerUtil.getComments(child));
            }
        }
        node.addValue(getChildValues(node));
        return node;
View Full Code Here

     * @throws ParseException if the node analysis discovered errors
     */
    protected Node exitValueRange(Production node)
        throws ParseException {

        Node  child;

        // Check for strict lower end point
        child = getChildAt(node, 0);
        if (child.getId() == Asn1Constants.LESS_THAN) {
            node.addValue(Boolean.TRUE);
        } else {
            node.addValue(Boolean.FALSE);
        }

        // Add upper end point (or null)
        child = getChildAt(node, node.getChildCount() - 1);
        node.addValue(child.getValue(0));

        // Check for strict upper end point
        child = getChildAt(node, node.getChildCount() - 2);
        if (child.getId() == Asn1Constants.LESS_THAN) {
            node.addValue(Boolean.TRUE);
        } else {
            node.addValue(Boolean.FALSE);
        }

View Full Code Here

        throws ParseException {

        ValueReference  ref;
        MibContext      local = getContext();
        String          name;
        Node            child;

        // Check for module reference
        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());
            }
            child = getChildAt(node, 1);
        }

        // Create value reference
View Full Code Here

     * @throws ParseException if the node analysis discovered errors
     */
    protected Node exitBooleanValue(Production node)
        throws ParseException {

        Node  child = getChildAt(node, 0);

        if (child.getId() == Asn1Constants.TRUE) {
            node.addValue(BooleanValue.TRUE);
        } else {
            node.addValue(BooleanValue.FALSE);
        }
        return node;
View Full Code Here

TOP

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

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.