Search in sources :

Example 1 with ReParseException

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

the class NamedValue method updateSyntax.

/**
 * Handles the incremental parsing of this named value.
 *
 * @param reparser the parser doing the incremental parsing.
 * @param isDamaged true if the location contains the damaged area,
 *         false if only its' location needs to be updated.
 */
@Override
public /**
 * {@inheritDoc}
 */
void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
    if (isDamaged) {
        throw new ReParseException();
    }
    reparser.updateLocation(name.getLocation());
    if (value instanceof IIncrementallyUpdateable) {
        ((IIncrementallyUpdateable) value).updateSyntax(reparser, false);
        reparser.updateLocation(value.getLocation());
    } else if (value != null) {
        throw new ReParseException();
    }
}
Also used : IIncrementallyUpdateable(org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable) ReParseException(org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException)

Example 2 with ReParseException

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

the class ComponentRunnningExpression method updateSyntax.

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

Example 3 with ReParseException

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

the class Def_Extfunction 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 (formalParList != null) {
            if (enveloped) {
                formalParList.updateSyntax(reparser, false);
                reparser.updateLocation(formalParList.getLocation());
            } else if (reparser.envelopsDamage(formalParList.getLocation())) {
                formalParList.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(formalParList.getLocation());
            }
        }
        if (returnType != null) {
            if (enveloped) {
                returnType.updateSyntax(reparser, false);
                reparser.updateLocation(returnType.getLocation());
            } else if (reparser.envelopsDamage(returnType.getLocation())) {
                returnType.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(returnType.getLocation());
            }
        }
        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 (formalParList != null) {
        formalParList.updateSyntax(reparser, false);
        reparser.updateLocation(formalParList.getLocation());
    }
    if (returnType != null) {
        returnType.updateSyntax(reparser, false);
        reparser.updateLocation(returnType.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 4 with ReParseException

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

the class Def_Function 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 {
                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 (runsOnRef != null) {
            if (enveloped) {
                runsOnRef.updateSyntax(reparser, false);
                reparser.updateLocation(runsOnRef.getLocation());
            } else if (reparser.envelopsDamage(runsOnRef.getLocation())) {
                try {
                    runsOnRef.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(runsOnRef.getLocation());
                } catch (ReParseException e) {
                    removeBridge();
                    throw e;
                }
            }
        }
        if (returnType != null) {
            if (enveloped) {
                returnType.updateSyntax(reparser, false);
                reparser.updateLocation(returnType.getLocation());
            } else if (reparser.envelopsDamage(returnType.getLocation())) {
                try {
                    returnType.updateSyntax(reparser, true);
                    enveloped = true;
                    reparser.updateLocation(returnType.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 (runsOnRef != null) {
        runsOnRef.updateSyntax(reparser, false);
        reparser.updateLocation(runsOnRef.getLocation());
    }
    if (returnType != null) {
        returnType.updateSyntax(reparser, false);
        reparser.updateLocation(returnType.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 5 with ReParseException

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

the class Def_ModulePar 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 (defaultValue != null) {
            if (enveloped) {
                defaultValue.updateSyntax(reparser, false);
                reparser.updateLocation(defaultValue.getLocation());
            } else if (reparser.envelopsDamage(defaultValue.getLocation())) {
                defaultValue.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(defaultValue.getLocation());
            }
        }
        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 (defaultValue != null) {
        defaultValue.updateSyntax(reparser, false);
        reparser.updateLocation(defaultValue.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

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