Search in sources :

Example 46 with ReParseException

use of org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException in project titan.EclipsePlug-ins by eclipse.

the class Call_Statement method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        throw new ReParseException();
    }
    if (portReference != null) {
        portReference.updateSyntax(reparser, false);
        reparser.updateLocation(portReference.getLocation());
    }
    if (parameter != null) {
        parameter.updateSyntax(reparser, false);
        reparser.updateLocation(parameter.getLocation());
    }
    if (timerValue != null) {
        timerValue.updateSyntax(reparser, false);
        reparser.updateLocation(timerValue.getLocation());
    }
    if (toClause instanceof IIncrementallyUpdateable) {
        ((IIncrementallyUpdateable) toClause).updateSyntax(reparser, false);
        reparser.updateLocation(toClause.getLocation());
    } else if (toClause != null) {
        throw new ReParseException();
    }
    if (altGuards != null) {
        altGuards.updateSyntax(reparser, false);
        reparser.updateLocation(altGuards.getLocation());
    }
}
Also used : IIncrementallyUpdateable(org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable) ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)

Example 47 with ReParseException

use of org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException in project titan.EclipsePlug-ins by eclipse.

the class AltGuards method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        boolean enveloped = false;
        int nofDamaged = 0;
        int leftBoundary = location.getOffset();
        int rightBoundary = location.getEndOffset();
        final int damageOffset = reparser.getDamageStart();
        for (int i = 0, size = altGuards.size(); i < size && !enveloped; i++) {
            final AltGuard altGuard = altGuards.get(i);
            final Location temporalLocation = altGuard.getLocation();
            if (reparser.envelopsDamage(temporalLocation)) {
                enveloped = true;
                leftBoundary = temporalLocation.getOffset();
                rightBoundary = temporalLocation.getEndOffset();
            } else if (reparser.isDamaged(temporalLocation)) {
                nofDamaged++;
            } else {
                if (temporalLocation.getEndOffset() < damageOffset && temporalLocation.getEndOffset() > leftBoundary) {
                    leftBoundary = temporalLocation.getEndOffset();
                }
                if (temporalLocation.getOffset() >= damageOffset && temporalLocation.getOffset() < rightBoundary) {
                    rightBoundary = temporalLocation.getOffset();
                }
            }
        }
        if (nofDamaged != 0) {
            throw new ReParseException();
        }
        for (Iterator<AltGuard> iterator = altGuards.iterator(); iterator.hasNext(); ) {
            final AltGuard altGuard = iterator.next();
            final Location temporalLocation = altGuard.getLocation();
            if (reparser.isAffectedAppended(temporalLocation)) {
                altGuard.updateSyntax(reparser, enveloped && reparser.envelopsDamage(temporalLocation));
                reparser.updateLocation(altGuard.getLocation());
            }
        }
        return;
    }
    for (int i = 0, size = altGuards.size(); i < size; i++) {
        final AltGuard guard = altGuards.get(i);
        guard.updateSyntax(reparser, false);
        reparser.updateLocation(guard.getLocation());
    }
}
Also used : ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException) NULL_Location(org.eclipse.titan.designer.AST.NULL_Location) Location(org.eclipse.titan.designer.AST.Location)

Example 48 with ReParseException

use of org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException in project titan.EclipsePlug-ins by eclipse.

the class ControlPart method updateSyntax.

/**
 * Handles the incremental parsing of this control part.
 *
 * @param reparser
 *                the parser doing the incremental parsing.
 * @throws ReParseException
 *                 if there was an error while refreshing the location
 *                 information and it could not be solved internally.
 */
public void updateSyntax(final TTCN3ReparseUpdater reparser) throws ReParseException {
    if (reparser.isDamaged(getLocation())) {
        lastTimeChecked = null;
        boolean enveloped = false;
        if (reparser.envelopsDamage(statementblock.getLocation())) {
            statementblock.updateSyntax(reparser, true);
            enveloped = true;
            reparser.updateLocation(statementblock.getLocation());
        } else if (reparser.isDamaged(statementblock.getLocation())) {
            throw new ReParseException();
        } else {
            statementblock.updateSyntax(reparser, false);
            reparser.updateLocation(statementblock.getLocation());
        }
        if (withAttributesPath != null) {
            if (enveloped) {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            } else if (reparser.envelopsDamage(withAttributesPath.getLocation())) {
                reparser.extendDamagedRegion(withAttributesPath.getLocation());
                final int result = reparse(reparser);
                if (result == 0) {
                    enveloped = true;
                } else {
                    throw new ReParseException();
                }
            } else if (reparser.isDamaged(withAttributesPath.getLocation())) {
                throw new ReParseException();
            } else {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            }
        }
        if (!enveloped) {
            throw new ReParseException();
        }
        return;
    }
    statementblock.updateSyntax(reparser, false);
    reparser.updateLocation(statementblock.getLocation());
    if (withAttributesPath != null) {
        withAttributesPath.updateSyntax(reparser, false);
        reparser.updateLocation(withAttributesPath.getLocation());
    }
}
Also used : ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)

Example 49 with ReParseException

use of org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException in project titan.EclipsePlug-ins by eclipse.

the class Def_Const method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        lastTimeChecked = null;
        boolean enveloped = false;
        final Location temporalIdentifier = identifier.getLocation();
        if (reparser.envelopsDamage(temporalIdentifier) || reparser.isExtending(temporalIdentifier)) {
            reparser.extendDamagedRegion(temporalIdentifier);
            final IIdentifierReparser r = new IdentifierReparser(reparser);
            final int result = r.parseAndSetNameChanged();
            identifier = r.getIdentifier();
            // damage handled
            if (result == 0 && identifier != null) {
                enveloped = true;
            } else {
                throw new ReParseException(result);
            }
        }
        if (type != null) {
            if (enveloped) {
                type.updateSyntax(reparser, false);
                reparser.updateLocation(type.getLocation());
            } else if (reparser.envelopsDamage(type.getLocation())) {
                type.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(type.getLocation());
            }
        }
        if (value != null) {
            if (enveloped) {
                value.updateSyntax(reparser, false);
                reparser.updateLocation(value.getLocation());
            } else if (reparser.envelopsDamage(value.getLocation())) {
                reparser.extendDamagedRegion(value.getLocation().getOffset(), value.getLocation().getEndOffset());
                final int result = reparse(reparser);
                if (result == 0) {
                    enveloped = true;
                    value.setFullNameParent(this);
                    value.setMyScope(getMyScope());
                } else {
                    throw new ReParseException();
                }
            }
        }
        if (withAttributesPath != null) {
            if (enveloped) {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            } else if (reparser.envelopsDamage(withAttributesPath.getLocation())) {
                withAttributesPath.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(withAttributesPath.getLocation());
            }
        }
        if (!enveloped) {
            throw new ReParseException();
        }
        return;
    }
    reparser.updateLocation(identifier.getLocation());
    if (type != null) {
        type.updateSyntax(reparser, false);
        reparser.updateLocation(type.getLocation());
    }
    if (value != null) {
        value.updateSyntax(reparser, false);
        reparser.updateLocation(value.getLocation());
    }
    if (withAttributesPath != null) {
        withAttributesPath.updateSyntax(reparser, false);
        reparser.updateLocation(withAttributesPath.getLocation());
    }
}
Also used : IIdentifierReparser(org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser) IdentifierReparser(org.eclipse.titan.designer.parsers.ttcn3parser.IdentifierReparser) IIdentifierReparser(org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser) ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException) Location(org.eclipse.titan.designer.AST.Location)

Example 50 with ReParseException

use of org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException in project titan.EclipsePlug-ins by eclipse.

the class SignatureExceptions method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        throw new ReParseException();
    }
    Type exception;
    for (int i = 0, size = exceptionTypes.size(); i < size; i++) {
        exception = exceptionTypes.get(i);
        exception.updateSyntax(reparser, isDamaged);
        reparser.updateLocation(exception.getLocation());
    }
}
Also used : Type(org.eclipse.titan.designer.AST.Type) IType(org.eclipse.titan.designer.AST.IType) ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)

Aggregations

ReParseException (org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)52 Location (org.eclipse.titan.designer.AST.Location)24 IIncrementallyUpdateable (org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable)21 IIdentifierReparser (org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser)18 IdentifierReparser (org.eclipse.titan.designer.parsers.ttcn3parser.IdentifierReparser)18 NULL_Location (org.eclipse.titan.designer.AST.NULL_Location)6 IAppendableSyntax (org.eclipse.titan.designer.AST.TTCN3.IAppendableSyntax)5 IType (org.eclipse.titan.designer.AST.IType)2 FileNotFoundException (java.io.FileNotFoundException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IValue (org.eclipse.titan.designer.AST.IValue)1 Identifier (org.eclipse.titan.designer.AST.Identifier)1 Module (org.eclipse.titan.designer.AST.Module)1 Reference (org.eclipse.titan.designer.AST.Reference)1 Definition (org.eclipse.titan.designer.AST.TTCN3.definitions.Definition)1 TTCN3Module (org.eclipse.titan.designer.AST.TTCN3.definitions.TTCN3Module)1 ObjectIdentifierComponent (org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifierComponent)1 Type (org.eclipse.titan.designer.AST.Type)1 ITtcn3FileReparser (org.eclipse.titan.designer.parsers.ttcn3parser.ITtcn3FileReparser)1 Ttcn3FileReparser (org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3FileReparser)1