Search in sources :

Example 6 with IIdentifierReparser

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

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

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

the class Def_Var 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 {
                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 (initialValue != null) {
            if (enveloped) {
                initialValue.updateSyntax(reparser, false);
                reparser.updateLocation(initialValue.getLocation());
            } else if (reparser.envelopsDamage(initialValue.getLocation())) {
                initialValue.updateSyntax(reparser, true);
                enveloped = true;
                reparser.updateLocation(initialValue.getLocation());
            }
        }
        if (!enveloped) {
            throw new ReParseException();
        }
        return;
    }
    reparser.updateLocation(identifier.getLocation());
    if (type != null) {
        type.updateSyntax(reparser, false);
        reparser.updateLocation(type.getLocation());
    }
    if (initialValue != null) {
        initialValue.updateSyntax(reparser, false);
        reparser.updateLocation(initialValue.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 8 with IIdentifierReparser

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

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

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

the class FriendModule method updateSyntax.

/**
 * Handles the incremental parsing of this friend module declaration.
 *
 * @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) {
        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.parse();
            identifier = r.getIdentifier();
            // damage handled
            if (result == 0) {
                enveloped = true;
            } else {
                throw new ReParseException(result);
            }
        }
        if (withAttributesPath != null) {
            if (enveloped) {
                withAttributesPath.updateSyntax(reparser, false);
                reparser.updateLocation(withAttributesPath.getLocation());
            } else if (reparser.envelopsDamage(withAttributesPath.getLocation())) {
                reparser.extendDamagedRegion(withAttributesPath.getLocation());
                result = reparse(reparser);
            }
        }
        if (result != 0) {
            throw new ReParseException();
        }
        return;
    }
    reparser.updateLocation(identifier.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 10 with IIdentifierReparser

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

the class ImportModule method updateSyntax.

/**
 * Handles the incremental parsing of this module importation.
 *
 * @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) {
        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.parse();
            identifier = r.getIdentifier();
            // damage handled
            if (result == 0) {
                enveloped = true;
            } else {
                throw new ReParseException(result);
            }
        }
        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) {
                    throw new ReParseException();
                }
                enveloped = true;
            }
        }
        if (!enveloped) {
            throw new ReParseException(1);
        }
        return;
    }
    reparser.updateLocation(identifier.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