Search in sources :

Example 1 with SyntacticErrorStorage

use of org.eclipse.titan.common.parsers.SyntacticErrorStorage 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 SyntacticErrorStorage

use of org.eclipse.titan.common.parsers.SyntacticErrorStorage 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 SyntacticErrorStorage

use of org.eclipse.titan.common.parsers.SyntacticErrorStorage 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 SyntacticErrorStorage

use of org.eclipse.titan.common.parsers.SyntacticErrorStorage 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 SyntacticErrorStorage

use of org.eclipse.titan.common.parsers.SyntacticErrorStorage 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

SyntacticErrorStorage (org.eclipse.titan.common.parsers.SyntacticErrorStorage)26 Asn1Parser (org.eclipse.titan.designer.parsers.asn1parser.Asn1Parser)24 StringReader (java.io.StringReader)2 CharStream (org.antlr.v4.runtime.CharStream)2 UnbufferedCharStream (org.antlr.v4.runtime.UnbufferedCharStream)2 IFile (org.eclipse.core.resources.IFile)2 TITANMarker (org.eclipse.titan.common.parsers.TITANMarker)2 Location (org.eclipse.titan.designer.AST.Location)2 Reader (java.io.Reader)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CommonTokenFactory (org.antlr.v4.runtime.CommonTokenFactory)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 Token (org.antlr.v4.runtime.Token)1 IPath (org.eclipse.core.runtime.IPath)1 IDocument (org.eclipse.jface.text.IDocument)1 Position (org.eclipse.jface.text.Position)1 TitanListener (org.eclipse.titan.common.parsers.TitanListener)1 CfgAnalyzer (org.eclipse.titan.common.parsers.cfg.CfgAnalyzer)1 CfgLocation (org.eclipse.titan.common.parsers.cfg.CfgLocation)1