Search in sources :

Example 1 with Asn1Parser

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

the class ASN1_Set_Type method parseBlockSet.

/**
 * Parses the block as if it were the block of a set.
 */
public void parseBlockSet() {
    if (null == mBlock) {
        return;
    }
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
    if (null == parser) {
        return;
    }
    components = parser.pr_special_ComponentTypeLists().list;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        isErroneous = true;
        components = null;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
    }
    if (components == null) {
        isErroneous = true;
        return;
    }
    components.setFullNameParent(this);
    components.setMyScope(getMyScope());
    components.setMyType(this);
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Example 2 with Asn1Parser

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

the class ASN1_BitString_Type method parseBlockBitstring.

private void parseBlockBitstring() {
    if (null == mBlock) {
        return;
    }
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
    if (null == parser) {
        return;
    }
    namedValues = parser.pr_special_NamedBitList().namedValues;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        isErroneous = true;
        namedValues = null;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
    }
    if (namedValues != null) {
        namedValues.setFullNameParent(this);
        namedValues.setMyScope(getMyScope());
    }
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Example 3 with Asn1Parser

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

the class ASN1_Choice_Type method parseBlockChoice.

/**
 * Parses the block as if it were the block of a choice.
 */
public void parseBlockChoice() {
    if (null == mBlock) {
        return;
    }
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
    if (null == parser) {
        return;
    }
    components = parser.pr_special_AlternativeTypeLists().list;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        isErroneous = true;
        components = null;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) mBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
    }
    if (components == null) {
        isErroneous = true;
        return;
    }
    components.setFullNameParent(this);
    components.setMyScope(getMyScope());
    components.setMyType(this);
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Example 4 with Asn1Parser

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

the class ObjectClass_Definition method parseBlockFieldSpecs.

private void parseBlockFieldSpecs() {
    if (null == fieldSpecsBlock) {
        return;
    }
    final Asn1Parser parser = BlockLevelTokenStreamTracker.getASN1ParserForBlock(fieldSpecsBlock);
    if (null == parser) {
        return;
    }
    fieldSpecifications = parser.pr_special_FieldSpecList().fieldSpecifications;
    final List<SyntacticErrorStorage> errors = parser.getErrorStorage();
    if (null != errors && !errors.isEmpty()) {
        fieldSpecifications = null;
        for (int i = 0; i < errors.size(); i++) {
            ParserMarkerSupport.createOnTheFlyMixedMarker((IFile) fieldSpecsBlock.getLocation().getFile(), errors.get(i), IMarker.SEVERITY_ERROR);
        }
    }
    if (null == fieldSpecifications) {
        isErroneous = true;
        return;
    }
    fieldSpecifications.setFullNameParent(this);
    fieldSpecifications.setMyObjectClass(this);
}
Also used : Asn1Parser(org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser) SyntacticErrorStorage(org.eclipse.titan.common.parsers.SyntacticErrorStorage)

Example 5 with Asn1Parser

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

the class ObjectClassSyntax_Builder method visitSequence.

public void visitSequence(final ObjectClassSyntax_sequence parameter) {
    if (parameter.getIsBuilded()) {
        return;
    }
    final Asn1Parser parser = SyntaxLevelTokenStreamTracker.getASN1ParserForBlock(mBlock);
    if (null == parser) {
        return;
    }
    final List<ObjectClassSyntax_Node> nodes = parser.pr_special_ObjectClassSyntax_Builder(fieldSpecifications).nodes;
    if (null != nodes) {
        for (final ObjectClassSyntax_Node node : nodes) {
            parameter.addNode(node);
        }
    }
    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);
        }
    } else if (parameter.getIsOptional() && 0 == parameter.getNofNodes()) {
        parameter.getLocation().reportSemanticError("Empty optional group is not allowed");
    }
    parameter.setIsBuilded(true);
    parameter.trimToSize();
}
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