Search in sources :

Example 16 with IIdentifierReparser

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

the class Def_Testcase method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        lastTimeChecked = null;
        boolean enveloped = false;
        int result = 1;
        final Location temporalIdentifier = identifier.getLocation();
        if (reparser.envelopsDamage(temporalIdentifier) || reparser.isExtending(temporalIdentifier)) {
            reparser.extendDamagedRegion(temporalIdentifier);
            final IIdentifierReparser r = new IdentifierReparser(reparser);
            result = r.parseAndSetNameChanged();
            identifier = r.getIdentifier();
            // damage handled
            if (result == 0 && identifier != null) {
                enveloped = true;
            } else {
                removeBridge();
                throw new ReParseException(result);
            }
        }
        if (formalParList != null) {
            if (enveloped) {
                formalParList.updateSyntax(reparser, false);
                reparser.updateLocation(formalParList.getLocation());
            } else if (reparser.envelopsDamage(formalParList.getLocation())) {
                try {
                    formalParList.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(formalParList.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (runsOnReference != null) {
            if (enveloped) {
                runsOnReference.updateSyntax(reparser, false);
                reparser.updateLocation(runsOnReference.getLocation());
            } else if (reparser.envelopsDamage(runsOnReference.getLocation())) {
                try {
                    runsOnReference.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(runsOnReference.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (systemReference != null) {
            if (enveloped) {
                systemReference.updateSyntax(reparser, false);
                reparser.updateLocation(systemReference.getLocation());
            } else if (reparser.envelopsDamage(systemReference.getLocation())) {
                try {
                    systemReference.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(systemReference.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (block != null) {
            if (enveloped) {
                block.updateSyntax(reparser, false);
                reparser.updateLocation(block.getLocation());
            } else if (reparser.envelopsDamage(block.getLocation())) {
                try {
                    block.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(block.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (withAttributesPath != null) {
            if (enveloped) {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            } else if (reparser.envelopsDamage(withAttributesPath.getLocation())) {
                try {
                    withAttributesPath.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(withAttributesPath.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (!enveloped) {
            removeBridge();
            throw new ReParseException();
        }
        return;
    }
    reparser.updateLocation(identifier.getLocation());
    if (formalParList != null) {
        formalParList.updateSyntax(reparser, false);
        reparser.updateLocation(formalParList.getLocation());
    }
    if (runsOnReference != null) {
        runsOnReference.updateSyntax(reparser, false);
        reparser.updateLocation(runsOnReference.getLocation());
    }
    if (systemReference != null) {
        systemReference.updateSyntax(reparser, false);
        reparser.updateLocation(systemReference.getLocation());
    }
    if (block != null) {
        block.updateSyntax(reparser, false);
        reparser.updateLocation(block.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 17 with IIdentifierReparser

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

the class Def_Timer method updateSyntax.

@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        lastTimeChecked = null;
        int result = 1;
        final Location tempIdentifier = identifier.getLocation();
        if (reparser.envelopsDamage(tempIdentifier) || reparser.isExtending(tempIdentifier)) {
            reparser.extendDamagedRegion(tempIdentifier);
            final IIdentifierReparser r = new IdentifierReparser(reparser);
            result = r.parseAndSetNameChanged();
            identifier = r.getIdentifier();
            if (result != 0) {
                throw new ReParseException(result);
            }
            if (dimensions != null) {
                dimensions.updateSyntax(reparser, false);
            }
            if (defaultDuration != null) {
                defaultDuration.updateSyntax(reparser, false);
                reparser.updateLocation(defaultDuration.getLocation());
            }
            if (withAttributesPath != null) {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            }
            return;
        }
        throw new ReParseException();
    }
    reparser.updateLocation(identifier.getLocation());
    if (dimensions != null) {
        dimensions.updateSyntax(reparser, false);
    }
    if (defaultDuration != null) {
        defaultDuration.updateSyntax(reparser, false);
        reparser.updateLocation(defaultDuration.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 18 with IIdentifierReparser

use of org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser 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)

Aggregations

Location (org.eclipse.titan.designer.AST.Location)18 IIdentifierReparser (org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser)18 IdentifierReparser (org.eclipse.titan.designer.parsers.ttcn3parser.IdentifierReparser)18 ReParseException (org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)18 NULL_Location (org.eclipse.titan.designer.AST.NULL_Location)1