Search in sources :

Example 21 with Asn1Parser

use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.

the class Ass_pard method check.

/**
 * Pre-process the block of formal parameters into a list. This list
 * together with actual parameters can be used to identify the
 * assignments correctly.
 *
 * @param timestamp
 *                the timestamp of the actual semantic check cycle.
 */
public void check(final CompilationTimeStamp timestamp) {
    if (null != lastTimeChecked && (!isErroneous || !lastTimeChecked.isLess(timestamp))) {
        return;
    }
    lastTimeChecked = timestamp;
    isErroneous = false;
    if (null == mParameterList) {
        isErroneous = true;
        return;
    }
    if (null != mParameters) {
        return;
    }
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mParameterList);
    mParameters = parser.pr_special_FormalParameterList().parameters;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        mParameters = null;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mParameterList.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
    }
    if (null == mParameters) {
        isErroneous = true;
    } else {
        mParameters.trimToSize();
    }
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Example 22 with Asn1Parser

use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.

the class ObjectClassSyntax_Parser method parseObject.

private ASN1Object parseObject() {
    ASN1Object object = null;
    if (mBlock != null) {
        final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock, internalIndex);
        if (parser != null) {
            object = parser.pr_special_Object().object;
            internalIndex += parser.nof_consumed_tokens();
            final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
            if (null != errors && !errors.isEmpty()) {
                for (int i = 0; i < errors.size(); i++) {
                    ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
                }
            }
        }
    }
    return object;
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage) ASN1Object(org.eclipse.titan.designer.AST.ASN1.ASN1Object)

Example 23 with Asn1Parser

use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.

the class ObjectClassSyntax_Parser method parseObjectSet.

private ObjectSet parseObjectSet() {
    ObjectSet objectSet = null;
    if (mBlock != null) {
        final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock, internalIndex);
        if (parser != null) {
            objectSet = parser.pr_special_ObjectSet().objectSet;
            internalIndex += parser.nof_consumed_tokens();
            final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
            if (null != errors && !errors.isEmpty()) {
                for (int i = 0; i < errors.size(); i++) {
                    ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
                }
            }
        }
    }
    return objectSet;
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage) ObjectSet(org.eclipse.titan.designer.AST.ASN1.ObjectSet)

Example 24 with Asn1Parser

use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.

the class ObjectClassSyntax_Parser method parseType.

private ASN1Type parseType() {
    ASN1Type type = null;
    if (mBlock != null) {
        final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock, internalIndex);
        if (parser != null) {
            type = parser.pr_special_Type().type;
            internalIndex += parser.nof_consumed_tokens();
            final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
            if (null != errors && !errors.isEmpty()) {
                for (int i = 0; i < errors.size(); i++) {
                    ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
                }
            }
        }
    }
    return type;
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage) ASN1Type(org.eclipse.titan.designer.AST.ASN1.ASN1Type)

Example 25 with Asn1Parser

use of org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser in project titan.EclipsePlug-ins by eclipse.

the class ObjectClassSyntax_Parser method parseValue.

private boolean parseValue() {
    if (mBlock != null) {
        final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock, internalIndex);
        if (parser != null) {
            parser.pr_special_Value();
            internalIndex += parser.nof_consumed_tokens();
            final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
            if (null != errors && !errors.isEmpty()) {
                for (int i = 0; i < errors.size(); i++) {
                    ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
                }
            }
            return true;
        }
        return false;
    }
    return false;
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Aggregations

Asn1Parser (org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser)25 SyntacticErrorStorage (org.eclipse.titan.common.parsers.SyntacticErrorStorage)24 StringReader (java.io.StringReader)2 CharStream (org.antlr.v4.runtime.CharStream)2 UnbufferedCharStream (org.antlr.v4.runtime.UnbufferedCharStream)2 ASN1Listener (org.eclipse.titan.designer.parsers.asn1parser.ASN1Listener)2 Asn1Lexer (org.eclipse.titan.designer.parsers.asn1parser.Asn1Lexer)2 ModuleLevelTokenStreamTracker (org.eclipse.titan.designer.parsers.asn1parser.ModuleLevelTokenStreamTracker)2 TokenWithIndexAndSubTokensFactory (org.eclipse.titan.designer.parsers.asn1parser.TokenWithIndexAndSubTokensFactory)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Token (org.antlr.v4.runtime.Token)1 ASN1Assignment (org.eclipse.titan.designer.AST.ASN1.ASN1Assignment)1 ASN1Object (org.eclipse.titan.designer.AST.ASN1.ASN1Object)1 ASN1Type (org.eclipse.titan.designer.AST.ASN1.ASN1Type)1 ObjectSet_definition (org.eclipse.titan.designer.AST.ASN1.Object.ObjectSet_definition)1 ObjectSet (org.eclipse.titan.designer.AST.ASN1.ObjectSet)1 AtNotations (org.eclipse.titan.designer.AST.AtNotations)1 Constraint (org.eclipse.titan.designer.AST.Constraint)1 Identifier (org.eclipse.titan.designer.AST.Identifier)1