Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 242153 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ocl/expressions/impl/BooleanLiteralExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/UnlimitedNaturalLiteralExpImpl.java (-3 / +1 lines)
Lines 18-30 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
import org.eclipse.emf.common.notify.Notification;
22
21
22
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
25
26
import org.eclipse.emf.ecore.impl.ENotificationImpl;
25
import org.eclipse.emf.ecore.impl.ENotificationImpl;
27
28
import org.eclipse.ocl.expressions.ExpressionsPackage;
26
import org.eclipse.ocl.expressions.ExpressionsPackage;
29
import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp;
27
import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp;
30
import org.eclipse.ocl.expressions.operations.UnlimitedNaturalLiteralExpOperations;
28
import org.eclipse.ocl.expressions.operations.UnlimitedNaturalLiteralExpOperations;
(-)src/org/eclipse/ocl/expressions/impl/OCLExpressionImpl.java (-2 lines)
Lines 23-30 Link Here
23
import org.eclipse.emf.ecore.impl.EObjectImpl;
23
import org.eclipse.emf.ecore.impl.EObjectImpl;
24
import org.eclipse.ocl.expressions.ExpressionsPackage;
24
import org.eclipse.ocl.expressions.ExpressionsPackage;
25
import org.eclipse.ocl.expressions.OCLExpression;
25
import org.eclipse.ocl.expressions.OCLExpression;
26
27
//import org.eclipse.ocl.expressions.operations.OCLExpressionOperations;
28
import org.eclipse.ocl.util.ToStringVisitor;
26
import org.eclipse.ocl.util.ToStringVisitor;
29
import org.eclipse.ocl.utilities.ASTNode;
27
import org.eclipse.ocl.utilities.ASTNode;
30
import org.eclipse.ocl.utilities.UtilitiesPackage;
28
import org.eclipse.ocl.utilities.UtilitiesPackage;
(-)src/org/eclipse/ocl/expressions/impl/IfExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/PropertyCallExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/EnumLiteralExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/CollectionLiteralExpImpl.java (-1 / +1 lines)
Lines 18-25 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
22
import java.util.Map;
21
import java.util.Map;
22
23
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.notify.Notification;
24
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.common.notify.NotificationChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/IteratorExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.ocl.expressions.ExpressionsPackage;
24
import org.eclipse.ocl.expressions.ExpressionsPackage;
(-)src/org/eclipse/ocl/expressions/impl/CollectionLiteralPartImpl.java (-2 lines)
Lines 21-28 Link Here
21
import org.eclipse.emf.ecore.impl.EObjectImpl;
21
import org.eclipse.emf.ecore.impl.EObjectImpl;
22
import org.eclipse.ocl.expressions.CollectionLiteralPart;
22
import org.eclipse.ocl.expressions.CollectionLiteralPart;
23
import org.eclipse.ocl.expressions.ExpressionsPackage;
23
import org.eclipse.ocl.expressions.ExpressionsPackage;
24
25
//import org.eclipse.ocl.expressions.operations.CollectionLiteralPartOperations;
26
import org.eclipse.ocl.utilities.Visitor;
24
import org.eclipse.ocl.utilities.Visitor;
27
25
28
/**
26
/**
(-)src/org/eclipse/ocl/expressions/impl/CollectionItemImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/MessageExpImpl.java (-1 / +1 lines)
Lines 18-25 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
22
import java.util.Map;
21
import java.util.Map;
22
23
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.notify.Notification;
24
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.common.notify.NotificationChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/VariableExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/OperationCallExpImpl.java (-1 / +1 lines)
Lines 18-25 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
22
import java.util.Map;
21
import java.util.Map;
22
23
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.notify.Notification;
24
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.common.notify.NotificationChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/IntegerLiteralExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/RealLiteralExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/CollectionRangeImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/StringLiteralExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/expressions/impl/TupleLiteralPartImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/TupleLiteralExpImpl.java (-1 / +1 lines)
Lines 18-25 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
22
import java.util.Map;
21
import java.util.Map;
22
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.EList;
25
import org.eclipse.emf.common.util.EList;
(-)src/org/eclipse/ocl/expressions/impl/ExpressionsFactoryImpl.java (-2 lines)
Lines 23-30 Link Here
23
import org.eclipse.emf.ecore.EPackage;
23
import org.eclipse.emf.ecore.EPackage;
24
import org.eclipse.emf.ecore.impl.EFactoryImpl;
24
import org.eclipse.emf.ecore.impl.EFactoryImpl;
25
import org.eclipse.emf.ecore.plugin.EcorePlugin;
25
import org.eclipse.emf.ecore.plugin.EcorePlugin;
26
27
//import org.eclipse.ocl.expressions.*;
28
import org.eclipse.ocl.expressions.AssociationClassCallExp;
26
import org.eclipse.ocl.expressions.AssociationClassCallExp;
29
import org.eclipse.ocl.expressions.BooleanLiteralExp;
27
import org.eclipse.ocl.expressions.BooleanLiteralExp;
30
import org.eclipse.ocl.expressions.CollectionItem;
28
import org.eclipse.ocl.expressions.CollectionItem;
(-)src/org/eclipse/ocl/expressions/impl/IterateExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/VariableImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/LetExpImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/expressions/impl/LoopExpImpl.java (-1 / +1 lines)
Lines 18-25 Link Here
18
package org.eclipse.ocl.expressions.impl;
18
package org.eclipse.ocl.expressions.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
22
import java.util.Map;
21
import java.util.Map;
22
23
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.notify.Notification;
24
import org.eclipse.emf.common.notify.NotificationChain;
24
import org.eclipse.emf.common.notify.NotificationChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
(-)src/org/eclipse/ocl/types/operations/InvalidTypeOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.types.operations;
17
package org.eclipse.ocl.types.operations;
18
18
19
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.common.util.EList;
20
21
import org.eclipse.ocl.types.InvalidType;
20
import org.eclipse.ocl.types.InvalidType;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/types/operations/CollectionTypeOperations.java (-2 lines)
Lines 23-32 Link Here
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.EList;
25
import org.eclipse.emf.common.util.EList;
26
27
import org.eclipse.ocl.Environment;
26
import org.eclipse.ocl.Environment;
28
import org.eclipse.ocl.types.CollectionType;
27
import org.eclipse.ocl.types.CollectionType;
29
30
import org.eclipse.ocl.types.util.TypesValidator;
28
import org.eclipse.ocl.types.util.TypesValidator;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
32
30
(-)src/org/eclipse/ocl/types/operations/VoidTypeOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.types.operations;
17
package org.eclipse.ocl.types.operations;
18
18
19
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.common.util.EList;
20
21
import org.eclipse.ocl.types.VoidType;
20
import org.eclipse.ocl.types.VoidType;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/types/operations/PrimitiveTypeOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.types.operations;
17
package org.eclipse.ocl.types.operations;
18
18
19
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.common.util.EList;
20
21
import org.eclipse.ocl.types.PrimitiveType;
20
import org.eclipse.ocl.types.PrimitiveType;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/types/operations/MessageTypeOperations.java (-2 lines)
Lines 23-31 Link Here
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.EList;
25
import org.eclipse.emf.common.util.EList;
26
27
import org.eclipse.ocl.types.MessageType;
26
import org.eclipse.ocl.types.MessageType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
28
31
/**
29
/**
(-)src/org/eclipse/ocl/types/operations/SequenceTypeOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.types.SequenceType;
26
import org.eclipse.ocl.types.SequenceType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
import org.eclipse.ocl.util.OCLUtil;
28
import org.eclipse.ocl.util.OCLUtil;
31
29
(-)src/org/eclipse/ocl/types/operations/BagTypeOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.types.BagType;
26
import org.eclipse.ocl.types.BagType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
import org.eclipse.ocl.util.OCLUtil;
28
import org.eclipse.ocl.util.OCLUtil;
31
29
(-)src/org/eclipse/ocl/types/operations/SetTypeOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.types.SetType;
26
import org.eclipse.ocl.types.SetType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
import org.eclipse.ocl.util.OCLUtil;
28
import org.eclipse.ocl.util.OCLUtil;
31
29
(-)src/org/eclipse/ocl/types/operations/TypeTypeOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.types.operations;
17
package org.eclipse.ocl.types.operations;
18
18
19
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.common.util.EList;
20
21
import org.eclipse.ocl.types.TypeType;
20
import org.eclipse.ocl.types.TypeType;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/types/operations/AnyTypeOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.types.operations;
17
package org.eclipse.ocl.types.operations;
18
18
19
import org.eclipse.emf.common.util.EList;
19
import org.eclipse.emf.common.util.EList;
20
21
import org.eclipse.ocl.types.AnyType;
20
import org.eclipse.ocl.types.AnyType;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/types/operations/TupleTypeOperations.java (-2 lines)
Lines 23-31 Link Here
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.EList;
25
import org.eclipse.emf.common.util.EList;
26
27
import org.eclipse.ocl.types.TupleType;
26
import org.eclipse.ocl.types.TupleType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
28
31
/**
29
/**
(-)src/org/eclipse/ocl/types/operations/OrderedSetTypeOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.types.OrderedSetType;
26
import org.eclipse.ocl.types.OrderedSetType;
28
29
import org.eclipse.ocl.types.util.TypesValidator;
27
import org.eclipse.ocl.types.util.TypesValidator;
30
import org.eclipse.ocl.util.OCLUtil;
28
import org.eclipse.ocl.util.OCLUtil;
31
29
(-)src/org/eclipse/ocl/OCL.java (-1 / +1 lines)
Lines 275-281 Link Here
275
				rootEnvironment, contentAsString.toCharArray());
275
				rootEnvironment, contentAsString.toCharArray());
276
			OCLBacktrackingParser parser = new OCLBacktrackingParser(lexer);
276
			OCLBacktrackingParser parser = new OCLBacktrackingParser(lexer);
277
			parser.setDefaultRepairCount(parserRepairCount);
277
			parser.setDefaultRepairCount(parserRepairCount);
278
			lexer.lexToTokens(parser);
278
			lexer.lexer(parser.getIPrsStream());
279
			analyzer = new OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(
279
			analyzer = new OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(
280
				parser);
280
				parser);
281
		} else {
281
		} else {
(-)src/org/eclipse/ocl/expressions/PropertyCallExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/CollectionLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
24
(-)src/org/eclipse/ocl/expressions/LoopExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
24
(-)src/org/eclipse/ocl/expressions/MessageExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.ocl.utilities.CallingASTNode;
24
import org.eclipse.ocl.utilities.CallingASTNode;
(-)src/org/eclipse/ocl/expressions/OperationCallExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
24
(-)src/org/eclipse/ocl/expressions/TupleLiteralPart.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.ocl.utilities.TypedASTNode;
23
import org.eclipse.ocl.utilities.TypedASTNode;
23
import org.eclipse.ocl.utilities.TypedElement;
24
import org.eclipse.ocl.utilities.TypedElement;
(-)src/org/eclipse/ocl/expressions/UnlimitedNaturalLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/BooleanLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/CollectionRange.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/Variable.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.ocl.utilities.TypedASTNode;
23
import org.eclipse.ocl.utilities.TypedASTNode;
23
import org.eclipse.ocl.utilities.TypedElement;
24
import org.eclipse.ocl.utilities.TypedElement;
(-)src/org/eclipse/ocl/expressions/RealLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/LetExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/EnumLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/IntegerLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/VariableExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/StringLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/IteratorExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/CollectionItem.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/TupleLiteralExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
24
(-)src/org/eclipse/ocl/expressions/IfExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/expressions/IterateExp.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.expressions;
18
package org.eclipse.ocl.expressions;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
23
23
/**
24
/**
(-)src/org/eclipse/ocl/cst/CSTNode.java (-5 / +6 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.cst;
18
package org.eclipse.ocl.cst;
19
19
20
import lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
21
import org.eclipse.emf.ecore.EObject;
22
import org.eclipse.emf.ecore.EObject;
22
23
23
/**
24
/**
Lines 104-110 Link Here
104
	 * If the meaning of the '<em>Start Token</em>' attribute isn't clear,
105
	 * If the meaning of the '<em>Start Token</em>' attribute isn't clear,
105
	 * there really should be more of a description here...
106
	 * there really should be more of a description here...
106
	 * </p>
107
	 * </p>
107
	 * @since 1.3
108
	 * @since 3.0
108
	 * <!-- end-user-doc -->
109
	 * <!-- end-user-doc -->
109
	 * @return the value of the '<em>Start Token</em>' attribute.
110
	 * @return the value of the '<em>Start Token</em>' attribute.
110
	 * @see #setStartToken(IToken)
111
	 * @see #setStartToken(IToken)
Lines 117-123 Link Here
117
	/**
118
	/**
118
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getStartToken <em>Start Token</em>}' attribute.
119
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getStartToken <em>Start Token</em>}' attribute.
119
	 * <!-- begin-user-doc -->
120
	 * <!-- begin-user-doc -->
120
	 * @since 1.3
121
	 * @since 3.0
121
	 * <!-- end-user-doc -->
122
	 * <!-- end-user-doc -->
122
	 * @param value the new value of the '<em>Start Token</em>' attribute.
123
	 * @param value the new value of the '<em>Start Token</em>' attribute.
123
	 * @see #getStartToken()
124
	 * @see #getStartToken()
Lines 132-138 Link Here
132
	 * If the meaning of the '<em>End Token</em>' attribute isn't clear,
133
	 * If the meaning of the '<em>End Token</em>' attribute isn't clear,
133
	 * there really should be more of a description here...
134
	 * there really should be more of a description here...
134
	 * </p>
135
	 * </p>
135
	 * @since 1.3
136
	 * @since 3.0
136
	 * <!-- end-user-doc -->
137
	 * <!-- end-user-doc -->
137
	 * @return the value of the '<em>End Token</em>' attribute.
138
	 * @return the value of the '<em>End Token</em>' attribute.
138
	 * @see #setEndToken(IToken)
139
	 * @see #setEndToken(IToken)
Lines 145-151 Link Here
145
	/**
146
	/**
146
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getEndToken <em>End Token</em>}' attribute.
147
	 * Sets the value of the '{@link org.eclipse.ocl.cst.CSTNode#getEndToken <em>End Token</em>}' attribute.
147
	 * <!-- begin-user-doc -->
148
	 * <!-- begin-user-doc -->
148
	 * @since 1.3
149
	 * @since 3.0
149
	 * <!-- end-user-doc -->
150
	 * <!-- end-user-doc -->
150
	 * @param value the new value of the '<em>End Token</em>' attribute.
151
	 * @param value the new value of the '<em>End Token</em>' attribute.
151
	 * @see #getEndToken()
152
	 * @see #getEndToken()
(-)src/org/eclipse/ocl/cst/CSTPackage.java (-5 / +5 lines)
Lines 4937-4943 Link Here
4937
	 * The meta object id for the '<em>IToken</em>' data type.
4937
	 * The meta object id for the '<em>IToken</em>' data type.
4938
	 * <!-- begin-user-doc -->
4938
	 * <!-- begin-user-doc -->
4939
	 * <!-- end-user-doc -->
4939
	 * <!-- end-user-doc -->
4940
	 * @see lpg.lpgjavaruntime.IToken
4940
	 * @see lpg.runtime.IToken
4941
	 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
4941
	 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
4942
	 * @generated
4942
	 * @generated
4943
	 * @noreference This field is not intended to be referenced by clients.
4943
	 * @noreference This field is not intended to be referenced by clients.
Lines 6425-6437 Link Here
6425
	EEnum getDotOrArrowEnum();
6425
	EEnum getDotOrArrowEnum();
6426
6426
6427
	/**
6427
	/**
6428
	 * Returns the meta object for data type '{@link lpg.lpgjavaruntime.IToken <em>IToken</em>}'.
6428
	 * Returns the meta object for data type '{@link lpg.runtime.IToken <em>IToken</em>}'.
6429
	 * <!-- begin-user-doc -->
6429
	 * <!-- begin-user-doc -->
6430
	 * @since 1.3
6430
	 * @since 1.3
6431
	 * <!-- end-user-doc -->
6431
	 * <!-- end-user-doc -->
6432
	 * @return the meta object for data type '<em>IToken</em>'.
6432
	 * @return the meta object for data type '<em>IToken</em>'.
6433
	 * @see lpg.lpgjavaruntime.IToken
6433
	 * @see lpg.runtime.IToken
6434
	 * @model instanceClass="lpg.lpgjavaruntime.IToken"
6434
	 * @model instanceClass="lpg.runtime.IToken"
6435
	 * @generated
6435
	 * @generated
6436
	 */
6436
	 */
6437
	EDataType getIToken();
6437
	EDataType getIToken();
Lines 7765-7771 Link Here
7765
		 * <!-- begin-user-doc -->
7765
		 * <!-- begin-user-doc -->
7766
		 * @since 1.3
7766
		 * @since 1.3
7767
		 * <!-- end-user-doc -->
7767
		 * <!-- end-user-doc -->
7768
		 * @see lpg.lpgjavaruntime.IToken
7768
		 * @see lpg.runtime.IToken
7769
		 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
7769
		 * @see org.eclipse.ocl.cst.impl.CSTPackageImpl#getIToken()
7770
		 * @generated
7770
		 * @generated
7771
		 */
7771
		 */
(-)src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java (-1 / +2 lines)
Lines 18-24 Link Here
18
 */
18
 */
19
package org.eclipse.ocl.cst.impl;
19
package org.eclipse.ocl.cst.impl;
20
20
21
import lpg.lpgjavaruntime.IToken;
21
import lpg.runtime.IToken;
22
22
import org.eclipse.emf.ecore.EAttribute;
23
import org.eclipse.emf.ecore.EAttribute;
23
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EClass;
24
import org.eclipse.emf.ecore.EDataType;
25
import org.eclipse.emf.ecore.EDataType;
(-)src/org/eclipse/ocl/cst/impl/CSTNodeImpl.java (-5 / +6 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.cst.impl;
18
package org.eclipse.ocl.cst.impl;
19
19
20
import lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.impl.ENotificationImpl;
24
import org.eclipse.emf.ecore.impl.ENotificationImpl;
Lines 217-223 Link Here
217
218
218
	/**
219
	/**
219
	 * <!-- begin-user-doc -->
220
	 * <!-- begin-user-doc -->
220
	 * @since 1.3
221
	 * @since 3.0
221
	 * <!-- end-user-doc -->
222
	 * <!-- end-user-doc -->
222
	 * @generated
223
	 * @generated
223
	 */
224
	 */
Lines 227-233 Link Here
227
228
228
	/**
229
	/**
229
	 * <!-- begin-user-doc -->
230
	 * <!-- begin-user-doc -->
230
	 * @since 1.3
231
	 * @since 3.0
231
	 * <!-- end-user-doc -->
232
	 * <!-- end-user-doc -->
232
	 * @generated
233
	 * @generated
233
	 */
234
	 */
Lines 241-247 Link Here
241
242
242
	/**
243
	/**
243
	 * <!-- begin-user-doc -->
244
	 * <!-- begin-user-doc -->
244
	 * @since 1.3
245
	 * @since 3.0
245
	 * <!-- end-user-doc -->
246
	 * <!-- end-user-doc -->
246
	 * @generated
247
	 * @generated
247
	 */
248
	 */
Lines 251-257 Link Here
251
252
252
	/**
253
	/**
253
	 * <!-- begin-user-doc -->
254
	 * <!-- begin-user-doc -->
254
	 * @since 1.3
255
	 * @since 3.0
255
	 * <!-- end-user-doc -->
256
	 * <!-- end-user-doc -->
256
	 * @generated
257
	 * @generated
257
	 */
258
	 */
(-)src/org/eclipse/ocl/cst/impl/ClassifierContextDeclCSImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.cst.impl;
18
package org.eclipse.ocl.cst.impl;
19
19
20
import java.util.Collection;
20
import java.util.Collection;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.notify.NotificationChain;
23
import org.eclipse.emf.common.util.EList;
24
import org.eclipse.emf.common.util.EList;
(-)src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java (-4 / +3 lines)
Lines 17-31 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.cst.impl;
18
package org.eclipse.ocl.cst.impl;
19
19
20
import lpg.lpgjavaruntime.IToken;
20
import lpg.runtime.IToken;
21
21
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EDataType;
23
import org.eclipse.emf.ecore.EDataType;
23
import org.eclipse.emf.ecore.EObject;
24
import org.eclipse.emf.ecore.EObject;
24
import org.eclipse.emf.ecore.EPackage;
25
import org.eclipse.emf.ecore.EPackage;
25
import org.eclipse.emf.ecore.impl.EFactoryImpl;
26
import org.eclipse.emf.ecore.impl.EFactoryImpl;
26
import org.eclipse.emf.ecore.plugin.EcorePlugin;
27
import org.eclipse.emf.ecore.plugin.EcorePlugin;
27
28
//import org.eclipse.ocl.cst.*;
29
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
28
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
30
import org.eclipse.ocl.cst.CSTFactory;
29
import org.eclipse.ocl.cst.CSTFactory;
31
import org.eclipse.ocl.cst.CSTPackage;
30
import org.eclipse.ocl.cst.CSTPackage;
Lines 823-829 Link Here
823
822
824
	/**
823
	/**
825
	 * <!-- begin-user-doc -->
824
	 * <!-- begin-user-doc -->
826
	 * @since 1.3
825
	 * @since 3.0
827
	 * <!-- end-user-doc -->
826
	 * <!-- end-user-doc -->
828
	 * @generated
827
	 * @generated
829
	 */
828
	 */
(-)src/org/eclipse/ocl/cst/impl/OCLDocumentCSImpl.java (-4 lines)
Lines 19-33 Link Here
19
import java.util.Collection;
19
import java.util.Collection;
20
20
21
import org.eclipse.emf.common.notify.NotificationChain;
21
import org.eclipse.emf.common.notify.NotificationChain;
22
23
import org.eclipse.emf.common.util.EList;
22
import org.eclipse.emf.common.util.EList;
24
25
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
26
import org.eclipse.emf.ecore.InternalEObject;
24
import org.eclipse.emf.ecore.InternalEObject;
27
28
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
25
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
29
import org.eclipse.emf.ecore.util.InternalEList;
26
import org.eclipse.emf.ecore.util.InternalEList;
30
31
import org.eclipse.ocl.cst.CSTPackage;
27
import org.eclipse.ocl.cst.CSTPackage;
32
import org.eclipse.ocl.cst.OCLDocumentCS;
28
import org.eclipse.ocl.cst.OCLDocumentCS;
33
import org.eclipse.ocl.cst.PackageDeclarationCS;
29
import org.eclipse.ocl.cst.PackageDeclarationCS;
(-)src/org/eclipse/ocl/types/impl/MessageTypeImpl.java (-1 / +2 lines)
Lines 18-26 Link Here
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.notify.Notification;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.BasicEList;
23
import org.eclipse.emf.common.util.BasicEList;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.ECollections;
25
import org.eclipse.emf.common.util.ECollections;
25
import org.eclipse.emf.common.util.EList;
26
import org.eclipse.emf.common.util.EList;
26
import org.eclipse.emf.ecore.EClass;
27
import org.eclipse.emf.ecore.EClass;
(-)src/org/eclipse/ocl/types/impl/TypesFactoryImpl.java (-2 lines)
Lines 25-32 Link Here
25
import org.eclipse.emf.ecore.EPackage;
25
import org.eclipse.emf.ecore.EPackage;
26
import org.eclipse.emf.ecore.impl.EFactoryImpl;
26
import org.eclipse.emf.ecore.impl.EFactoryImpl;
27
import org.eclipse.emf.ecore.plugin.EcorePlugin;
27
import org.eclipse.emf.ecore.plugin.EcorePlugin;
28
29
//import org.eclipse.ocl.types.*;
30
import org.eclipse.ocl.Environment;
28
import org.eclipse.ocl.Environment;
31
import org.eclipse.ocl.expressions.CollectionKind;
29
import org.eclipse.ocl.expressions.CollectionKind;
32
import org.eclipse.ocl.types.AnyType;
30
import org.eclipse.ocl.types.AnyType;
(-)src/org/eclipse/ocl/types/impl/SetTypeImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.ocl.expressions.CollectionKind;
24
import org.eclipse.ocl.expressions.CollectionKind;
(-)src/org/eclipse/ocl/types/impl/AnyTypeImpl.java (-2 lines)
Lines 24-31 Link Here
24
import org.eclipse.ocl.Environment;
24
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.types.AnyType;
25
import org.eclipse.ocl.types.AnyType;
26
import org.eclipse.ocl.types.TypesPackage;
26
import org.eclipse.ocl.types.TypesPackage;
27
28
//import org.eclipse.ocl.types.operations.AnyTypeOperations;
29
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
27
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
30
28
31
/**
29
/**
(-)src/org/eclipse/ocl/types/impl/TypeTypeImpl.java (-2 lines)
Lines 28-35 Link Here
28
import org.eclipse.ocl.Environment;
28
import org.eclipse.ocl.Environment;
29
import org.eclipse.ocl.types.TypeType;
29
import org.eclipse.ocl.types.TypeType;
30
import org.eclipse.ocl.types.TypesPackage;
30
import org.eclipse.ocl.types.TypesPackage;
31
32
//import org.eclipse.ocl.types.operations.TypeTypeOperations;
33
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
31
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
34
32
35
/**
33
/**
(-)src/org/eclipse/ocl/types/impl/OrderedSetTypeImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.ocl.expressions.CollectionKind;
24
import org.eclipse.ocl.expressions.CollectionKind;
(-)src/org/eclipse/ocl/types/impl/BagTypeImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.ocl.expressions.CollectionKind;
24
import org.eclipse.ocl.expressions.CollectionKind;
(-)src/org/eclipse/ocl/types/impl/SequenceTypeImpl.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.ocl.expressions.CollectionKind;
24
import org.eclipse.ocl.expressions.CollectionKind;
(-)src/org/eclipse/ocl/types/impl/TupleTypeImpl.java (-2 / +2 lines)
Lines 17-27 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import java.util.Iterator;
20
import java.util.Iterator;
21
import java.util.Map;
23
22
24
import org.eclipse.emf.common.util.BasicEList;
23
import org.eclipse.emf.common.util.BasicEList;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.EList;
25
import org.eclipse.emf.common.util.EList;
26
import org.eclipse.emf.ecore.EClass;
26
import org.eclipse.emf.ecore.EClass;
27
import org.eclipse.emf.ecore.impl.EObjectImpl;
27
import org.eclipse.emf.ecore.impl.EObjectImpl;
(-)src/org/eclipse/ocl/types/impl/CollectionTypeImpl.java (-2 / +2 lines)
Lines 17-28 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.types.impl;
18
package org.eclipse.ocl.types.impl;
19
19
20
import java.util.Map;
21
import java.util.List;
20
import java.util.List;
21
import java.util.Map;
22
22
23
import org.eclipse.emf.common.notify.Notification;
23
import org.eclipse.emf.common.notify.Notification;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.BasicEList;
24
import org.eclipse.emf.common.util.BasicEList;
25
import org.eclipse.emf.common.util.DiagnosticChain;
26
import org.eclipse.emf.common.util.EList;
26
import org.eclipse.emf.common.util.EList;
27
import org.eclipse.emf.ecore.EClass;
27
import org.eclipse.emf.ecore.EClass;
28
import org.eclipse.emf.ecore.EObject;
28
import org.eclipse.emf.ecore.EObject;
(-)src/org/eclipse/ocl/types/impl/VoidTypeImpl.java (-2 lines)
Lines 24-31 Link Here
24
import org.eclipse.ocl.Environment;
24
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.types.TypesPackage;
25
import org.eclipse.ocl.types.TypesPackage;
26
import org.eclipse.ocl.types.VoidType;
26
import org.eclipse.ocl.types.VoidType;
27
28
//import org.eclipse.ocl.types.operations.VoidTypeOperations;
29
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
27
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
30
28
31
/**
29
/**
(-)src/org/eclipse/ocl/types/impl/InvalidTypeImpl.java (-2 lines)
Lines 24-31 Link Here
24
import org.eclipse.ocl.Environment;
24
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.types.InvalidType;
25
import org.eclipse.ocl.types.InvalidType;
26
import org.eclipse.ocl.types.TypesPackage;
26
import org.eclipse.ocl.types.TypesPackage;
27
28
//import org.eclipse.ocl.types.operations.InvalidTypeOperations;
29
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
27
import org.eclipse.ocl.util.OCLStandardLibraryUtil;
30
28
31
/**
29
/**
(-)src/org/eclipse/ocl/expressions/operations/BooleanLiteralExpOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.BooleanLiteralExp;
26
import org.eclipse.ocl.expressions.BooleanLiteralExp;
28
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
27
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
28
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/IterateExpOperations.java (-2 lines)
Lines 22-33 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.IterateExp;
26
import org.eclipse.ocl.expressions.IterateExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
import org.eclipse.ocl.expressions.Variable;
28
import org.eclipse.ocl.expressions.Variable;
30
31
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
32
import org.eclipse.ocl.internal.l10n.OCLMessages;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
33
import org.eclipse.ocl.util.OCLUtil;
31
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/IfExpOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.IfExp;
26
import org.eclipse.ocl.expressions.IfExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
29
import org.eclipse.ocl.internal.l10n.OCLMessages;
32
import org.eclipse.ocl.util.OCLUtil;
30
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/IteratorExpOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.IteratorExp;
26
import org.eclipse.ocl.expressions.IteratorExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
29
import org.eclipse.ocl.internal.l10n.OCLMessages;
32
import org.eclipse.ocl.types.BagType;
30
import org.eclipse.ocl.types.BagType;
(-)src/org/eclipse/ocl/expressions/operations/OCLExpressionOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.expressions.operations;
17
package org.eclipse.ocl.expressions.operations;
18
18
19
import org.eclipse.ocl.expressions.OCLExpression;
19
import org.eclipse.ocl.expressions.OCLExpression;
20
21
import org.eclipse.ocl.utilities.Visitor;
20
import org.eclipse.ocl.utilities.Visitor;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/expressions/operations/VariableExpOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.Variable;
26
import org.eclipse.ocl.expressions.Variable;
28
import org.eclipse.ocl.expressions.VariableExp;
27
import org.eclipse.ocl.expressions.VariableExp;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
29
import org.eclipse.ocl.internal.l10n.OCLMessages;
32
import org.eclipse.ocl.util.OCLUtil;
30
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/CollectionItemOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.CollectionItem;
26
import org.eclipse.ocl.expressions.CollectionItem;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
32
import org.eclipse.ocl.util.TypeUtil;
30
import org.eclipse.ocl.util.TypeUtil;
(-)src/org/eclipse/ocl/expressions/operations/CollectionLiteralExpOperations.java (-2 lines)
Lines 23-34 Link Here
23
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.BasicDiagnostic;
24
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.Diagnostic;
25
import org.eclipse.emf.common.util.DiagnosticChain;
25
import org.eclipse.emf.common.util.DiagnosticChain;
26
27
import org.eclipse.ocl.Environment;
26
import org.eclipse.ocl.Environment;
28
import org.eclipse.ocl.expressions.CollectionKind;
27
import org.eclipse.ocl.expressions.CollectionKind;
29
import org.eclipse.ocl.expressions.CollectionLiteralExp;
28
import org.eclipse.ocl.expressions.CollectionLiteralExp;
30
import org.eclipse.ocl.expressions.CollectionLiteralPart;
29
import org.eclipse.ocl.expressions.CollectionLiteralPart;
31
32
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
34
import org.eclipse.ocl.types.CollectionType;
32
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/expressions/operations/PropertyCallExpOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.OCLExpression;
26
import org.eclipse.ocl.expressions.OCLExpression;
28
import org.eclipse.ocl.expressions.PropertyCallExp;
27
import org.eclipse.ocl.expressions.PropertyCallExp;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
32
import org.eclipse.ocl.util.TypeUtil;
30
import org.eclipse.ocl.util.TypeUtil;
(-)src/org/eclipse/ocl/expressions/operations/EnumLiteralExpOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.EnumLiteralExp;
26
import org.eclipse.ocl.expressions.EnumLiteralExp;
28
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
27
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
28
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/CollectionLiteralPartOperations.java (-1 lines)
Lines 17-23 Link Here
17
package org.eclipse.ocl.expressions.operations;
17
package org.eclipse.ocl.expressions.operations;
18
18
19
import org.eclipse.ocl.expressions.CollectionLiteralPart;
19
import org.eclipse.ocl.expressions.CollectionLiteralPart;
20
21
import org.eclipse.ocl.utilities.Visitor;
20
import org.eclipse.ocl.utilities.Visitor;
22
21
23
/**
22
/**
(-)src/org/eclipse/ocl/expressions/operations/MessageExpOperations.java (-2 lines)
Lines 24-34 Link Here
24
import org.eclipse.emf.common.util.BasicDiagnostic;
24
import org.eclipse.emf.common.util.BasicDiagnostic;
25
import org.eclipse.emf.common.util.Diagnostic;
25
import org.eclipse.emf.common.util.Diagnostic;
26
import org.eclipse.emf.common.util.DiagnosticChain;
26
import org.eclipse.emf.common.util.DiagnosticChain;
27
28
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.Environment;
29
import org.eclipse.ocl.expressions.MessageExp;
28
import org.eclipse.ocl.expressions.MessageExp;
30
import org.eclipse.ocl.expressions.OCLExpression;
29
import org.eclipse.ocl.expressions.OCLExpression;
31
32
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
34
import org.eclipse.ocl.types.CollectionType;
32
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/expressions/operations/UnlimitedNaturalLiteralExpOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp;
26
import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp;
28
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
27
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
28
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/IntegerLiteralExpOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.IntegerLiteralExp;
26
import org.eclipse.ocl.expressions.IntegerLiteralExp;
28
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
27
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
28
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/TupleLiteralExpOperations.java (-2 lines)
Lines 24-34 Link Here
24
import org.eclipse.emf.common.util.BasicDiagnostic;
24
import org.eclipse.emf.common.util.BasicDiagnostic;
25
import org.eclipse.emf.common.util.Diagnostic;
25
import org.eclipse.emf.common.util.Diagnostic;
26
import org.eclipse.emf.common.util.DiagnosticChain;
26
import org.eclipse.emf.common.util.DiagnosticChain;
27
28
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.Environment;
29
import org.eclipse.ocl.expressions.TupleLiteralExp;
28
import org.eclipse.ocl.expressions.TupleLiteralExp;
30
import org.eclipse.ocl.expressions.TupleLiteralPart;
29
import org.eclipse.ocl.expressions.TupleLiteralPart;
31
32
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
34
import org.eclipse.ocl.types.TupleType;
32
import org.eclipse.ocl.types.TupleType;
(-)src/org/eclipse/ocl/expressions/operations/LoopExpOperations.java (-2 lines)
Lines 22-33 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.LoopExp;
26
import org.eclipse.ocl.expressions.LoopExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
import org.eclipse.ocl.expressions.Variable;
28
import org.eclipse.ocl.expressions.Variable;
30
31
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
32
import org.eclipse.ocl.internal.l10n.OCLMessages;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
33
import org.eclipse.ocl.types.CollectionType;
31
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/expressions/operations/OperationCallExpOperations.java (-2 lines)
Lines 25-35 Link Here
25
import org.eclipse.emf.common.util.BasicDiagnostic;
25
import org.eclipse.emf.common.util.BasicDiagnostic;
26
import org.eclipse.emf.common.util.Diagnostic;
26
import org.eclipse.emf.common.util.Diagnostic;
27
import org.eclipse.emf.common.util.DiagnosticChain;
27
import org.eclipse.emf.common.util.DiagnosticChain;
28
29
import org.eclipse.ocl.Environment;
28
import org.eclipse.ocl.Environment;
30
import org.eclipse.ocl.expressions.OCLExpression;
29
import org.eclipse.ocl.expressions.OCLExpression;
31
import org.eclipse.ocl.expressions.OperationCallExp;
30
import org.eclipse.ocl.expressions.OperationCallExp;
32
33
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
34
import org.eclipse.ocl.internal.l10n.OCLMessages;
32
import org.eclipse.ocl.internal.l10n.OCLMessages;
35
import org.eclipse.ocl.util.OCLUtil;
33
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/RealLiteralExpOperations.java (-2 lines)
Lines 22-31 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.RealLiteralExp;
26
import org.eclipse.ocl.expressions.RealLiteralExp;
28
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
27
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
28
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.util.OCLUtil;
29
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/expressions/operations/TupleLiteralPartOperations.java (-3 / +1 lines)
Lines 22-38 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.OCLExpression;
26
import org.eclipse.ocl.expressions.OCLExpression;
28
import org.eclipse.ocl.expressions.TupleLiteralExp;
27
import org.eclipse.ocl.expressions.TupleLiteralExp;
29
import org.eclipse.ocl.expressions.TupleLiteralPart;
28
import org.eclipse.ocl.expressions.TupleLiteralPart;
30
31
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
29
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
32
import org.eclipse.ocl.utilities.Visitor;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
30
import org.eclipse.ocl.internal.l10n.OCLMessages;
34
import org.eclipse.ocl.util.OCLUtil;
31
import org.eclipse.ocl.util.OCLUtil;
35
import org.eclipse.ocl.util.TypeUtil;
32
import org.eclipse.ocl.util.TypeUtil;
33
import org.eclipse.ocl.utilities.Visitor;
36
34
37
/**
35
/**
38
 * <!-- begin-user-doc -->
36
 * <!-- begin-user-doc -->
(-)src/org/eclipse/ocl/expressions/operations/VariableOperations.java (-3 / +1 lines)
Lines 22-37 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.OCLExpression;
26
import org.eclipse.ocl.expressions.OCLExpression;
28
import org.eclipse.ocl.expressions.Variable;
27
import org.eclipse.ocl.expressions.Variable;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.utilities.Visitor;
32
import org.eclipse.ocl.internal.l10n.OCLMessages;
29
import org.eclipse.ocl.internal.l10n.OCLMessages;
33
import org.eclipse.ocl.util.OCLUtil;
30
import org.eclipse.ocl.util.OCLUtil;
34
import org.eclipse.ocl.util.TypeUtil;
31
import org.eclipse.ocl.util.TypeUtil;
32
import org.eclipse.ocl.utilities.Visitor;
35
33
36
/**
34
/**
37
 * <!-- begin-user-doc -->
35
 * <!-- begin-user-doc -->
(-)src/org/eclipse/ocl/expressions/operations/LetExpOperations.java (-2 lines)
Lines 22-32 Link Here
22
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
24
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
25
26
import org.eclipse.ocl.Environment;
25
import org.eclipse.ocl.Environment;
27
import org.eclipse.ocl.expressions.LetExp;
26
import org.eclipse.ocl.expressions.LetExp;
28
import org.eclipse.ocl.expressions.OCLExpression;
27
import org.eclipse.ocl.expressions.OCLExpression;
29
30
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
28
import org.eclipse.ocl.expressions.util.ExpressionsValidator;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
29
import org.eclipse.ocl.internal.l10n.OCLMessages;
32
import org.eclipse.ocl.util.OCLUtil;
30
import org.eclipse.ocl.util.OCLUtil;
(-)src/org/eclipse/ocl/lpg/AbstractAnalyzer.java (-5 / +38 lines)
Lines 79-85 Link Here
79
	}
79
	}
80
80
81
	public void dumpTokens() {
81
	public void dumpTokens() {
82
		parser.dumpTokens();
82
		parser.getIPrsStream().dumpTokens();
83
	}
83
	}
84
84
85
	public String formatClass(Object object) {
85
	public String formatClass(Object object) {
Lines 276-282 Link Here
276
	}
276
	}
277
277
278
	public void setFileName(String filename) {
278
	public void setFileName(String filename) {
279
		getLexer().setFileName(filename);
279
		getLexer().getILexStream().setFileName(filename);
280
	}
280
	}
281
281
282
	/**
282
	/**
Lines 284-292 Link Here
284
	 * 
284
	 * 
285
	 * @param buffer
285
	 * @param buffer
286
	 *            the characters
286
	 *            the characters
287
	 * 
288
	 * @deprecated clients should invoke {@link #reset(char[], String)}
287
	 */
289
	 */
288
	public void initialize(char[] buffer) {
290
	public void initialize(char[] buffer) {
289
		getLexer().initialize(buffer);
291
		reset(buffer, null);
290
	}
292
	}
291
293
292
	/**
294
	/**
Lines 296-309 Link Here
296
	 *            providing the source text
298
	 *            providing the source text
297
	 * @throws IOException
299
	 * @throws IOException
298
	 *             if reading fails
300
	 *             if reading fails
301
	 * 
302
	 * @deprecated clients should invoke {@link #reset(Reader, String)}
299
	 */
303
	 */
300
	public void initialize(Reader reader)
304
	public void initialize(Reader reader)
301
			throws IOException {
305
			throws IOException {
302
		getLexer().initialize(reader);
306
		reset(reader, null);
307
	}
308
	
309
	/**
310
	 *  Define the input text as a given array of characters.
311
     *
312
	 * @param buffer
313
	 *            the characters
314
	 * @param fileName
315
     *            the associated finleName of the input, or <code>null</code> if none.
316
	 * @since 3.0
317
	 */
318
	public void reset(char[] buffer, String fileName) {
319
		getLexer().reset(buffer, fileName);
320
	}
321
322
	/**
323
	 * Define the input text by reading from a reader.
324
	 * 
325
	 * @param reader
326
	 *            providing the source text
327
	 * @param fileName
328
     *            the associated finleName of the input, or <code>null</code> if none.
329
	 * @throws IOException
330
	 *             if reading fails
331
	 * @since 3.0
332
	 */
333
	public void reset(Reader reader, String fileName)
334
			throws IOException {
335
		getLexer().reset(reader, fileName);
303
	}
336
	}
304
337
305
	public void setTab(int tab) {
338
	public void setTab(int tab) {
306
		getLexer().setTab(tab);
339
		getLexer().getILexStream().setTab(tab);
307
	}
340
	}
308
341
309
	public void setTraceFlag(boolean flag) {
342
	public void setTraceFlag(boolean flag) {
(-)src/org/eclipse/ocl/lpg/AbstractBasicEnvironment.java (-5 / +5 lines)
Lines 25-32 Link Here
25
import java.util.List;
25
import java.util.List;
26
import java.util.Map;
26
import java.util.Map;
27
27
28
import lpg.lpgjavaruntime.IToken;
28
import lpg.runtime.IToken;
29
import lpg.lpgjavaruntime.ParseErrorCodes;
29
import lpg.runtime.ParseErrorCodes;
30
30
31
import org.eclipse.ocl.cst.CSTNode;
31
import org.eclipse.ocl.cst.CSTNode;
32
import org.eclipse.ocl.internal.OCLDebugOptions;
32
import org.eclipse.ocl.internal.OCLDebugOptions;
Lines 238-246 Link Here
238
        }
238
        }
239
		int leftTokenLoc = (leftToken > rightToken ? rightToken : leftToken);
239
		int leftTokenLoc = (leftToken > rightToken ? rightToken : leftToken);
240
		int rightTokenLoc = rightToken;
240
		int rightTokenLoc = rightToken;
241
		int startOffset = parser.getStartOffset(leftTokenLoc);
241
		int startOffset = parser.getIPrsStream().getStartOffset(leftTokenLoc);
242
		int endOffset = parser.getEndOffset(rightTokenLoc);
242
		int endOffset = parser.getIPrsStream().getEndOffset(rightTokenLoc);
243
		int line = leftTokenLoc >= 0 ? parser.getLine(leftTokenLoc) : -1;
243
		int line = leftTokenLoc >= 0 ? parser.getIPrsStream().getLine(leftTokenLoc) : -1;
244
		String message;
244
		String message;
245
        if (line <= 0) {
245
        if (line <= 0) {
246
        	message = OCLMessages.InvalidOCL_ERROR_;
246
        	message = OCLMessages.InvalidOCL_ERROR_;
(-)src/org/eclipse/ocl/lpg/AbstractParser.java (-173 / +207 lines)
Lines 19-33 Link Here
19
 */
19
 */
20
package org.eclipse.ocl.lpg;
20
package org.eclipse.ocl.lpg;
21
21
22
import java.util.ArrayList;
22
import lpg.runtime.ErrorToken;
23
23
import lpg.runtime.ILexStream;
24
import lpg.lpgjavaruntime.ErrorToken;
24
import lpg.runtime.IToken;
25
import lpg.lpgjavaruntime.IToken;
25
import lpg.runtime.Monitor;
26
import lpg.lpgjavaruntime.LexStream;
26
import lpg.runtime.ParseErrorCodes;
27
import lpg.lpgjavaruntime.Monitor;
27
import lpg.runtime.ParseTable;
28
import lpg.lpgjavaruntime.ParseErrorCodes;
28
import lpg.runtime.PrsStream;
29
import lpg.lpgjavaruntime.PrsStream;
30
import lpg.lpgjavaruntime.Token;
31
29
32
import org.eclipse.ocl.cst.CSTNode;
30
import org.eclipse.ocl.cst.CSTNode;
33
import org.eclipse.ocl.internal.l10n.OCLMessages;
31
import org.eclipse.ocl.internal.l10n.OCLMessages;
Lines 43-66 Link Here
43
 * tokens from text parsing and analysis to support the AST and CST classes
41
 * tokens from text parsing and analysis to support the AST and CST classes
44
 * appropriate to a particular language.
42
 * appropriate to a particular language.
45
 */
43
 */
46
public abstract class AbstractParser
44
public abstract class AbstractParser {
47
		extends PrsStream {
45
	
48
49
	private final BasicEnvironment environment;
46
	private final BasicEnvironment environment;
50
47
51
	private int defaultRepairCount = 0;
48
	private int defaultRepairCount = 0;
49
	
50
	private AbstractLexer lexer;
52
51
53
	public AbstractParser(BasicEnvironment environment) {
52
	/*public AbstractParser(BasicEnvironment environment) {
54
		this.environment = environment;
53
		this.environment = environment;
55
		environment.setParser(this);
54
		environment.setParser(this);
56
	}
55
	}*/
57
56
58
	public AbstractParser(AbstractLexer lexer) {
57
	public AbstractParser(AbstractLexer lexer) {
59
		super(lexer);
58
		this.lexer = lexer;
60
		this.environment = lexer.getEnvironment();
59
		this.environment = lexer.getEnvironment();
61
		environment.setParser(this);
60
		environment.setParser(this);		
61
	}
62
	
63
	public AbstractLexer getLexer() {
64
		return lexer;
62
	}
65
	}
63
64
	/**
66
	/**
65
	 * Returns a single line string representation of the input chars for the
67
	 * Returns a single line string representation of the input chars for the
66
	 * given range.
68
	 * given range.
Lines 73-79 Link Here
73
	 */
75
	 */
74
	public String computeInputString(int left, int right) {
76
	public String computeInputString(int left, int right) {
75
		StringBuffer result = new StringBuffer(right - left + 1);
77
		StringBuffer result = new StringBuffer(right - left + 1);
76
		char[] chars = getInputChars();
78
		char[] chars = getIPrsStream().getInputChars();
77
		if (chars.length > 0) {
79
		if (chars.length > 0) {
78
			for (int i = left; i <= right; i++) {
80
			for (int i = left; i <= right; i++) {
79
				if (chars[i] == '\t') {
81
				if (chars[i] == '\t') {
Lines 97-244 Link Here
97
	public BasicEnvironment getEnvironment() {
99
	public BasicEnvironment getEnvironment() {
98
		return environment;
100
		return environment;
99
	}
101
	}
100
102
	
101
	/**
102
	 * This function returns the index of the token element containing the
103
	 * offset specified. If such a token does not exist, it returns the negation
104
	 * of the index of the element immediately preceding the offset.
105
	 * 
106
	 * @since 1.3
107
	 */
108
	public ErrorToken getErrorTokenAtCharacter(int offset) {
109
		ErrorToken bestToken = null;
110
		for (int i = getSize(); --i >= 0;) {
111
			IToken token = getTokenAt(i);
112
			if (!(token instanceof ErrorToken)) {
113
				break;
114
			}
115
			IToken errorToken = ((ErrorToken) token).getErrorToken();
116
			if (offset >= errorToken.getStartOffset()
117
				&& offset <= errorToken.getEndOffset()) {
118
				if ((bestToken == null)
119
					|| ((bestToken.getStartOffset() <= errorToken
120
						.getStartOffset()) && (token.getEndOffset() <= errorToken
121
						.getEndOffset()))) {
122
					bestToken = (ErrorToken) token;
123
				}
124
			}
125
		}
126
		return bestToken;
127
	}
128
129
	/**
130
	 * @since 1.3
131
	 */
132
	public int getDefaultRepairCount() {
133
		return defaultRepairCount;
134
	}
135
136
	/**
137
	 * @since 1.3
138
	 */
139
	public int getErrorTokens() {
140
		return getTokens().size() - getStreamLength();
141
	}
142
143
	public AbstractLexer getLexer() {
144
		return (AbstractLexer) super.getLexStream();
145
	}
146
147
	/**
148
	 * Overridden to search only the non-Error nodes, which are the only tokens
149
	 * in monotonic order.
150
	 */
151
	@Override
152
	public int getTokenIndexAtCharacter(int offset) {
153
		int low = 0;
154
		int high = getSize();
155
		while (high > low) {
156
			IToken highToken = getTokenAt(high - 1);
157
			if (!(highToken instanceof ErrorToken)) {
158
				break;
159
			}
160
			high--;
161
		}
162
		while (high > low) {
163
			int mid = (high + low) / 2;
164
			IToken mid_element = getTokenAt(mid);
165
			if (offset >= mid_element.getStartOffset()
166
				&& offset <= mid_element.getEndOffset()) {
167
				return mid;
168
			} else if (offset < mid_element.getStartOffset()) {
169
				high = mid;
170
			} else {
171
				low = mid + 1;
172
			}
173
		}
174
175
		return -(low - 1);
176
	}
177
178
	@Override
179
	public int makeErrorToken(int firsttok, int lasttok, int errortok, int kind) {
180
		@SuppressWarnings("unchecked")
181
		ArrayList<IToken> tokens = getTokens();
182
		int index = tokens.size(); // the next index
183
184
		//
185
		// Note that when creating an error token, we do not remap its kind.
186
		// Since this is not a lexical operation, it is the responsibility of
187
		// the calling program (a parser driver) to pass to us the proper kind
188
		// that it wants for an error token.
189
		//
190
		Token token = new ErrorToken(getIToken(firsttok), getIToken(lasttok),
191
			getIToken(errortok), getStartOffset(firsttok),
192
			getEndOffset(lasttok), kind) {
193
194
			@Override
195
			public String toString() {
196
				if (getPrsStream() == null) {
197
					return "<toString>"; //$NON-NLS-1$
198
				}
199
				int startOffset = getStartOffset();
200
				int length = getEndOffset() - startOffset;
201
				if (length < 0) {
202
					length = -length - 1;
203
					startOffset = getEndOffset();
204
				}
205
				if ((startOffset + length) > getPrsStream().getInputChars().length) {
206
					return String.valueOf(IToken.EOF);
207
				}
208
				return new String(getPrsStream().getInputChars(), startOffset,
209
					length);
210
			}
211
212
		};
213
		token.setTokenIndex(index);
214
		tokens.add(token);
215
		token.setAdjunctIndex(getAdjuncts().size());
216
		return index;
217
	}
218
219
	public CSTNode parseTokensToCST() {
220
		return parseTokensToCST(null, defaultRepairCount);
221
	}
222
223
	public abstract CSTNode parseTokensToCST(Monitor monitor,
224
			int error_repair_count);
225
226
	@Override
227
	public void reportError(int errorCode, String locationInfo, int leftToken,
228
			int rightToken, String tokenText) {
229
		BasicEnvironment environment = getEnvironment();
230
		if (environment == null) {
231
			super.reportError(errorCode, locationInfo, leftToken, rightToken,
232
				tokenText);
233
		} else {
234
			if (errorCode == DELETION_CODE || errorCode == MISPLACED_CODE) {
235
				tokenText = ""; //$NON-NLS-1$
236
			}
237
			environment
238
				.parserError(errorCode, leftToken, rightToken, tokenText);
239
		}
240
	}
241
242
	/**
103
	/**
243
	 * Report error message for given error_token.
104
	 * Report error message for given error_token.
244
	 * 
105
	 * 
Lines 250-278 Link Here
250
	 * @since 1.3
111
	 * @since 1.3
251
	 */
112
	 */
252
	public final void reportErrorTokenMessage(int error_token, String msg) {
113
	public final void reportErrorTokenMessage(int error_token, String msg) {
253
		int firsttok = super.getFirstRealToken(error_token);
114
		int firsttok = getIPrsStream().getFirstRealToken(error_token);
254
		int lasttok = super.getLastRealToken(error_token);
115
		int lasttok = getIPrsStream().getLastRealToken(error_token);
255
		if (firsttok > lasttok) {
116
		if (firsttok > lasttok) {
256
			String location = super.getFileName() + ':'
117
			/*String location = super.getFileName() + ':'
257
				+ super.getEndLine(lasttok) + ':' + super.getEndColumn(lasttok)
118
				+ super.getEndLine(lasttok) + ':' + super.getEndColumn(lasttok)
258
				+ ": "; //$NON-NLS-1$
119
				+ ": "; //$NON-NLS-1$*/
259
			reportError(ParseErrorCodes.INSERTION_CODE, location, lasttok,
120
			getIPrsStream().reportError(ParseErrorCodes.INSERTION_CODE, lasttok,
260
				lasttok, msg);
121
				lasttok, msg);
261
		} else {
122
		} else {
262
			String location = super.getFileName() + ':'
123
			/*String location = super.getFileName() + ':'
263
				+ super.getLine(error_token) + ':'
124
				+ super.getLine(error_token) + ':'
264
				+ super.getColumn(error_token) + ':'
125
				+ super.getColumn(error_token) + ':'
265
				+ super.getEndLine(error_token) + ':'
126
				+ super.getEndLine(error_token) + ':'
266
				+ super.getEndColumn(error_token) + ": "; //$NON-NLS-1$
127
				+ super.getEndColumn(error_token) + ": "; //$NON-NLS-1$*/
267
			reportError(ParseErrorCodes.SUBSTITUTION_CODE, location, firsttok,
128
			getIPrsStream().reportError(ParseErrorCodes.SUBSTITUTION_CODE, firsttok,
268
				lasttok, msg);
129
				lasttok, msg);
269
		}
130
		}
270
	}
131
	}
271
132
272
	@Override
133
	/**
134
	 * @return
135
	 * @deprecated clients should invoke {@link #parser()}
136
	 */
137
	public CSTNode parseTokensToCST() {
138
		return parser(null, defaultRepairCount);
139
	}
140
141
	/**
142
	 * @param monitor
143
	 * @param error_repair_count
144
	 * @return
145
	 * 
146
	 * @deprecated clients should invoke {@link #parser(Monitor, int)}
147
	 * @since 3.0
148
	 */
149
	public CSTNode parseTokensToCST(Monitor monitor,
150
			int error_repair_count) {
151
		return parser(monitor, error_repair_count);	
152
	}
153
154
	/*@Override
273
	public void resetLexStream(LexStream lexStream) {
155
	public void resetLexStream(LexStream lexStream) {
274
		setLexStream((AbstractLexer) lexStream);
156
		setLexStream((AbstractLexer) lexStream);
275
	}
157
	}*/
276
158
277
	/**
159
	/**
278
	 * Sets the number of repairs to be performed by a parser capable of
160
	 * Sets the number of repairs to be performed by a parser capable of
Lines 294-302 Link Here
294
176
295
		this.defaultRepairCount = defaultRepairCount;
177
		this.defaultRepairCount = defaultRepairCount;
296
	}
178
	}
297
179
	
298
	public void setLexStream(AbstractLexer lexStream) {
180
	/**
299
		super.resetLexStream(lexStream);
181
	 * @since 1.3
182
	 */
183
	public int getDefaultRepairCount() {
184
		return defaultRepairCount;
300
	}
185
	}
301
186
302
	/**
187
	/**
Lines 307-312 Link Here
307
	 *            <code>CSTNode</code> to set offsets
192
	 *            <code>CSTNode</code> to set offsets
308
	 * @param startEnd
193
	 * @param startEnd
309
	 *            <code>IToken</code> to retrieve offsets from
194
	 *            <code>IToken</code> to retrieve offsets from
195
	 * @since 3.0
310
	 */
196
	 */
311
	protected void setOffsets(CSTNode cstNode, IToken startEnd) {
197
	protected void setOffsets(CSTNode cstNode, IToken startEnd) {
312
		cstNode.setStartToken(startEnd);
198
		cstNode.setStartToken(startEnd);
Lines 368-373 Link Here
368
	 *            <code>CSTNode</code> to retrieve start offset from
254
	 *            <code>CSTNode</code> to retrieve start offset from
369
	 * @param end
255
	 * @param end
370
	 *            <code>IToken</code> to retrieve end offset from
256
	 *            <code>IToken</code> to retrieve end offset from
257
	 * @since 3.0
371
	 */
258
	 */
372
	protected void setOffsets(CSTNode cstNode, CSTNode start, IToken end) {
259
	protected void setOffsets(CSTNode cstNode, CSTNode start, IToken end) {
373
		cstNode.setStartToken(start.getStartToken());
260
		cstNode.setStartToken(start.getStartToken());
Lines 387-392 Link Here
387
	 *            <code>IToken</code> to retrieve start offset from
274
	 *            <code>IToken</code> to retrieve start offset from
388
	 * @param end
275
	 * @param end
389
	 *            <code>CSTNode</code> to retrieve end offset from
276
	 *            <code>CSTNode</code> to retrieve end offset from
277
	 * @since 3.0
390
	 */
278
	 */
391
	protected void setOffsets(CSTNode cstNode, IToken start, CSTNode end) {
279
	protected void setOffsets(CSTNode cstNode, IToken start, CSTNode end) {
392
		cstNode.setStartToken(start);
280
		cstNode.setStartToken(start);
Lines 406-411 Link Here
406
	 *            <code>IToken</code> to retrieve start offset from
294
	 *            <code>IToken</code> to retrieve start offset from
407
	 * @param end
295
	 * @param end
408
	 *            <code>IToken</code> to retrieve end offset from
296
	 *            <code>IToken</code> to retrieve end offset from
297
	 * @since 3.0
409
	 */
298
	 */
410
	protected void setOffsets(CSTNode cstNode, IToken start, IToken end) {
299
	protected void setOffsets(CSTNode cstNode, IToken start, IToken end) {
411
		cstNode.setStartToken(start);
300
		cstNode.setStartToken(start);
Lines 413-418 Link Here
413
		cstNode.setStartOffset(start.getStartOffset());
302
		cstNode.setStartOffset(start.getStartOffset());
414
		cstNode.setEndOffset(end.getEndOffset());
303
		cstNode.setEndOffset(end.getEndOffset());
415
	}
304
	}
305
	
306
    /**
307
     * <p>
308
     * Initializes a concrete-syntax node's start and end offsets from the
309
     * current token in the parser stream.
310
     * <p>
311
     * 
312
     * <p>
313
     * <b>Note:</b> this method resided in the OCLEssential.g template since 1.2 
314
     * It has been incorporated in the abstract parser since 3.0
315
     * </p>
316
     * 
317
     * @param cstNode a concrete-syntax node
318
     * 
319
     * @since 3.0
320
     */
321
	protected void setOffsets(CSTNode cstNode) {
322
		IToken firstToken = getRhsIToken(1);
323
		cstNode.setStartToken(firstToken);
324
		cstNode.setEndToken(firstToken);
325
		cstNode.setStartOffset(firstToken.getStartOffset());
326
		cstNode.setEndOffset(firstToken.getEndOffset()-1);
327
	}
416
328
417
	/**
329
	/**
418
	 * Removes the "s surrounding a quoted string, if any.
330
	 * Removes the "s surrounding a quoted string, if any.
Lines 457-460 Link Here
457
369
458
		return result;
370
		return result;
459
	}
371
	}
372
	
373
	// Some useful methods which will be implemented in the generated Parser
374
	abstract public String[] orderedTerminalSymbols();
375
	
376
	/**
377
	 * @since 3.0
378
	 */
379
	abstract public OCLParserStream getIPrsStream();
380
	
381
	/**
382
	 * @since 3.0
383
	 */
384
	abstract public void reset(ILexStream lexStream);
385
	
386
	/**
387
	 * @since 3.0
388
	 */
389
	abstract public CSTNode parser();
390
        
391
	/**
392
	 * @since 3.0
393
	 */
394
	abstract public CSTNode parser(Monitor monitor);
395
        
396
	/**
397
	 * @since 3.0
398
	 */
399
	abstract public CSTNode parser(int error_repair_count);
400
        
401
	/**
402
	 * @since 3.0
403
	 */
404
	abstract public CSTNode parser(Monitor monitor, int error_repair_count);
405
	
406
	/**
407
	 * @since 3.0
408
	 */
409
	abstract public ParseTable getParseTable();
410
	
411
	/**
412
	 * @since 3.0
413
	 */
414
	abstract public Object getRhsSym(int i);
415
416
	/**
417
	 * @since 3.0
418
	 */
419
	abstract public int getRhsTokenIndex(int i);
420
	
421
	/**
422
	 * @since 3.0
423
	 */
424
	abstract public IToken getRhsIToken(int i);
425
    
426
	/**
427
	 * @since 3.0
428
	 */
429
	abstract public int getRhsFirstTokenIndex(int i);
430
	
431
	/**
432
	 * @since 3.0
433
	 */
434
	abstract public IToken getRhsFirstIToken(int i);
435
436
	/**
437
	 * @since 3.0
438
	 */
439
	abstract public int getRhsLastTokenIndex(int i);
440
	
441
	/**
442
	 * @since 3.0
443
	 */
444
	abstract public IToken getRhsLastIToken(int i);
445
446
	/**
447
	 * @since 3.0
448
	 */
449
	abstract public int getLeftSpan();
450
	
451
	/**
452
	 * @since 3.0
453
	 */
454
	abstract public IToken getLeftIToken();
455
456
	/**
457
	 * @since 3.0
458
	 */
459
	abstract public int getRightSpan();
460
	
461
	/**
462
	 * @since 3.0
463
	 */
464
	abstract public IToken getRightIToken();
465
466
	/**
467
	 * @since 3.0
468
	 */
469
	abstract public int getRhsErrorTokenIndex(int i);
470
	
471
	/**
472
	 * @since 3.0
473
	 */
474
	abstract public ErrorToken getRhsErrorIToken(int i);
475
476
    /**
477
     * @deprecated replaced by {@link #getIPrsStream()}
478
     * @since 3.0
479
     *
480
     */
481
	abstract public PrsStream getPrsStream();
482
483
    /**
484
     * @deprecated replaced by {@link #getIPrsStream()}
485
     * @since 3.0
486
     *
487
     */
488
	abstract public PrsStream getParseStream();
489
    
490
    /**
491
     * @since 3.0
492
	 */
493
	abstract public int numTokenKinds();
460
}
494
}
(-)src/org/eclipse/ocl/lpg/AbstractLexer.java (-64 / +124 lines)
Lines 23-31 Link Here
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.io.Reader;
24
import java.io.Reader;
25
25
26
import lpg.lpgjavaruntime.LpgLexStream;
26
import lpg.runtime.ILexStream;
27
import lpg.lpgjavaruntime.Monitor;
27
import lpg.runtime.LexParser;
28
import lpg.lpgjavaruntime.RuleAction;
28
import lpg.runtime.Monitor;
29
import lpg.runtime.ParseTable;
29
30
30
31
31
/**
32
/**
Lines 36-45 Link Here
36
 * 
37
 * 
37
 * Derived classes should extend the abstract support for AST from CST from tokens from text
38
 * Derived classes should extend the abstract support for AST from CST from tokens from text
38
 * parsing and analysis to support the AST and CST classes appropriate to a particular language.
39
 * parsing and analysis to support the AST and CST classes appropriate to a particular language.
40
 * @since 3.0
39
 */
41
 */
40
public abstract class AbstractLexer extends LpgLexStream implements RuleAction
42
public abstract class AbstractLexer 
41
{
43
{
42
    protected final static int ECLIPSE_TAB_VALUE = 4;
44
    
43
    
45
    
44
    /**
46
    /**
45
 	 * Read all input characters from a reader.
47
 	 * Read all input characters from a reader.
Lines 70-107 Link Here
70
		return buffer;
72
		return buffer;
71
	}  
73
	}  
72
    
74
    
73
	private final BasicEnvironment environment;
75
	private final BasicEnvironment environment;    
74
	
76
    
75
    public AbstractLexer(BasicEnvironment environment, String filename, int tab) throws java.io.IOException 
77
    // Constructor
78
    public AbstractLexer(BasicEnvironment environment) 
76
    {
79
    {
77
        super(filename, tab);
78
        this.environment = environment;
80
        this.environment = environment;
79
    }
81
    }
80
82
81
    public AbstractLexer(BasicEnvironment environment, char[] input_chars, String filename, int tab)
83
	public BasicEnvironment getEnvironment() {
82
    {
84
		return environment;
83
        super(input_chars, filename, tab);
85
	}	
84
        this.environment = environment;
85
    }
86
86
87
    public AbstractLexer(BasicEnvironment environment) {
87
    /**
88
    	setTab(ECLIPSE_TAB_VALUE);
88
	 * Define the input text as a given array of characters.
89
        this.environment = environment;
89
     * @param buffer the characters
90
     * @deprecated clients should use {@link #reset(char[], String)}
91
     */
92
	public void initialize(char[] inputChars) {
93
		/*setInputChars(inputChars);
94
        setStreamLength(inputChars.length);
95
        computeLineOffsets();*/
96
		reset(inputChars, null);
97
	}
98
99
	/**
100
	 * Define the input text by reading from a reader.
101
     * @param reader providing the source text
102
     * @throws IOException if reading fails
103
     * 
104
     * @deprecated clients should invoke {@link #reset(Reader, String)}
105
     */
106
	public void initialize(Reader reader) throws IOException {
107
    	char[] buffer = getInputChars(reader);
108
    	reset(buffer, null);
90
    }
109
    }
91
110
92
	protected int computeErrorCode(int leftToken, int rightToken) {
111
	/**
93
		if (rightToken >= getStreamLength())
112
	 * @param parser the {@link OCLParserStream} instance
94
		    return EOF_CODE;
113
	 * @deprecated clients should invoke {@link #lexer(OCLParserStream)}
95
		else if (leftToken == rightToken)
114
	 * @since 3.0
96
		    return LEX_ERROR_CODE;
115
	 */
97
		else
116
	public void lexToTokens(OCLParserStream parser) {
98
			return INVALID_TOKEN_CODE;
117
		lexer(parser);
99
	}
118
	}
100
119
101
	public BasicEnvironment getEnvironment() {
120
	/**
102
		return environment;
121
	 * @param parser the {@link OCLParserStream} instance
103
	}
122
	 * @deprecated clients should invoke {@link #lexer(Monitor, OCLParserStream)}
104
	
123
	 * @since 3.0
124
	 */
125
	public void lexToTokens(Monitor monitor, OCLParserStream prsStream)
126
    {
127
        lexer(monitor, prsStream);
128
    }
129
130
	// Some methods which will be implemented by the generated lexer
105
	/**
131
	/**
106
	 * Queries the token kinds, as defined by my keyword lexer, of tokens that
132
	 * Queries the token kinds, as defined by my keyword lexer, of tokens that
107
	 * are keywords in by grammar.
133
	 * are keywords in by grammar.
Lines 110-157 Link Here
110
	 * 
136
	 * 
111
	 * @since 1.3
137
	 * @since 1.3
112
	 */
138
	 */
113
    public int [] getKeywordKinds() {
139
    public abstract int [] getKeywordKinds();
114
    	return new int[0];
140
    
115
    }
141
	/**
116
142
	 * @since 3.0
117
	public void lexToTokens(AbstractParser parser) {
143
	 */
118
		lexToTokens(null, parser);
144
	public abstract AbstractLexerStream getILexStream();	
119
	}
120
	
145
	
121
	public abstract void lexToTokens(Monitor monitor, AbstractParser parser);
122
123
	/**
146
	/**
124
	 * Errors generated within the lexer are redirected to the error handler if there is one.
147
	 * @since 3.0
125
	 * 
126
	 * Note that other variants of reportError either feed this one, are fed from a default implementation
127
	 * of this one or originate in the parser, where a ParserErrorHandler can intercept them.
128
	 */
148
	 */
129
	@Override public void reportError(int leftToken, int rightToken) {
149
	public abstract void reset(String filename, int tab) throws java.io.IOException;
130
		BasicEnvironment environment = getEnvironment();
131
		if (environment != null)
132
			environment.lexerError(computeErrorCode(leftToken, rightToken), leftToken, rightToken);
133
		else
134
			super.reportError(leftToken, rightToken);
135
	}
136
150
137
    /**
151
    /**
138
	 * Define the input text as a given array of characters.
152
	 * @since 3.0
139
     * @param buffer the characters
153
	 */
140
     */
154
    public abstract void reset(char[] input_chars, String filename);
141
	public void initialize(char[] inputChars) {
155
  
142
		setInputChars(inputChars);
156
    /**
143
        setStreamLength(inputChars.length);
157
	 * @since 3.0
144
        computeLineOffsets();        
158
	 */
145
	}
159
    public abstract void reset(char[] input_chars, String filename, int tab);
146
160
161
    /**
162
	 * @since 3.0
163
	 */
164
    public abstract void reset(Reader reader, String filename) throws java.io.IOException;
165
    
147
	/**
166
	/**
148
	 * Define the input text by reading from a reader.
167
	 * @since 3.0
149
     * @param reader providing the source text
168
	 */
150
     * @throws IOException if reading fails
169
	public abstract void reset(Reader reader, String filename, int tab) throws java.io.IOException;
151
     */
170
	
152
	public void initialize(Reader reader) throws IOException {
171
    /**
153
    	char[] buffer = getInputChars(reader);
172
	 * @since 3.0
154
    	initialize(buffer);
173
	 */
155
    }
174
    public abstract void lexer(OCLParserStream prsStream);
175
    
176
    /**
177
	 * @since 3.0
178
	 */
179
    public abstract void lexer(Monitor monitor, OCLParserStream prsStream);
180
181
    /**
182
	 * @since 3.0
183
	 */
184
    public abstract void lexer(OCLParserStream prsStream, int start_offset, int end_offset);
185
    
186
    /**
187
	 * @since 3.0
188
	 */
189
    public abstract void lexer(Monitor monitor, OCLParserStream prsStream, int start_offset, int end_offset);
190
    
191
    // We also include some new 3.0 methods in order not to change the template with the @since
192
    /**
193
	 * @since 3.0
194
	 */
195
    public abstract ParseTable getParseTable();
196
    
197
    /**
198
	 * @since 3.0
199
	 */
200
    public abstract LexParser getParser();
201
    
202
    /**
203
	 * @since 3.0
204
	 */
205
    public abstract void resetKeywordLexer();
206
    
207
    /**
208
	 * @since 3.0
209
	 */
210
	public abstract ILexStream getLexStream();
211
	
212
	/**
213
	 * @since 3.0
214
	 */
215
	public abstract void reportLexicalError(int startLoc, int endLoc);
156
}
216
}
157
217
(-)src/org/eclipse/ocl/lpg/AbstractProblemHandler.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.lpg;
18
package org.eclipse.ocl.lpg;
19
19
20
import lpg.lpgjavaruntime.ParseErrorCodes;
20
import lpg.runtime.ParseErrorCodes;
21
21
22
import org.eclipse.emf.common.util.Monitor;
22
import org.eclipse.emf.common.util.Monitor;
23
import org.eclipse.ocl.internal.l10n.OCLMessages;
23
import org.eclipse.ocl.internal.l10n.OCLMessages;
Lines 102-108 Link Here
102
	 */
102
	 */
103
	public void handleProblem(Severity problemSeverity, Phase processingPhase,
103
	public void handleProblem(Severity problemSeverity, Phase processingPhase,
104
			String problemMessage, String processingContext, int startOffset, int endOffset) {
104
			String problemMessage, String processingContext, int startOffset, int endOffset) {
105
		int lineNumber = parser.getTokenAtCharacter(startOffset).getLine();
105
		int lineNumber = parser.getIPrsStream().getTokenAtCharacter(startOffset).getLine();
106
		String message = OCLMessages.bind(
106
		String message = OCLMessages.bind(
107
				OCLMessages.ProblemMessage_ERROR_,
107
				OCLMessages.ProblemMessage_ERROR_,
108
				new Object[] {
108
				new Object[] {
(-)model/OCLCST.ecore (-1 / +1 lines)
Lines 15-21 Link Here
15
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
15
          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
16
          transient="true"/>
16
          transient="true"/>
17
    </eClassifiers>
17
    </eClassifiers>
18
    <eClassifiers xsi:type="ecore:EDataType" name="IToken" instanceClassName="lpg.lpgjavaruntime.IToken"/>
18
    <eClassifiers xsi:type="ecore:EDataType" name="IToken" instanceClassName="lpg.runtime.IToken"/>
19
    <eClassifiers xsi:type="ecore:EClass" name="PackageDeclarationCS" eSuperTypes="#//cst/CSTNode">
19
    <eClassifiers xsi:type="ecore:EClass" name="PackageDeclarationCS" eSuperTypes="#//cst/CSTNode">
20
      <eStructuralFeatures xsi:type="ecore:EReference" name="pathNameCS" eType="#//cst/PathNameCS"
20
      <eStructuralFeatures xsi:type="ecore:EReference" name="pathNameCS" eType="#//cst/PathNameCS"
21
          containment="true"/>
21
          containment="true"/>
(-)model/OCLCST.uml (-1 / +1 lines)
Lines 874-880 Link Here
874
  <Ecore:EClass xmi:id="_qf-8J_8fEduhWtVvKtiQ7w" base_Class="_qdx-Vf8fEduhWtVvKtiQ7w"/>
874
  <Ecore:EClass xmi:id="_qf-8J_8fEduhWtVvKtiQ7w" base_Class="_qdx-Vf8fEduhWtVvKtiQ7w"/>
875
  <Ecore:EClass xmi:id="_qf-8KP8fEduhWtVvKtiQ7w" base_Class="_qdx-V_8fEduhWtVvKtiQ7w"/>
875
  <Ecore:EClass xmi:id="_qf-8KP8fEduhWtVvKtiQ7w" base_Class="_qdx-V_8fEduhWtVvKtiQ7w"/>
876
  <Ecore:EAttribute xmi:id="_qf-8Kf8fEduhWtVvKtiQ7w" base_Property="_qdx-Wf8fEduhWtVvKtiQ7w"/>
876
  <Ecore:EAttribute xmi:id="_qf-8Kf8fEduhWtVvKtiQ7w" base_Property="_qdx-Wf8fEduhWtVvKtiQ7w"/>
877
  <Ecore:EDataType xmi:id="_wn-44I2FEd2mlKUM3HGxZg" instanceClassName="lpg.lpgjavaruntime.IToken" base_PrimitiveType="_tvVQwI2FEd2mlKUM3HGxZg"/>
877
  <Ecore:EDataType xmi:id="_wn-44I2FEd2mlKUM3HGxZg" instanceClassName="lpg.runtime.IToken" base_PrimitiveType="_tvVQwI2FEd2mlKUM3HGxZg"/>
878
  <Ecore:EAttribute xmi:id="_qkehgI2JEd2mlKUM3HGxZg" isTransient="true" base_Property="_PkTnII2GEd2mlKUM3HGxZg"/>
878
  <Ecore:EAttribute xmi:id="_qkehgI2JEd2mlKUM3HGxZg" isTransient="true" base_Property="_PkTnII2GEd2mlKUM3HGxZg"/>
879
  <Ecore:EAttribute xmi:id="_na5BwI2GEd2mlKUM3HGxZg" isTransient="true" base_Property="_kTt1cI2GEd2mlKUM3HGxZg"/>
879
  <Ecore:EAttribute xmi:id="_na5BwI2GEd2mlKUM3HGxZg" isTransient="true" base_Property="_kTt1cI2GEd2mlKUM3HGxZg"/>
880
  <Ecore:EAttribute xmi:id="_CoEkwI2HEd2mlKUM3HGxZg" isTransient="true" base_Property="_xJpmEI2GEd2mlKUM3HGxZg"/>
880
  <Ecore:EAttribute xmi:id="_CoEkwI2HEd2mlKUM3HGxZg" isTransient="true" base_Property="_xJpmEI2GEd2mlKUM3HGxZg"/>
(-)src/org/eclipse/ocl/parser/OCLProblemHandler.java (-14 / +23 lines)
Lines 17-22 Link Here
17
 */
17
 */
18
package org.eclipse.ocl.parser;
18
package org.eclipse.ocl.parser;
19
19
20
import lpg.runtime.IPrsStream;
21
20
import org.eclipse.emf.common.util.BasicDiagnostic;
22
import org.eclipse.emf.common.util.BasicDiagnostic;
21
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.Diagnostic;
22
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.DiagnosticChain;
Lines 81-97 Link Here
81
	@Override
83
	@Override
82
	public void lexerProblem(Severity problemSeverity, String problemMessage,
84
	public void lexerProblem(Severity problemSeverity, String problemMessage,
83
			String processingContext, int startOffset, int endOffset) {
85
			String processingContext, int startOffset, int endOffset) {
84
		int leftToken = getParser().getTokenIndexAtCharacter(startOffset);
86
		int leftToken = getIPrsStream().getTokenIndexAtCharacter(startOffset);
85
		if (leftToken < 0) {
87
		if (leftToken < 0) {
86
            leftToken = -leftToken;
88
            leftToken = -leftToken;
87
        }
89
        }
88
		String message = problemMessage
90
		String message = problemMessage
89
	             		+ " (" + getParser().getKind(leftToken) + ") : "  //$NON-NLS-1$//$NON-NLS-2$
91
	             		+ " (" + getIPrsStream().getKind(leftToken) + ") : "  //$NON-NLS-1$//$NON-NLS-2$
90
	             		+ getParser().getStartOffset(leftToken)
92
	             		+ getIPrsStream().getStartOffset(leftToken)
91
	             		+ ":" + getParser().getLineNumberOfTokenAt(leftToken) //$NON-NLS-1$
93
	             		+ ":" + getIPrsStream().getLineNumberOfTokenAt(leftToken) //$NON-NLS-1$
92
	             		+ ":" + getParser().getColumnOfTokenAt(leftToken) //$NON-NLS-1$
94
	             		+ ":" + getIPrsStream().getColumnOfTokenAt(leftToken) //$NON-NLS-1$
93
	             		+ ":" + getParser().getTokenLength(leftToken) //$NON-NLS-1$
95
	             		+ ":" + getIPrsStream().getTokenLength(leftToken) //$NON-NLS-1$
94
	             		+ " " + getParser().getTokenText(leftToken); //$NON-NLS-1$
96
	             		+ " " + getIPrsStream().getTokenText(leftToken); //$NON-NLS-1$
95
		handleProblem(problemSeverity, Phase.LEXER, message,
97
		handleProblem(problemSeverity, Phase.LEXER, message,
96
				processingContext, startOffset, endOffset);
98
				processingContext, startOffset, endOffset);
97
	}
99
	}
Lines 99-120 Link Here
99
	@Override
101
	@Override
100
	public void parserProblem(Severity problemSeverity, String problemMessage,
102
	public void parserProblem(Severity problemSeverity, String problemMessage,
101
			String processingContext, int startOffset, int endOffset) {
103
			String processingContext, int startOffset, int endOffset) {
102
		int leftToken = getParser().getTokenIndexAtCharacter(startOffset);
104
		int leftToken = getIPrsStream().getTokenIndexAtCharacter(startOffset);
103
		int rightToken = getParser().getTokenIndexAtCharacter(endOffset);
105
		int rightToken = getIPrsStream().getTokenIndexAtCharacter(endOffset);
104
		int leftTokenLoc = (leftToken > rightToken ? rightToken : leftToken);
106
		int leftTokenLoc = (leftToken > rightToken ? rightToken : leftToken);
105
		int rightTokenLoc = rightToken;
107
		int rightTokenLoc = rightToken;
106
	    int line = getParser().getLine(leftTokenLoc) + getErrorReportLineOffset();
108
	    int line = getIPrsStream().getLine(leftTokenLoc) + getErrorReportLineOffset();
107
	    if (line > 0) {
109
	    if (line > 0) {
108
			String locInfo = OCLMessages.bind(OCLMessages.ErrorReport_RowColumn,
110
			String locInfo = OCLMessages.bind(OCLMessages.ErrorReport_RowColumn,
109
					new Object[]{
111
					new Object[]{
110
						new Integer((getParser().getLine(leftTokenLoc) + getErrorReportLineOffset())),
112
						new Integer((getIPrsStream().getLine(leftTokenLoc) + getErrorReportLineOffset())),
111
						new Integer(getParser().getColumn(leftTokenLoc)),
113
						new Integer(getIPrsStream().getColumn(leftTokenLoc)),
112
						new Integer((getParser().getEndLine(rightTokenLoc) + getErrorReportLineOffset())),
114
						new Integer((getIPrsStream().getEndLine(rightTokenLoc) + getErrorReportLineOffset())),
113
						new Integer(getParser().getEndColumn(rightTokenLoc))
115
						new Integer(getIPrsStream().getEndColumn(rightTokenLoc))
114
				});
116
				});
115
			problemMessage = locInfo + " " + problemMessage; //$NON-NLS-1$
117
			problemMessage = locInfo + " " + problemMessage; //$NON-NLS-1$
116
	    }
118
	    }
117
	    handleProblem(problemSeverity, Phase.PARSER, problemMessage,
119
	    handleProblem(problemSeverity, Phase.PARSER, problemMessage,
118
				processingContext, startOffset, endOffset);
120
				processingContext, startOffset, endOffset);
119
	}
121
	}
122
	
123
	/**
124
	 * @since 3.0
125
	 */
126
	protected IPrsStream getIPrsStream() {
127
		return getParser().getIPrsStream();
128
	}
120
}
129
}
(-)src/org/eclipse/ocl/parser/OCLParser.g
Lines 1-7 Link Here
1
--/**
1
--/**
2
-- * <copyright>
2
-- * <copyright>
3
-- *
3
-- *
(-)* Copyright (c) 2005, 2009 IBM Corporation and others. (-66 / +62 lines)
Lines 11-16 Link Here
11
-- *   IBM - Initial API and implementation
11
-- *   IBM - Initial API and implementation
12
-- *   E.D. Willink - Elimination of some shift-reduce conflicts
12
-- *   E.D. Willink - Elimination of some shift-reduce conflicts
13
-- *      - Bug 259818
13
-- *      - Bug 259818
14
-- *   Adolfo Sanchez- Barbudo Herrera - LPG v 2.0.17 adoption
14
-- *
15
-- *
15
-- * </copyright>
16
-- * </copyright>
16
-- *
17
-- *
Lines 22-55 Link Here
22
23
23
%options escape=$
24
%options escape=$
24
%options la=2
25
%options la=2
25
%options table=java
26
%options fp=OCLParser,prefix=TK_
26
%options fp=OCLParser,prefix=TK_
27
%options error-maps
28
%options scopes
29
%options margin=4
30
%options noserialize
27
%options noserialize
31
%options package=org.eclipse.ocl.parser
28
%options package=org.eclipse.ocl.parser
32
%options import_terminals=OCLLexer.g
29
%options import_terminals=OCLLexer.gi
33
%options ast_type=CSTNode
30
%options ast_type=CSTNode
34
%options programming_language=java
31
%options ParseTable=lpg.runtime.ParseTable
35
%options action=("*.java", "/.", "./")
32
%options template=dtParserTemplateF.gi
36
%options ParseTable=lpg.lpgjavaruntime.ParseTable
37
%options include_directory=".;../lpg"
33
%options include_directory=".;../lpg"
38
34
39
$Start
35
%Start
40
	goal
36
	goal
41
$End
37
%End
42
38
43
$Include
39
%Import
44
	EssentialOCL.g
40
	EssentialOCL.gi
45
$End
41
%End
46
42
47
$Define
43
%Define
48
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
44
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
49
	$lex_stream_class /.OCLLexer./
45
	$lex_stream_class /.OCLLexer./
50
$End
46
%End
51
47
52
$Globals
48
%Globals
53
	/.
49
	/.
54
	import org.eclipse.ocl.Environment;
50
	import org.eclipse.ocl.Environment;
55
	import org.eclipse.ocl.cst.DefExpressionCS;
51
	import org.eclipse.ocl.cst.DefExpressionCS;
Lines 59-67 Link Here
59
	import org.eclipse.ocl.cst.PackageDeclarationCS;
55
	import org.eclipse.ocl.cst.PackageDeclarationCS;
60
	import org.eclipse.ocl.cst.PrePostOrBodyEnum;
56
	import org.eclipse.ocl.cst.PrePostOrBodyEnum;
61
	./
57
	./
62
$End
58
%End
63
59
64
$KeyWords
60
%KeyWords
65
	context
61
	context
66
	package
62
	package
67
	
63
	
Lines 71-79 Link Here
71
	--
67
	--
72
	attr
68
	attr
73
	oper
69
	oper
74
$End
70
%End
75
71
76
$Rules
72
%Rules
77
	-- opt = optional
73
	-- opt = optional
78
	-- m = multiple
74
	-- m = multiple
79
	
75
	
Lines 83-138 Link Here
83
	goal -> prePostOrBodyDeclCS
79
	goal -> prePostOrBodyDeclCS
84
	goal -> initOrDerValueCS
80
	goal -> initOrDerValueCS
85
	goal -> variableCS
81
	goal -> variableCS
86
	goal -> $empty	
82
	goal -> %empty	
87
83
88
	packageDeclarationCSm -> packageDeclarationCS
84
	packageDeclarationCSm -> packageDeclarationCS
89
	packageDeclarationCSm ::= packageDeclarationCSm packageDeclarationCS
85
	packageDeclarationCSm ::= packageDeclarationCSm packageDeclarationCS
90
		/.$BeginJava
86
		/.$BeginCode
91
					PackageDeclarationCS result = (PackageDeclarationCS)$getSym(2);
87
					PackageDeclarationCS result = (PackageDeclarationCS)$getSym(2);
92
					result.setPackageDeclarationCS((PackageDeclarationCS) $getSym(1));
88
					result.setPackageDeclarationCS((PackageDeclarationCS) $getSym(1));
93
					$setResult(result);
89
					$setResult(result);
94
		  $EndJava
90
		  $EndCode
95
		./
91
		./
96
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt endpackage
92
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt endpackage
97
		/.$BeginJava
93
		/.$BeginCode
98
					CSTNode result = createPackageDeclarationCS(
94
					CSTNode result = createPackageDeclarationCS(
99
							(PathNameCS)$getSym(2),
95
							(PathNameCS)$getSym(2),
100
							(EList)$getSym(3)
96
							(EList)$getSym(3)
101
						);
97
						);
102
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
98
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
103
					$setResult(result);
99
					$setResult(result);
104
		  $EndJava
100
		  $EndCode
105
		./
101
		./
106
	
102
	
107
	packageDeclarationCS1 ::= contextDeclCSm
103
	packageDeclarationCS1 ::= contextDeclCSm
108
		/.$BeginJava
104
		/.$BeginCode
109
					EList contextDecls = (EList)$getSym(1);
105
					EList contextDecls = (EList)$getSym(1);
110
					CSTNode result = createPackageDeclarationCS(null, contextDecls);
106
					CSTNode result = createPackageDeclarationCS(null, contextDecls);
111
					if (!contextDecls.isEmpty()) {
107
					if (!contextDecls.isEmpty()) {
112
						setOffsets(result, (CSTNode)contextDecls.get(0), (CSTNode)contextDecls.get(contextDecls.size()-1));
108
						setOffsets(result, (CSTNode)contextDecls.get(0), (CSTNode)contextDecls.get(contextDecls.size()-1));
113
					}
109
					}
114
					$setResult(result);
110
					$setResult(result);
115
		  $EndJava
111
		  $EndCode
116
		./
112
		./
117
113
118
114
119
	contextDeclCSmopt ::= $empty
115
	contextDeclCSmopt ::= %empty
120
		/.$EmptyListAction./
116
		/.$EmptyListAction./
121
	contextDeclCSmopt -> contextDeclCSm
117
	contextDeclCSmopt -> contextDeclCSm
122
118
123
	contextDeclCSm ::= contextDeclCS
119
	contextDeclCSm ::= contextDeclCS
124
		/.$BeginJava
120
		/.$BeginCode
125
					EList result = new BasicEList();
121
					EList result = new BasicEList();
126
					result.add($getSym(1));
122
					result.add($getSym(1));
127
					$setResult(result);
123
					$setResult(result);
128
		  $EndJava
124
		  $EndCode
129
		./
125
		./
130
	contextDeclCSm ::= contextDeclCSm contextDeclCS
126
	contextDeclCSm ::= contextDeclCSm contextDeclCS
131
		/.$BeginJava
127
		/.$BeginCode
132
					EList result = (EList)$getSym(1);
128
					EList result = (EList)$getSym(1);
133
					result.add($getSym(2));
129
					result.add($getSym(2));
134
					$setResult(result);
130
					$setResult(result);
135
		  $EndJava
131
		  $EndCode
136
		./
132
		./
137
133
138
	contextDeclCS -> classifierContextDeclCS
134
	contextDeclCS -> classifierContextDeclCS
Lines 140-146 Link Here
140
	contextDeclCS -> propertyContextCS
136
	contextDeclCS -> propertyContextCS
141
137
142
	propertyContextCS ::= context pathNameCS '::' simpleNameCS ':' typeCS initOrDerValueCS
138
	propertyContextCS ::= context pathNameCS '::' simpleNameCS ':' typeCS initOrDerValueCS
143
		/.$BeginJava
139
		/.$BeginCode
144
					CSTNode result = createPropertyContextCS(
140
					CSTNode result = createPropertyContextCS(
145
							(PathNameCS)$getSym(2),
141
							(PathNameCS)$getSym(2),
146
							(SimpleNameCS)$getSym(4),
142
							(SimpleNameCS)$getSym(4),
Lines 149-159 Link Here
149
						);
145
						);
150
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(7));
146
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(7));
151
					$setResult(result);
147
					$setResult(result);
152
		  $EndJava
148
		  $EndCode
153
		./
149
		./
154
150
155
	initOrDerValueCS ::= initOrDerValueCSopt init ':' oclExpressionCS
151
	initOrDerValueCS ::= initOrDerValueCSopt init ':' oclExpressionCS
156
		/.$BeginJava
152
		/.$BeginCode
157
					CSTNode result = createInitValueCS(
153
					CSTNode result = createInitValueCS(
158
							(InitOrDerValueCS)$getSym(1),
154
							(InitOrDerValueCS)$getSym(1),
159
							(OCLExpressionCS)$getSym(4)
155
							(OCLExpressionCS)$getSym(4)
Lines 164-174 Link Here
164
						setOffsets(result, getIToken($getToken(2)), (CSTNode)$getSym(4));
160
						setOffsets(result, getIToken($getToken(2)), (CSTNode)$getSym(4));
165
					}
161
					}
166
					$setResult(result);
162
					$setResult(result);
167
		  $EndJava
163
		  $EndCode
168
		./
164
		./
169
165
170
	initOrDerValueCS ::= initOrDerValueCSopt derive ':' oclExpressionCS
166
	initOrDerValueCS ::= initOrDerValueCSopt derive ':' oclExpressionCS
171
		/.$BeginJava
167
		/.$BeginCode
172
					CSTNode result = createDerValueCS(
168
					CSTNode result = createDerValueCS(
173
							(InitOrDerValueCS)$getSym(1),
169
							(InitOrDerValueCS)$getSym(1),
174
							(OCLExpressionCS)$getSym(4)
170
							(OCLExpressionCS)$getSym(4)
Lines 179-193 Link Here
179
						setOffsets(result, getIToken($getToken(2)), (CSTNode)$getSym(4));
175
						setOffsets(result, getIToken($getToken(2)), (CSTNode)$getSym(4));
180
					}
176
					}
181
					$setResult(result);
177
					$setResult(result);
182
		  $EndJava
178
		  $EndCode
183
		./
179
		./
184
180
185
	initOrDerValueCSopt ::= $empty
181
	initOrDerValueCSopt ::= %empty
186
		/.$NullAction./
182
		/.$NullAction./
187
	initOrDerValueCSopt -> initOrDerValueCS
183
	initOrDerValueCSopt -> initOrDerValueCS
188
184
189
	classifierContextDeclCS ::= context pathNameCS invOrDefCSm
185
	classifierContextDeclCS ::= context pathNameCS invOrDefCSm
190
		/.$BeginJava
186
		/.$BeginCode
191
					EList<InvOrDefCS> list = (EList<InvOrDefCS>)$getSym(3);
187
					EList<InvOrDefCS> list = (EList<InvOrDefCS>)$getSym(3);
192
					CSTNode result = createClassifierContextDeclCS(
188
					CSTNode result = createClassifierContextDeclCS(
193
							(PathNameCS)$getSym(2),
189
							(PathNameCS)$getSym(2),
Lines 195-241 Link Here
195
						);
191
						);
196
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
192
					setOffsets(result, getIToken($getToken(1)), list.get(list.size()-1));
197
					$setResult(result);
193
					$setResult(result);
198
		  $EndJava
194
		  $EndCode
199
		./
195
		./
200
196
201
	invOrDefCSm ::= invOrDefCS
197
	invOrDefCSm ::= invOrDefCS
202
		/.$BeginJava
198
		/.$BeginCode
203
					EList<InvOrDefCS> result = new BasicEList<InvOrDefCS>();
199
					EList<InvOrDefCS> result = new BasicEList<InvOrDefCS>();
204
					result.add((InvOrDefCS)$getSym(1));
200
					result.add((InvOrDefCS)$getSym(1));
205
					$setResult(result);
201
					$setResult(result);
206
		  $EndJava
202
		  $EndCode
207
		./
203
		./
208
	invOrDefCSm ::= invOrDefCSm invOrDefCS
204
	invOrDefCSm ::= invOrDefCSm invOrDefCS
209
		/.$BeginJava
205
		/.$BeginCode
210
					EList<InvOrDefCS> result = (EList<InvOrDefCS>)$getSym(1);
206
					EList<InvOrDefCS> result = (EList<InvOrDefCS>)$getSym(1);
211
					result.add((InvOrDefCS)$getSym(2));
207
					result.add((InvOrDefCS)$getSym(2));
212
					$setResult(result);
208
					$setResult(result);
213
		  $EndJava
209
		  $EndCode
214
		./
210
		./
215
	invOrDefCS ::= inv simpleNameCSopt ':' oclExpressionCS
211
	invOrDefCS ::= inv simpleNameCSopt ':' oclExpressionCS
216
		/.$BeginJava
212
		/.$BeginCode
217
					CSTNode result = createInvCS(
213
					CSTNode result = createInvCS(
218
							(SimpleNameCS)$getSym(2),
214
							(SimpleNameCS)$getSym(2),
219
							(OCLExpressionCS)$getSym(4)
215
							(OCLExpressionCS)$getSym(4)
220
						);
216
						);
221
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
217
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
222
					$setResult(result);
218
					$setResult(result);
223
		  $EndJava
219
		  $EndCode
224
		./
220
		./
225
	
221
	
226
	invOrDefCS ::= def simpleNameCSopt ':' defExpressionCS
222
	invOrDefCS ::= def simpleNameCSopt ':' defExpressionCS
227
		/.$BeginJava
223
		/.$BeginCode
228
					CSTNode result = createDefCS(
224
					CSTNode result = createDefCS(
229
							(SimpleNameCS)$getSym(2),
225
							(SimpleNameCS)$getSym(2),
230
							(DefExpressionCS)$getSym(4)
226
							(DefExpressionCS)$getSym(4)
231
						);
227
						);
232
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
228
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
233
					$setResult(result);
229
					$setResult(result);
234
		  $EndJava
230
		  $EndCode
235
		./
231
		./
236
232
237
	defExpressionCS ::= typedVariableCS '=' oclExpressionCS
233
	defExpressionCS ::= typedVariableCS '=' oclExpressionCS
238
		/.$BeginJava
234
		/.$BeginCode
239
					VariableCS variableCS = (VariableCS)$getSym(1);
235
					VariableCS variableCS = (VariableCS)$getSym(1);
240
					OCLExpressionCS expressionCS = (OCLExpressionCS)$getSym(3);
236
					OCLExpressionCS expressionCS = (OCLExpressionCS)$getSym(3);
241
					CSTNode result = createDefExpressionCS(
237
					CSTNode result = createDefExpressionCS(
Lines 245-254 Link Here
245
						);
241
						);
246
					setOffsets(result, variableCS, expressionCS);
242
					setOffsets(result, variableCS, expressionCS);
247
					$setResult(result);
243
					$setResult(result);
248
		  $EndJava
244
		  $EndCode
249
		./
245
		./
250
	defExpressionCS ::= operationCS1 '=' oclExpressionCS
246
	defExpressionCS ::= operationCS1 '=' oclExpressionCS
251
		/.$BeginJava
247
		/.$BeginCode
252
					CSTNode result = createDefExpressionCS(
248
					CSTNode result = createDefExpressionCS(
253
							null,
249
							null,
254
							(OperationCS)$getSym(1),
250
							(OperationCS)$getSym(1),
Lines 256-266 Link Here
256
						);
252
						);
257
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
253
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
258
					$setResult(result);
254
					$setResult(result);
259
		  $EndJava
255
		  $EndCode
260
		./
256
		./
261
257
262
	operationContextDeclCS ::= context operationCS2 prePostOrBodyDeclCSm
258
	operationContextDeclCS ::= context operationCS2 prePostOrBodyDeclCSm
263
		/.$BeginJava
259
		/.$BeginCode
264
					EList prePostOrBodyDecls = (EList)$getSym(3);
260
					EList prePostOrBodyDecls = (EList)$getSym(3);
265
					CSTNode result = createOperationContextDeclCS(
261
					CSTNode result = createOperationContextDeclCS(
266
							(OperationCS)$getSym(2),
262
							(OperationCS)$getSym(2),
Lines 268-293 Link Here
268
						);
264
						);
269
					setOffsets(result, getIToken($getToken(1)), (CSTNode)prePostOrBodyDecls.get(prePostOrBodyDecls.size()-1));
265
					setOffsets(result, getIToken($getToken(1)), (CSTNode)prePostOrBodyDecls.get(prePostOrBodyDecls.size()-1));
270
					$setResult(result);
266
					$setResult(result);
271
		  $EndJava
267
		  $EndCode
272
		./
268
		./
273
269
274
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCS
270
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCS
275
		/.$BeginJava
271
		/.$BeginCode
276
					EList result = new BasicEList();
272
					EList result = new BasicEList();
277
					result.add($getSym(1));
273
					result.add($getSym(1));
278
					$setResult(result);
274
					$setResult(result);
279
		  $EndJava
275
		  $EndCode
280
		./
276
		./
281
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCSm prePostOrBodyDeclCS
277
	prePostOrBodyDeclCSm ::= prePostOrBodyDeclCSm prePostOrBodyDeclCS
282
		/.$BeginJava
278
		/.$BeginCode
283
					EList result = (EList)$getSym(1);
279
					EList result = (EList)$getSym(1);
284
					result.add($getSym(2));
280
					result.add($getSym(2));
285
					$setResult(result);
281
					$setResult(result);
286
		  $EndJava
282
		  $EndCode
287
		./
283
		./
288
284
289
	prePostOrBodyDeclCS ::= pre simpleNameCSopt ':' oclExpressionCS
285
	prePostOrBodyDeclCS ::= pre simpleNameCSopt ':' oclExpressionCS
290
		/.$BeginJava
286
		/.$BeginCode
291
					CSTNode result = createPrePostOrBodyDeclCS(
287
					CSTNode result = createPrePostOrBodyDeclCS(
292
							PrePostOrBodyEnum.PRE_LITERAL,
288
							PrePostOrBodyEnum.PRE_LITERAL,
293
							(SimpleNameCS)$getSym(2),
289
							(SimpleNameCS)$getSym(2),
Lines 295-304 Link Here
295
						);
291
						);
296
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
292
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
297
					$setResult(result);
293
					$setResult(result);
298
		  $EndJava
294
		  $EndCode
299
		./
295
		./
300
	prePostOrBodyDeclCS ::= post simpleNameCSopt ':' oclExpressionCS
296
	prePostOrBodyDeclCS ::= post simpleNameCSopt ':' oclExpressionCS
301
		/.$BeginJava
297
		/.$BeginCode
302
					CSTNode result = createPrePostOrBodyDeclCS(
298
					CSTNode result = createPrePostOrBodyDeclCS(
303
							PrePostOrBodyEnum.POST_LITERAL,
299
							PrePostOrBodyEnum.POST_LITERAL,
304
							(SimpleNameCS)$getSym(2),
300
							(SimpleNameCS)$getSym(2),
Lines 306-315 Link Here
306
						);
302
						);
307
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
303
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
308
					$setResult(result);
304
					$setResult(result);
309
		  $EndJava
305
		  $EndCode
310
		./
306
		./
311
	prePostOrBodyDeclCS ::= body simpleNameCSopt ':' oclExpressionCS
307
	prePostOrBodyDeclCS ::= body simpleNameCSopt ':' oclExpressionCS
312
		/.$BeginJava
308
		/.$BeginCode
313
					CSTNode result = createPrePostOrBodyDeclCS(
309
					CSTNode result = createPrePostOrBodyDeclCS(
314
							PrePostOrBodyEnum.BODY_LITERAL,
310
							PrePostOrBodyEnum.BODY_LITERAL,
315
							(SimpleNameCS)$getSym(2),
311
							(SimpleNameCS)$getSym(2),
Lines 317-322 Link Here
317
						);
313
						);
318
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
314
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
319
					$setResult(result);
315
					$setResult(result);
320
		  $EndJava
316
		  $EndCode
321
		./
317
		./
322
$End
318
%End
(-)src/org/eclipse/ocl/parser/OCLAnalyzer.java (-4 / +4 lines)
Lines 86-95 Link Here
86
	 * @param environment
86
	 * @param environment
87
	 *            the symbolic and problem handling environment
87
	 *            the symbolic and problem handling environment
88
	 */
88
	 */
89
	public OCLAnalyzer(
89
	/*public OCLAnalyzer(
90
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> environment) {
90
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> environment) {
91
		this(new OCLParser(new OCLLexer(environment)));
91
		this(new OCLParser(new OCLLexer(environment)));
92
	}
92
	}*/
93
93
94
	/**
94
	/**
95
	 * Construct an OCL semantic analyzer with default syntactic and lexical
95
	 * Construct an OCL semantic analyzer with default syntactic and lexical
Lines 105-111 Link Here
105
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> environment,
105
			Environment<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> environment,
106
			String text) {
106
			String text) {
107
		this(new OCLParser(new OCLLexer(environment, text.toCharArray())));
107
		this(new OCLParser(new OCLLexer(environment, text.toCharArray())));
108
		getLexer().lexToTokens(getAbstractParser());
108
		getLexer().lexer(getAbstractParser().getIPrsStream());
109
	}
109
	}
110
110
111
	/**
111
	/**
Lines 137-143 Link Here
137
	 * @return the parsed CST, or <code>null</code> if it could not be parsed
137
	 * @return the parsed CST, or <code>null</code> if it could not be parsed
138
	 */
138
	 */
139
	public CSTNode parseConcreteSyntax() {
139
	public CSTNode parseConcreteSyntax() {
140
		return getAbstractParser().parseTokensToCST();
140
		return getAbstractParser().parser();
141
	}
141
	}
142
142
143
	/**
143
	/**
(-)src/org/eclipse/ocl/parser/AbstractOCLParser.java (-20 / +12 lines)
Lines 20-31 Link Here
20
 */
20
 */
21
package org.eclipse.ocl.parser;
21
package org.eclipse.ocl.parser;
22
22
23
import lpg.lpgjavaruntime.IToken;
23
import lpg.runtime.IToken;
24
import lpg.lpgjavaruntime.NullExportedSymbolsException;
24
import lpg.runtime.ParseErrorCodes;
25
import lpg.lpgjavaruntime.NullTerminalSymbolsException;
26
import lpg.lpgjavaruntime.ParseErrorCodes;
27
import lpg.lpgjavaruntime.UndefinedEofSymbolException;
28
import lpg.lpgjavaruntime.UnimplementedTerminalsException;
29
25
30
import org.eclipse.emf.common.util.EList;
26
import org.eclipse.emf.common.util.EList;
31
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
27
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
Lines 82-102 Link Here
82
import org.eclipse.ocl.internal.l10n.OCLMessages;
78
import org.eclipse.ocl.internal.l10n.OCLMessages;
83
import org.eclipse.ocl.lpg.AbstractLexer;
79
import org.eclipse.ocl.lpg.AbstractLexer;
84
import org.eclipse.ocl.lpg.AbstractParser;
80
import org.eclipse.ocl.lpg.AbstractParser;
85
import org.eclipse.ocl.lpg.BasicEnvironment;
86
import org.eclipse.ocl.lpg.ProblemHandler;
81
import org.eclipse.ocl.lpg.ProblemHandler;
87
import org.eclipse.ocl.options.ParsingOptions;
82
import org.eclipse.ocl.options.ParsingOptions;
88
import org.eclipse.ocl.options.ProblemOption;
83
import org.eclipse.ocl.options.ProblemOption;
89
84
85
90
public abstract class AbstractOCLParser
86
public abstract class AbstractOCLParser
91
		extends AbstractParser {
87
		extends AbstractParser {
92
	
88
	
93
	public AbstractOCLParser(BasicEnvironment environment) {
89
	public AbstractOCLParser(AbstractLexer lexer) {
94
		super(environment);
90
		super(lexer);
95
	}
91
		/*super(lexStream);
96
97
	@SuppressWarnings("nls")
98
	public AbstractOCLParser(AbstractLexer lexStream) {
99
		super(lexStream);
100
92
101
		try {
93
		try {
102
			super.remapTerminalSymbols(orderedTerminalSymbols(),
94
			super.remapTerminalSymbols(orderedTerminalSymbols(),
Lines 118-124 Link Here
118
			throw new RuntimeException(
110
			throw new RuntimeException(
119
				"The Lexer does not implement the Eof symbol "
111
				"The Lexer does not implement the Eof symbol "
120
					+ OCLParsersym.orderedTerminalSymbols[OCLParserprs.EOFT_SYMBOL]);
112
					+ OCLParsersym.orderedTerminalSymbols[OCLParserprs.EOFT_SYMBOL]);
121
		}
113
		}*/
122
	}
114
	}
123
	
115
	
124
	protected PackageDeclarationCS createPackageDeclarationCS(
116
	protected PackageDeclarationCS createPackageDeclarationCS(
Lines 718-724 Link Here
718
	 * @param stringLiteral a string literal token with escape notation 
710
	 * @param stringLiteral a string literal token with escape notation 
719
	 * @return the unescaped string
711
	 * @return the unescaped string
720
	 * 
712
	 * 
721
	 * @since 1.3
713
	 * @since 3.0
722
	 */
714
	 */
723
	protected String unescape(IToken stringLiteral) {
715
	protected String unescape(IToken stringLiteral) {
724
		String rawString = stringLiteral.toString();
716
		String rawString = stringLiteral.toString();
Lines 741-749 Link Here
741
				}
733
				}
742
				i++;
734
				i++;
743
				if (i >= n) {
735
				if (i >= n) {
744
					reportError(
736
					getIPrsStream().reportError(
745
						ParseErrorCodes.INVALID_CODE,
737
						ParseErrorCodes.INVALID_CODE,
746
						"", stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(), //$NON-NLS-1$
738
						stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(),
747
						OCLMessages.StringNotProperlyClosed_ERROR);
739
						OCLMessages.StringNotProperlyClosed_ERROR);
748
				}
740
				}
749
				char nextCh = rawString.charAt(i);
741
				char nextCh = rawString.charAt(i);
Lines 810-818 Link Here
810
									.append((char) unescapedChar);
802
									.append((char) unescapedChar);
811
							}
803
							}
812
							if (unescapedChar < 0) {
804
							if (unescapedChar < 0) {
813
								reportError(
805
								getIPrsStream().reportError(
814
									ParseErrorCodes.INVALID_CODE,
806
									ParseErrorCodes.INVALID_CODE,
815
									"", stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(), //$NON-NLS-1$
807
									stringLiteral.getTokenIndex(), stringLiteral.getTokenIndex(),
816
									OCLMessages.InvalidEscapeSequence_ERROR);
808
									OCLMessages.InvalidEscapeSequence_ERROR);
817
							}
809
							}
818
							break;
810
							break;
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 32-38 Link Here
32
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
32
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
33
 org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
33
 org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
34
 org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
34
 org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
35
 net.sourceforge.lpg.lpgjavaruntime;version="[1.0.0,1.2.0)";visibility:=reexport
35
 lpg.runtime;bundle-version="2.0.17";visibility:=reexport
36
Bundle-Activator: org.eclipse.ocl.internal.OCLPlugin$Implementation
36
Bundle-Activator: org.eclipse.ocl.internal.OCLPlugin$Implementation
37
Eclipse-LazyStart: true
37
Eclipse-LazyStart: true
38
Bundle-ActivationPolicy: lazy
38
Bundle-ActivationPolicy: lazy
(-)src/org/eclipse/ocl/util/TypeUtil.java (-1 / +2 lines)
Lines 12-18 Link Here
12
 *   E.D.Willink - Refactoring to support extensibility and flexible error handling
12
 *   E.D.Willink - Refactoring to support extensibility and flexible error handling
13
 *   Zeligsoft - Bugs 244886, 245619, 233673, 179990, 242236
13
 *   Zeligsoft - Bugs 244886, 245619, 233673, 179990, 242236
14
 *   Stefan Schulze - Bug 245619
14
 *   Stefan Schulze - Bug 245619
15
 *   Adolfo Sánchez-Barbudo Herrera - Bug 233673
15
 *   Adolfo Sanchez-Barbudo Herrera - Bug 233673
16
 * 
16
 * 
17
 * </copyright>
17
 * </copyright>
18
 * 
18
 * 
Lines 33-38 Link Here
33
import org.eclipse.ocl.SemanticException;
33
import org.eclipse.ocl.SemanticException;
34
import org.eclipse.ocl.TypeChecker;
34
import org.eclipse.ocl.TypeChecker;
35
import org.eclipse.ocl.expressions.CollectionKind;
35
import org.eclipse.ocl.expressions.CollectionKind;
36
import org.eclipse.ocl.expressions.OCLExpression;
36
import org.eclipse.ocl.expressions.Variable;
37
import org.eclipse.ocl.expressions.Variable;
37
import org.eclipse.ocl.internal.OCLPlugin;
38
import org.eclipse.ocl.internal.OCLPlugin;
38
import org.eclipse.ocl.internal.l10n.OCLMessages;
39
import org.eclipse.ocl.internal.l10n.OCLMessages;
(-)src/org/eclipse/ocl/util/OCLStandardLibraryUtil.java (-1 / +160 lines)
Lines 19-25 Link Here
19
 */
19
 */
20
package org.eclipse.ocl.util;
20
package org.eclipse.ocl.util;
21
21
22
import static org.eclipse.ocl.utilities.PredefinedType.*;
22
import static org.eclipse.ocl.utilities.PredefinedType.ABS;
23
import static org.eclipse.ocl.utilities.PredefinedType.ABS_NAME;
24
import static org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES;
25
import static org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES_NAME;
26
import static org.eclipse.ocl.utilities.PredefinedType.AND;
27
import static org.eclipse.ocl.utilities.PredefinedType.AND_NAME;
28
import static org.eclipse.ocl.utilities.PredefinedType.ANY;
29
import static org.eclipse.ocl.utilities.PredefinedType.ANY_NAME;
30
import static org.eclipse.ocl.utilities.PredefinedType.APPEND;
31
import static org.eclipse.ocl.utilities.PredefinedType.APPEND_NAME;
32
import static org.eclipse.ocl.utilities.PredefinedType.AS_BAG;
33
import static org.eclipse.ocl.utilities.PredefinedType.AS_BAG_NAME;
34
import static org.eclipse.ocl.utilities.PredefinedType.AS_ORDERED_SET;
35
import static org.eclipse.ocl.utilities.PredefinedType.AS_ORDERED_SET_NAME;
36
import static org.eclipse.ocl.utilities.PredefinedType.AS_SEQUENCE;
37
import static org.eclipse.ocl.utilities.PredefinedType.AS_SEQUENCE_NAME;
38
import static org.eclipse.ocl.utilities.PredefinedType.AS_SET;
39
import static org.eclipse.ocl.utilities.PredefinedType.AS_SET_NAME;
40
import static org.eclipse.ocl.utilities.PredefinedType.AT;
41
import static org.eclipse.ocl.utilities.PredefinedType.AT_NAME;
42
import static org.eclipse.ocl.utilities.PredefinedType.CLOSURE;
43
import static org.eclipse.ocl.utilities.PredefinedType.CLOSURE_NAME;
44
import static org.eclipse.ocl.utilities.PredefinedType.COLLECT;
45
import static org.eclipse.ocl.utilities.PredefinedType.COLLECT_NAME;
46
import static org.eclipse.ocl.utilities.PredefinedType.COLLECT_NESTED;
47
import static org.eclipse.ocl.utilities.PredefinedType.COLLECT_NESTED_NAME;
48
import static org.eclipse.ocl.utilities.PredefinedType.CONCAT;
49
import static org.eclipse.ocl.utilities.PredefinedType.CONCAT_NAME;
50
import static org.eclipse.ocl.utilities.PredefinedType.COUNT;
51
import static org.eclipse.ocl.utilities.PredefinedType.COUNT_NAME;
52
import static org.eclipse.ocl.utilities.PredefinedType.DIV;
53
import static org.eclipse.ocl.utilities.PredefinedType.DIVIDE;
54
import static org.eclipse.ocl.utilities.PredefinedType.DIVIDE_NAME;
55
import static org.eclipse.ocl.utilities.PredefinedType.DIV_NAME;
56
import static org.eclipse.ocl.utilities.PredefinedType.EQUAL;
57
import static org.eclipse.ocl.utilities.PredefinedType.EQUAL_NAME;
58
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDES;
59
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDES_ALL;
60
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDES_ALL_NAME;
61
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDES_NAME;
62
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDING;
63
import static org.eclipse.ocl.utilities.PredefinedType.EXCLUDING_NAME;
64
import static org.eclipse.ocl.utilities.PredefinedType.EXISTS;
65
import static org.eclipse.ocl.utilities.PredefinedType.EXISTS_NAME;
66
import static org.eclipse.ocl.utilities.PredefinedType.FIRST;
67
import static org.eclipse.ocl.utilities.PredefinedType.FIRST_NAME;
68
import static org.eclipse.ocl.utilities.PredefinedType.FLATTEN;
69
import static org.eclipse.ocl.utilities.PredefinedType.FLATTEN_NAME;
70
import static org.eclipse.ocl.utilities.PredefinedType.FLOOR;
71
import static org.eclipse.ocl.utilities.PredefinedType.FLOOR_NAME;
72
import static org.eclipse.ocl.utilities.PredefinedType.FOR_ALL;
73
import static org.eclipse.ocl.utilities.PredefinedType.FOR_ALL_NAME;
74
import static org.eclipse.ocl.utilities.PredefinedType.GREATER_THAN;
75
import static org.eclipse.ocl.utilities.PredefinedType.GREATER_THAN_EQUAL;
76
import static org.eclipse.ocl.utilities.PredefinedType.GREATER_THAN_EQUAL_NAME;
77
import static org.eclipse.ocl.utilities.PredefinedType.GREATER_THAN_NAME;
78
import static org.eclipse.ocl.utilities.PredefinedType.HAS_RETURNED;
79
import static org.eclipse.ocl.utilities.PredefinedType.HAS_RETURNED_NAME;
80
import static org.eclipse.ocl.utilities.PredefinedType.IMPLIES;
81
import static org.eclipse.ocl.utilities.PredefinedType.IMPLIES_NAME;
82
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDES;
83
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDES_ALL;
84
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDES_ALL_NAME;
85
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDES_NAME;
86
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDING;
87
import static org.eclipse.ocl.utilities.PredefinedType.INCLUDING_NAME;
88
import static org.eclipse.ocl.utilities.PredefinedType.INDEX_OF;
89
import static org.eclipse.ocl.utilities.PredefinedType.INDEX_OF_NAME;
90
import static org.eclipse.ocl.utilities.PredefinedType.INSERT_AT;
91
import static org.eclipse.ocl.utilities.PredefinedType.INSERT_AT_NAME;
92
import static org.eclipse.ocl.utilities.PredefinedType.INTERSECTION;
93
import static org.eclipse.ocl.utilities.PredefinedType.INTERSECTION_NAME;
94
import static org.eclipse.ocl.utilities.PredefinedType.IS_EMPTY;
95
import static org.eclipse.ocl.utilities.PredefinedType.IS_EMPTY_NAME;
96
import static org.eclipse.ocl.utilities.PredefinedType.IS_OPERATION_CALL;
97
import static org.eclipse.ocl.utilities.PredefinedType.IS_OPERATION_CALL_NAME;
98
import static org.eclipse.ocl.utilities.PredefinedType.IS_SIGNAL_SENT;
99
import static org.eclipse.ocl.utilities.PredefinedType.IS_SIGNAL_SENT_NAME;
100
import static org.eclipse.ocl.utilities.PredefinedType.IS_UNIQUE;
101
import static org.eclipse.ocl.utilities.PredefinedType.IS_UNIQUE_NAME;
102
import static org.eclipse.ocl.utilities.PredefinedType.LAST;
103
import static org.eclipse.ocl.utilities.PredefinedType.LAST_NAME;
104
import static org.eclipse.ocl.utilities.PredefinedType.LESS_THAN;
105
import static org.eclipse.ocl.utilities.PredefinedType.LESS_THAN_EQUAL;
106
import static org.eclipse.ocl.utilities.PredefinedType.LESS_THAN_EQUAL_NAME;
107
import static org.eclipse.ocl.utilities.PredefinedType.LESS_THAN_NAME;
108
import static org.eclipse.ocl.utilities.PredefinedType.MAX;
109
import static org.eclipse.ocl.utilities.PredefinedType.MAX_NAME;
110
import static org.eclipse.ocl.utilities.PredefinedType.MIN;
111
import static org.eclipse.ocl.utilities.PredefinedType.MINUS;
112
import static org.eclipse.ocl.utilities.PredefinedType.MINUS_NAME;
113
import static org.eclipse.ocl.utilities.PredefinedType.MIN_NAME;
114
import static org.eclipse.ocl.utilities.PredefinedType.MOD;
115
import static org.eclipse.ocl.utilities.PredefinedType.MOD_NAME;
116
import static org.eclipse.ocl.utilities.PredefinedType.NOT;
117
import static org.eclipse.ocl.utilities.PredefinedType.NOT_EMPTY;
118
import static org.eclipse.ocl.utilities.PredefinedType.NOT_EMPTY_NAME;
119
import static org.eclipse.ocl.utilities.PredefinedType.NOT_EQUAL;
120
import static org.eclipse.ocl.utilities.PredefinedType.NOT_EQUAL_NAME;
121
import static org.eclipse.ocl.utilities.PredefinedType.NOT_NAME;
122
import static org.eclipse.ocl.utilities.PredefinedType.OCL_AS_TYPE;
123
import static org.eclipse.ocl.utilities.PredefinedType.OCL_AS_TYPE_NAME;
124
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_INVALID;
125
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_INVALID_NAME;
126
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_IN_STATE;
127
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_IN_STATE_NAME;
128
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_KIND_OF;
129
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_KIND_OF_NAME;
130
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_NEW;
131
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_NEW_NAME;
132
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_TYPE_OF;
133
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_TYPE_OF_NAME;
134
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_UNDEFINED;
135
import static org.eclipse.ocl.utilities.PredefinedType.OCL_IS_UNDEFINED_NAME;
136
import static org.eclipse.ocl.utilities.PredefinedType.ONE;
137
import static org.eclipse.ocl.utilities.PredefinedType.ONE_NAME;
138
import static org.eclipse.ocl.utilities.PredefinedType.OR;
139
import static org.eclipse.ocl.utilities.PredefinedType.OR_NAME;
140
import static org.eclipse.ocl.utilities.PredefinedType.PLUS;
141
import static org.eclipse.ocl.utilities.PredefinedType.PLUS_NAME;
142
import static org.eclipse.ocl.utilities.PredefinedType.PREPEND;
143
import static org.eclipse.ocl.utilities.PredefinedType.PREPEND_NAME;
144
import static org.eclipse.ocl.utilities.PredefinedType.PRODUCT;
145
import static org.eclipse.ocl.utilities.PredefinedType.PRODUCT_NAME;
146
import static org.eclipse.ocl.utilities.PredefinedType.REJECT;
147
import static org.eclipse.ocl.utilities.PredefinedType.REJECT_NAME;
148
import static org.eclipse.ocl.utilities.PredefinedType.RESULT;
149
import static org.eclipse.ocl.utilities.PredefinedType.RESULT_NAME;
150
import static org.eclipse.ocl.utilities.PredefinedType.ROUND;
151
import static org.eclipse.ocl.utilities.PredefinedType.ROUND_NAME;
152
import static org.eclipse.ocl.utilities.PredefinedType.SELECT;
153
import static org.eclipse.ocl.utilities.PredefinedType.SELECT_NAME;
154
import static org.eclipse.ocl.utilities.PredefinedType.SIZE;
155
import static org.eclipse.ocl.utilities.PredefinedType.SIZE_NAME;
156
import static org.eclipse.ocl.utilities.PredefinedType.SORTED_BY;
157
import static org.eclipse.ocl.utilities.PredefinedType.SORTED_BY_NAME;
158
import static org.eclipse.ocl.utilities.PredefinedType.SUBSTRING;
159
import static org.eclipse.ocl.utilities.PredefinedType.SUBSTRING_NAME;
160
import static org.eclipse.ocl.utilities.PredefinedType.SUB_ORDERED_SET;
161
import static org.eclipse.ocl.utilities.PredefinedType.SUB_ORDERED_SET_NAME;
162
import static org.eclipse.ocl.utilities.PredefinedType.SUB_SEQUENCE;
163
import static org.eclipse.ocl.utilities.PredefinedType.SUB_SEQUENCE_NAME;
164
import static org.eclipse.ocl.utilities.PredefinedType.SUM;
165
import static org.eclipse.ocl.utilities.PredefinedType.SUM_NAME;
166
import static org.eclipse.ocl.utilities.PredefinedType.SYMMETRIC_DIFFERENCE;
167
import static org.eclipse.ocl.utilities.PredefinedType.SYMMETRIC_DIFFERENCE_NAME;
168
import static org.eclipse.ocl.utilities.PredefinedType.TIMES;
169
import static org.eclipse.ocl.utilities.PredefinedType.TIMES_NAME;
170
import static org.eclipse.ocl.utilities.PredefinedType.TO_INTEGER;
171
import static org.eclipse.ocl.utilities.PredefinedType.TO_INTEGER_NAME;
172
import static org.eclipse.ocl.utilities.PredefinedType.TO_LOWER;
173
import static org.eclipse.ocl.utilities.PredefinedType.TO_LOWER_NAME;
174
import static org.eclipse.ocl.utilities.PredefinedType.TO_REAL;
175
import static org.eclipse.ocl.utilities.PredefinedType.TO_REAL_NAME;
176
import static org.eclipse.ocl.utilities.PredefinedType.TO_UPPER;
177
import static org.eclipse.ocl.utilities.PredefinedType.TO_UPPER_NAME;
178
import static org.eclipse.ocl.utilities.PredefinedType.UNION;
179
import static org.eclipse.ocl.utilities.PredefinedType.UNION_NAME;
180
import static org.eclipse.ocl.utilities.PredefinedType.XOR;
181
import static org.eclipse.ocl.utilities.PredefinedType.XOR_NAME;
23
182
24
import java.util.Arrays;
183
import java.util.Arrays;
25
import java.util.Collection;
184
import java.util.Collection;
(-)src/org/eclipse/ocl/internal/helper/OCLSyntaxHelper.java (-7 / +7 lines)
Lines 28-34 Link Here
28
import java.util.ListIterator;
28
import java.util.ListIterator;
29
import java.util.Set;
29
import java.util.Set;
30
30
31
import lpg.lpgjavaruntime.IToken;
31
import lpg.runtime.IPrsStream;
32
import lpg.runtime.IToken;
32
33
33
import org.eclipse.emf.ecore.EObject;
34
import org.eclipse.emf.ecore.EObject;
34
import org.eclipse.emf.ecore.util.EcoreUtil;
35
import org.eclipse.emf.ecore.util.EcoreUtil;
Lines 69-75 Link Here
69
import org.eclipse.ocl.helper.Choice;
70
import org.eclipse.ocl.helper.Choice;
70
import org.eclipse.ocl.helper.ChoiceKind;
71
import org.eclipse.ocl.helper.ChoiceKind;
71
import org.eclipse.ocl.helper.ConstraintKind;
72
import org.eclipse.ocl.helper.ConstraintKind;
72
import org.eclipse.ocl.lpg.AbstractParser;
73
import org.eclipse.ocl.lpg.ProblemHandler;
73
import org.eclipse.ocl.lpg.ProblemHandler;
74
import org.eclipse.ocl.parser.AbstractOCLAnalyzer;
74
import org.eclipse.ocl.parser.AbstractOCLAnalyzer;
75
import org.eclipse.ocl.parser.OCLAnalyzer;
75
import org.eclipse.ocl.parser.OCLAnalyzer;
Lines 865-871 Link Here
865
	private List<IToken> tokenize(OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer) {
865
	private List<IToken> tokenize(OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer) {
866
		IToken token = null;
866
		IToken token = null;
867
		List<IToken> result = new ArrayList<IToken>();
867
		List<IToken> result = new ArrayList<IToken>();
868
		AbstractParser parser = analyzer.getAbstractParser();
868
		IPrsStream parser = analyzer.getAbstractParser().getIPrsStream();
869
		for (;;) {
869
		for (;;) {
870
			try {
870
			try {
871
				token = parser.getIToken(parser.getToken());
871
				token = parser.getIToken(parser.getToken());
Lines 949-955 Link Here
949
				OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer =
949
				OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer =
950
					new OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(
950
					new OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E>(
951
							environment, txt);
951
							environment, txt);
952
				AbstractParser parser = analyzer.getAbstractParser();		
952
				IPrsStream parser = analyzer.getAbstractParser().getIPrsStream();		
953
				List<IToken> tokens = tokenize(analyzer);
953
				List<IToken> tokens = tokenize(analyzer);
954
				
954
				
955
				ListIterator<IToken> iter = tokens.listIterator(tokens.size());
955
				ListIterator<IToken> iter = tokens.listIterator(tokens.size());
Lines 1100-1106 Link Here
1100
	private List<String> parseTokensPathNameCS(
1100
	private List<String> parseTokensPathNameCS(
1101
			OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer,
1101
			OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer,
1102
			List<IToken> tokens) {
1102
			List<IToken> tokens) {
1103
		AbstractParser parser = analyzer.getAbstractParser();		
1103
		IPrsStream parser = analyzer.getAbstractParser().getIPrsStream();		
1104
		ArrayList<String> path = new ArrayList<String>();
1104
		ArrayList<String> path = new ArrayList<String>();
1105
		IToken token;
1105
		IToken token;
1106
		int index = tokens.size() - 1;
1106
		int index = tokens.size() - 1;
Lines 1145-1151 Link Here
1145
        // right-most subexpression that parses
1145
        // right-most subexpression that parses
1146
        
1146
        
1147
        // initialize the token list
1147
        // initialize the token list
1148
        analyzer.getLexer().reset();
1148
        analyzer.getLexer().getILexStream().reset();
1149
        List<IToken> tokens = tokenize(analyzer);
1149
        List<IToken> tokens = tokenize(analyzer);
1150
        
1150
        
1151
        ListIterator<IToken> it = tokens.listIterator(tokens.size());
1151
        ListIterator<IToken> it = tokens.listIterator(tokens.size());
Lines 1350-1356 Link Here
1350
					env, variables);
1350
					env, variables);
1351
		
1351
		
1352
		if (!parseVariableDeclaration(env, mainAnalyzer)) {
1352
		if (!parseVariableDeclaration(env, mainAnalyzer)) {
1353
			AbstractParser parser = mainAnalyzer.getAbstractParser();		
1353
			IPrsStream parser = mainAnalyzer.getAbstractParser().getIPrsStream();		
1354
			parser.reset();
1354
			parser.reset();
1355
			OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer;
1355
			OCLAnalyzer<PK, C, O, P, EL, PM, S, COA, SSA, CT, CLS, E> analyzer;
1356
			String newTxt;
1356
			String newTxt;
(-)src/org/eclipse/ocl/cst/util/CSTSwitch.java (-2 lines)
Lines 21-28 Link Here
21
21
22
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
24
25
//import org.eclipse.ocl.cst.*;
26
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
24
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
27
import org.eclipse.ocl.cst.CSTNode;
25
import org.eclipse.ocl.cst.CSTNode;
28
import org.eclipse.ocl.cst.CSTPackage;
26
import org.eclipse.ocl.cst.CSTPackage;
(-)src/org/eclipse/ocl/cst/util/CSTAdapterFactory.java (-2 lines)
Lines 21-28 Link Here
21
import org.eclipse.emf.common.notify.Notifier;
21
import org.eclipse.emf.common.notify.Notifier;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
24
25
//import org.eclipse.ocl.cst.*;
26
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
24
import org.eclipse.ocl.cst.BooleanLiteralExpCS;
27
import org.eclipse.ocl.cst.CSTNode;
25
import org.eclipse.ocl.cst.CSTNode;
28
import org.eclipse.ocl.cst.CSTPackage;
26
import org.eclipse.ocl.cst.CSTPackage;
(-)src/org/eclipse/ocl/types/TupleType.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types;
18
package org.eclipse.ocl.types;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.ocl.utilities.PredefinedType;
24
import org.eclipse.ocl.utilities.PredefinedType;
(-)src/org/eclipse/ocl/types/MessageType.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types;
18
package org.eclipse.ocl.types;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.ocl.utilities.PredefinedType;
24
import org.eclipse.ocl.utilities.PredefinedType;
(-)src/org/eclipse/ocl/types/CollectionType.java (+1 lines)
Lines 18-23 Link Here
18
package org.eclipse.ocl.types;
18
package org.eclipse.ocl.types;
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.emf.common.util.EList;
23
import org.eclipse.ocl.expressions.CollectionKind;
24
import org.eclipse.ocl.expressions.CollectionKind;
(-).settings/.api_filters (+398 lines)
Lines 1-8 Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<component id="org.eclipse.ocl" version="2">
2
<component id="org.eclipse.ocl" version="2">
3
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs">
4
        <filter id="1143996420">
5
            <message_arguments>
6
                <message_argument value="MAX_NAME_LENGTH"/>
7
            </message_arguments>
8
        </filter>
9
        <filter id="1143996420">
10
            <message_arguments>
11
                <message_argument value="isNullable"/>
12
            </message_arguments>
13
        </filter>
14
        <filter id="1143996420">
15
            <message_arguments>
16
                <message_argument value="SCOPE_SIZE"/>
17
            </message_arguments>
18
        </filter>
19
        <filter id="1143996420">
20
            <message_arguments>
21
                <message_argument value="SCOPE_UBOUND"/>
22
            </message_arguments>
23
        </filter>
24
        <filter id="1143996420">
25
            <message_arguments>
26
                <message_argument value="prosthesesIndex"/>
27
            </message_arguments>
28
        </filter>
29
        <filter id="1143996420">
30
            <message_arguments>
31
                <message_argument value="isNullable(int)"/>
32
            </message_arguments>
33
        </filter>
34
        <filter id="1143996420">
35
            <message_arguments>
36
                <message_argument value="getIdentifier_SYMBOL()"/>
37
            </message_arguments>
38
        </filter>
39
        <filter id="1143996420">
40
            <message_arguments>
41
                <message_argument value="ERROR_SYMBOL"/>
42
            </message_arguments>
43
        </filter>
44
        <filter id="1143996420">
45
            <message_arguments>
46
                <message_argument value="prosthesesIndex(int)"/>
47
            </message_arguments>
48
        </filter>
49
    </resource>
50
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs$IsNullable">
51
        <filter id="1143996420">
52
            <message_arguments>
53
                <message_argument value="IsNullable"/>
54
            </message_arguments>
55
        </filter>
56
    </resource>
57
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexerprs.java" type="org.eclipse.ocl.parser.OCLKWLexerprs$ProsthesesIndex">
58
        <filter id="1143996420">
59
            <message_arguments>
60
                <message_argument value="ProsthesesIndex"/>
61
            </message_arguments>
62
        </filter>
63
    </resource>
64
    <resource path="src/org/eclipse/ocl/parser/OCLKWLexersym.java" type="org.eclipse.ocl.parser.OCLKWLexersym">
65
        <filter id="1211105284">
66
            <message_arguments>
67
                <message_argument value="Char__"/>
68
            </message_arguments>
69
        </filter>
70
        <filter id="1211105284">
71
            <message_arguments>
72
                <message_argument value="numTokenKinds"/>
73
            </message_arguments>
74
        </filter>
75
        <filter id="1211105284">
76
            <message_arguments>
77
                <message_argument value="Char_Percent"/>
78
            </message_arguments>
79
        </filter>
80
    </resource>
81
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs">
82
        <filter id="1143996420">
83
            <message_arguments>
84
                <message_argument value="SCOPE_UBOUND"/>
85
            </message_arguments>
86
        </filter>
87
        <filter id="1143996420">
88
            <message_arguments>
89
                <message_argument value="MAX_NAME_LENGTH"/>
90
            </message_arguments>
91
        </filter>
92
        <filter id="1143996420">
93
            <message_arguments>
94
                <message_argument value="isNullable(int)"/>
95
            </message_arguments>
96
        </filter>
97
        <filter id="1143996420">
98
            <message_arguments>
99
                <message_argument value="getIdentifier_SYMBOL()"/>
100
            </message_arguments>
101
        </filter>
102
        <filter id="1143996420">
103
            <message_arguments>
104
                <message_argument value="SCOPE_SIZE"/>
105
            </message_arguments>
106
        </filter>
107
        <filter id="1143996420">
108
            <message_arguments>
109
                <message_argument value="isNullable"/>
110
            </message_arguments>
111
        </filter>
112
        <filter id="1143996420">
113
            <message_arguments>
114
                <message_argument value="prosthesesIndex(int)"/>
115
            </message_arguments>
116
        </filter>
117
        <filter id="1143996420">
118
            <message_arguments>
119
                <message_argument value="ERROR_SYMBOL"/>
120
            </message_arguments>
121
        </filter>
122
        <filter id="1143996420">
123
            <message_arguments>
124
                <message_argument value="prosthesesIndex"/>
125
            </message_arguments>
126
        </filter>
127
    </resource>
128
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs$IsNullable">
129
        <filter id="1143996420">
130
            <message_arguments>
131
                <message_argument value="IsNullable"/>
132
            </message_arguments>
133
        </filter>
134
    </resource>
135
    <resource path="src/org/eclipse/ocl/parser/OCLLexerprs.java" type="org.eclipse.ocl.parser.OCLLexerprs$ProsthesesIndex">
136
        <filter id="1143996420">
137
            <message_arguments>
138
                <message_argument value="ProsthesesIndex"/>
139
            </message_arguments>
140
        </filter>
141
    </resource>
142
    <resource path="src/org/eclipse/ocl/parser/OCLLexersym.java" type="org.eclipse.ocl.parser.OCLLexersym">
143
        <filter id="1211105284">
144
            <message_arguments>
145
                <message_argument value="numTokenKinds"/>
146
            </message_arguments>
147
        </filter>
148
    </resource>
149
    <resource path="src/org/eclipse/ocl/parser/OCLParser.java" type="org.eclipse.ocl.parser.OCLParser">
150
        <filter id="1143996420">
151
            <message_arguments>
152
                <message_argument value="getParser()"/>
153
            </message_arguments>
154
        </filter>
155
    </resource>
156
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs">
157
        <filter id="1143996420">
158
            <message_arguments>
159
                <message_argument value="prosthesesIndex(int)"/>
160
            </message_arguments>
161
        </filter>
162
        <filter id="1143996420">
163
            <message_arguments>
164
                <message_argument value="prosthesesIndex"/>
165
            </message_arguments>
166
        </filter>
167
        <filter id="1143996420">
168
            <message_arguments>
169
                <message_argument value="isNullable(int)"/>
170
            </message_arguments>
171
        </filter>
172
        <filter id="1143996420">
173
            <message_arguments>
174
                <message_argument value="isNullable"/>
175
            </message_arguments>
176
        </filter>
177
        <filter id="1143996420">
178
            <message_arguments>
179
                <message_argument value="getIdentifier_SYMBOL()"/>
180
            </message_arguments>
181
        </filter>
182
    </resource>
183
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs$IsNullable">
184
        <filter id="1143996420">
185
            <message_arguments>
186
                <message_argument value="IsNullable"/>
187
            </message_arguments>
188
        </filter>
189
    </resource>
190
    <resource path="src/org/eclipse/ocl/parser/OCLParserprs.java" type="org.eclipse.ocl.parser.OCLParserprs$ProsthesesIndex">
191
        <filter id="1143996420">
192
            <message_arguments>
193
                <message_argument value="ProsthesesIndex"/>
194
            </message_arguments>
195
        </filter>
196
    </resource>
3
    <resource path="src/org/eclipse/ocl/parser/OCLParsersym.java" type="org.eclipse.ocl.parser.OCLParsersym">
197
    <resource path="src/org/eclipse/ocl/parser/OCLParsersym.java" type="org.eclipse.ocl.parser.OCLParsersym">
4
        <filter id="1211105284">
198
        <filter id="1211105284">
5
            <message_arguments>
199
            <message_arguments>
200
                <message_argument value="numTokenKinds"/>
201
            </message_arguments>
202
        </filter>
203
        <filter id="1211105284">
204
            <message_arguments>
6
                <message_argument value="TK_MULTI_LINE_COMMENT"/>
205
                <message_argument value="TK_MULTI_LINE_COMMENT"/>
7
            </message_arguments>
206
            </message_arguments>
8
        </filter>
207
        </filter>
Lines 17-22 Link Here
17
            </message_arguments>
216
            </message_arguments>
18
        </filter>
217
        </filter>
19
    </resource>
218
    </resource>
219
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs">
220
        <filter id="1143996420">
221
            <message_arguments>
222
                <message_argument value="MAX_NAME_LENGTH"/>
223
            </message_arguments>
224
        </filter>
225
        <filter id="1143996420">
226
            <message_arguments>
227
                <message_argument value="prosthesesIndex"/>
228
            </message_arguments>
229
        </filter>
230
        <filter id="1143996420">
231
            <message_arguments>
232
                <message_argument value="isNullable"/>
233
            </message_arguments>
234
        </filter>
235
        <filter id="1143996420">
236
            <message_arguments>
237
                <message_argument value="ERROR_SYMBOL"/>
238
            </message_arguments>
239
        </filter>
240
        <filter id="1143996420">
241
            <message_arguments>
242
                <message_argument value="getIdentifier_SYMBOL()"/>
243
            </message_arguments>
244
        </filter>
245
        <filter id="1143996420">
246
            <message_arguments>
247
                <message_argument value="SCOPE_SIZE"/>
248
            </message_arguments>
249
        </filter>
250
        <filter id="1143996420">
251
            <message_arguments>
252
                <message_argument value="SCOPE_UBOUND"/>
253
            </message_arguments>
254
        </filter>
255
        <filter id="1143996420">
256
            <message_arguments>
257
                <message_argument value="prosthesesIndex(int)"/>
258
            </message_arguments>
259
        </filter>
260
        <filter id="1143996420">
261
            <message_arguments>
262
                <message_argument value="isNullable(int)"/>
263
            </message_arguments>
264
        </filter>
265
    </resource>
266
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs$IsNullable">
267
        <filter id="1143996420">
268
            <message_arguments>
269
                <message_argument value="IsNullable"/>
270
            </message_arguments>
271
        </filter>
272
    </resource>
273
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexerprs$ProsthesesIndex">
274
        <filter id="1143996420">
275
            <message_arguments>
276
                <message_argument value="ProsthesesIndex"/>
277
            </message_arguments>
278
        </filter>
279
    </resource>
280
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingKWLexersym">
281
        <filter id="1211105284">
282
            <message_arguments>
283
                <message_argument value="Char__"/>
284
            </message_arguments>
285
        </filter>
286
        <filter id="1211105284">
287
            <message_arguments>
288
                <message_argument value="Char_Percent"/>
289
            </message_arguments>
290
        </filter>
291
        <filter id="1211105284">
292
            <message_arguments>
293
                <message_argument value="numTokenKinds"/>
294
            </message_arguments>
295
        </filter>
296
    </resource>
297
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs">
298
        <filter id="1143996420">
299
            <message_arguments>
300
                <message_argument value="isNullable"/>
301
            </message_arguments>
302
        </filter>
303
        <filter id="1143996420">
304
            <message_arguments>
305
                <message_argument value="isNullable(int)"/>
306
            </message_arguments>
307
        </filter>
308
        <filter id="1143996420">
309
            <message_arguments>
310
                <message_argument value="getIdentifier_SYMBOL()"/>
311
            </message_arguments>
312
        </filter>
313
        <filter id="1143996420">
314
            <message_arguments>
315
                <message_argument value="MAX_NAME_LENGTH"/>
316
            </message_arguments>
317
        </filter>
318
        <filter id="1143996420">
319
            <message_arguments>
320
                <message_argument value="ERROR_SYMBOL"/>
321
            </message_arguments>
322
        </filter>
323
        <filter id="1143996420">
324
            <message_arguments>
325
                <message_argument value="prosthesesIndex"/>
326
            </message_arguments>
327
        </filter>
328
        <filter id="1143996420">
329
            <message_arguments>
330
                <message_argument value="SCOPE_SIZE"/>
331
            </message_arguments>
332
        </filter>
333
        <filter id="1143996420">
334
            <message_arguments>
335
                <message_argument value="SCOPE_UBOUND"/>
336
            </message_arguments>
337
        </filter>
338
        <filter id="1143996420">
339
            <message_arguments>
340
                <message_argument value="prosthesesIndex(int)"/>
341
            </message_arguments>
342
        </filter>
343
    </resource>
344
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs$IsNullable">
345
        <filter id="1143996420">
346
            <message_arguments>
347
                <message_argument value="IsNullable"/>
348
            </message_arguments>
349
        </filter>
350
    </resource>
351
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexerprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexerprs$ProsthesesIndex">
352
        <filter id="1143996420">
353
            <message_arguments>
354
                <message_argument value="ProsthesesIndex"/>
355
            </message_arguments>
356
        </filter>
357
    </resource>
358
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingLexersym">
359
        <filter id="1211105284">
360
            <message_arguments>
361
                <message_argument value="numTokenKinds"/>
362
            </message_arguments>
363
        </filter>
364
    </resource>
365
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParser.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParser">
366
        <filter id="1143996420">
367
            <message_arguments>
368
                <message_argument value="getParser()"/>
369
            </message_arguments>
370
        </filter>
371
    </resource>
372
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs">
373
        <filter id="1143996420">
374
            <message_arguments>
375
                <message_argument value="prosthesesIndex(int)"/>
376
            </message_arguments>
377
        </filter>
378
        <filter id="1143996420">
379
            <message_arguments>
380
                <message_argument value="prosthesesIndex"/>
381
            </message_arguments>
382
        </filter>
383
        <filter id="1143996420">
384
            <message_arguments>
385
                <message_argument value="getIdentifier_SYMBOL()"/>
386
            </message_arguments>
387
        </filter>
388
        <filter id="1143996420">
389
            <message_arguments>
390
                <message_argument value="isNullable(int)"/>
391
            </message_arguments>
392
        </filter>
393
        <filter id="1143996420">
394
            <message_arguments>
395
                <message_argument value="isNullable"/>
396
            </message_arguments>
397
        </filter>
398
    </resource>
399
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs$IsNullable">
400
        <filter id="1143996420">
401
            <message_arguments>
402
                <message_argument value="IsNullable"/>
403
            </message_arguments>
404
        </filter>
405
    </resource>
406
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParserprs.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParserprs$ProsthesesIndex">
407
        <filter id="1143996420">
408
            <message_arguments>
409
                <message_argument value="ProsthesesIndex"/>
410
            </message_arguments>
411
        </filter>
412
    </resource>
20
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParsersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParsersym">
413
    <resource path="src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParsersym.java" type="org.eclipse.ocl.parser.backtracking.OCLBacktrackingParsersym">
21
        <filter id="1211105284">
414
        <filter id="1211105284">
22
            <message_arguments>
415
            <message_arguments>
Lines 33-37 Link Here
33
                <message_argument value="TK_invalid"/>
426
                <message_argument value="TK_invalid"/>
34
            </message_arguments>
427
            </message_arguments>
35
        </filter>
428
        </filter>
429
        <filter id="1211105284">
430
            <message_arguments>
431
                <message_argument value="numTokenKinds"/>
432
            </message_arguments>
433
        </filter>
36
    </resource>
434
    </resource>
37
</component>
435
</component>
(-)src/org/eclipse/ocl/utilities/util/UtilitiesSwitch.java (-2 lines)
Lines 19-26 Link Here
19
19
20
import org.eclipse.emf.ecore.EClass;
20
import org.eclipse.emf.ecore.EClass;
21
import org.eclipse.emf.ecore.EObject;
21
import org.eclipse.emf.ecore.EObject;
22
23
//import org.eclipse.ocl.utilities.*;
24
import org.eclipse.ocl.utilities.ASTNode;
22
import org.eclipse.ocl.utilities.ASTNode;
25
import org.eclipse.ocl.utilities.CallingASTNode;
23
import org.eclipse.ocl.utilities.CallingASTNode;
26
import org.eclipse.ocl.utilities.ExpressionInOCL;
24
import org.eclipse.ocl.utilities.ExpressionInOCL;
(-)src/org/eclipse/ocl/utilities/util/UtilitiesAdapterFactory.java (-2 lines)
Lines 19-26 Link Here
19
import org.eclipse.emf.common.notify.Notifier;
19
import org.eclipse.emf.common.notify.Notifier;
20
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
20
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
21
import org.eclipse.emf.ecore.EObject;
21
import org.eclipse.emf.ecore.EObject;
22
23
//import org.eclipse.ocl.utilities.*;
24
import org.eclipse.ocl.utilities.ASTNode;
22
import org.eclipse.ocl.utilities.ASTNode;
25
import org.eclipse.ocl.utilities.CallingASTNode;
23
import org.eclipse.ocl.utilities.CallingASTNode;
26
import org.eclipse.ocl.utilities.ExpressionInOCL;
24
import org.eclipse.ocl.utilities.ExpressionInOCL;
(-)src/org/eclipse/ocl/utilities/impl/UtilitiesFactoryImpl.java (-2 lines)
Lines 20-27 Link Here
20
import org.eclipse.emf.ecore.EPackage;
20
import org.eclipse.emf.ecore.EPackage;
21
import org.eclipse.emf.ecore.impl.EFactoryImpl;
21
import org.eclipse.emf.ecore.impl.EFactoryImpl;
22
import org.eclipse.emf.ecore.plugin.EcorePlugin;
22
import org.eclipse.emf.ecore.plugin.EcorePlugin;
23
24
//import org.eclipse.ocl.utilities.*;
25
import org.eclipse.ocl.utilities.UtilitiesFactory;
23
import org.eclipse.ocl.utilities.UtilitiesFactory;
26
import org.eclipse.ocl.utilities.UtilitiesPackage;
24
import org.eclipse.ocl.utilities.UtilitiesPackage;
27
25
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingParser.g
Lines 1-7 Link Here
1
--/**
1
--/**
2
-- * <copyright>
2
-- * <copyright>
3
-- *
3
-- *
(-)* Copyright (c) 2008, 2009 Eclipse.org and others. (-15 / +12 lines)
Lines 9-14 Link Here
9
-- *
9
-- *
10
-- * Contributors:
10
-- * Contributors:
11
-- *   E.D. Willink - Initial API and implementation
11
-- *   E.D. Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
12
-- *
13
-- *
13
-- * </copyright>
14
-- * </copyright>
14
-- *
15
-- *
Lines 25-59 Link Here
25
26
26
%options escape=$
27
%options escape=$
27
%options la=2
28
%options la=2
28
%options table=java
29
%options fp=OCLBacktrackingParser,prefix=TK_
29
%options fp=OCLBacktrackingParser,prefix=TK_
30
%options error-maps
31
%options scopes
32
%options margin=4
33
%options backtrack
30
%options backtrack
34
%options noserialize
31
%options noserialize
35
%options package=org.eclipse.ocl.parser.backtracking
32
%options package=org.eclipse.ocl.parser.backtracking
36
%options import_terminals=OCLBacktrackingLexer.g
33
%options import_terminals=OCLBacktrackingLexer.gi
37
%options ast_type=CSTNode
34
%options ast_type=CSTNode
38
%options programming_language=java
35
%options ParseTable=lpg.runtime.ParseTable
39
%options action=("*.java", "/.", "./")
36
%options template=dtParserTemplateF.gi
40
%options ParseTable=lpg.lpgjavaruntime.ParseTable
41
%options include_directory=".;..;../../lpg"
37
%options include_directory=".;..;../../lpg"
42
38
43
$Include
39
%Import
44
	OCLParserErrors.g
40
	OCLParserErrors.gi
45
$End
41
%End
46
42
47
$Globals
43
%Globals
48
	/.
44
	/.
49
		import org.eclipse.ocl.parser.AbstractOCLParser;
45
		import org.eclipse.ocl.parser.AbstractOCLParser;
50
	./
46
	./
51
$End
47
%End
52
48
53
$Define
49
%Define
54
	$lex_stream_class /.OCLBacktrackingLexer./
50
	$lex_stream_class /.OCLBacktrackingLexer./
55
	$prs_parser_class /.BacktrackingParser./
51
	$prs_parser_class /.BacktrackingParser./
56
	$prs_parser_exception /.NotBacktrackParseTableException./
52
	$prs_parser_exception /.NotBacktrackParseTableException./
57
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -BACKTRACK option")./
53
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -BACKTRACK option")./
58
	$prs_parse_args /.error_repair_count./
54
	$prs_parse_args /.error_repair_count./
59
$End
55
%End
56
(-)src/org/eclipse/ocl/types/util/TypesSwitch.java (-2 lines)
Lines 20-27 Link Here
20
//import java.util.List;
20
//import java.util.List;
21
import org.eclipse.emf.ecore.EClass;
21
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EObject;
22
import org.eclipse.emf.ecore.EObject;
23
24
//import org.eclipse.ocl.types.*;
25
import org.eclipse.ocl.types.AnyType;
23
import org.eclipse.ocl.types.AnyType;
26
import org.eclipse.ocl.types.BagType;
24
import org.eclipse.ocl.types.BagType;
27
import org.eclipse.ocl.types.CollectionType;
25
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/types/util/TypesValidator.java (-3 lines)
Lines 19-32 Link Here
19
19
20
import java.util.Map;
20
import java.util.Map;
21
21
22
//import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
24
import org.eclipse.emf.common.util.ResourceLocator;
23
import org.eclipse.emf.common.util.ResourceLocator;
25
import org.eclipse.emf.ecore.EPackage;
24
import org.eclipse.emf.ecore.EPackage;
26
import org.eclipse.emf.ecore.util.EObjectValidator;
25
import org.eclipse.emf.ecore.util.EObjectValidator;
27
import org.eclipse.ocl.internal.OCLPlugin;
26
import org.eclipse.ocl.internal.OCLPlugin;
28
29
//import org.eclipse.ocl.types.*;
30
import org.eclipse.ocl.types.AnyType;
27
import org.eclipse.ocl.types.AnyType;
31
import org.eclipse.ocl.types.BagType;
28
import org.eclipse.ocl.types.BagType;
32
import org.eclipse.ocl.types.CollectionType;
29
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/types/util/TypesAdapterFactory.java (-2 lines)
Lines 21-28 Link Here
21
import org.eclipse.emf.common.notify.Notifier;
21
import org.eclipse.emf.common.notify.Notifier;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
24
25
//import org.eclipse.ocl.types.*;
26
import org.eclipse.ocl.types.AnyType;
24
import org.eclipse.ocl.types.AnyType;
27
import org.eclipse.ocl.types.BagType;
25
import org.eclipse.ocl.types.BagType;
28
import org.eclipse.ocl.types.CollectionType;
26
import org.eclipse.ocl.types.CollectionType;
(-)src/org/eclipse/ocl/expressions/util/ExpressionsValidator.java (-4 / +37 lines)
Lines 21-32 Link Here
21
21
22
import org.eclipse.emf.common.util.DiagnosticChain;
22
import org.eclipse.emf.common.util.DiagnosticChain;
23
import org.eclipse.emf.common.util.ResourceLocator;
23
import org.eclipse.emf.common.util.ResourceLocator;
24
25
import org.eclipse.emf.ecore.EPackage;
24
import org.eclipse.emf.ecore.EPackage;
26
27
import org.eclipse.emf.ecore.util.EObjectValidator;
25
import org.eclipse.emf.ecore.util.EObjectValidator;
28
26
import org.eclipse.ocl.expressions.AssociationClassCallExp;
29
import org.eclipse.ocl.expressions.*;
27
import org.eclipse.ocl.expressions.BooleanLiteralExp;
28
import org.eclipse.ocl.expressions.CallExp;
29
import org.eclipse.ocl.expressions.CollectionItem;
30
import org.eclipse.ocl.expressions.CollectionKind;
31
import org.eclipse.ocl.expressions.CollectionLiteralExp;
32
import org.eclipse.ocl.expressions.CollectionLiteralPart;
33
import org.eclipse.ocl.expressions.CollectionRange;
34
import org.eclipse.ocl.expressions.EnumLiteralExp;
35
import org.eclipse.ocl.expressions.ExpressionsPackage;
36
import org.eclipse.ocl.expressions.FeatureCallExp;
37
import org.eclipse.ocl.expressions.IfExp;
38
import org.eclipse.ocl.expressions.IntegerLiteralExp;
39
import org.eclipse.ocl.expressions.InvalidLiteralExp;
40
import org.eclipse.ocl.expressions.IterateExp;
41
import org.eclipse.ocl.expressions.IteratorExp;
42
import org.eclipse.ocl.expressions.LetExp;
43
import org.eclipse.ocl.expressions.LiteralExp;
44
import org.eclipse.ocl.expressions.LoopExp;
45
import org.eclipse.ocl.expressions.MessageExp;
46
import org.eclipse.ocl.expressions.NavigationCallExp;
47
import org.eclipse.ocl.expressions.NullLiteralExp;
48
import org.eclipse.ocl.expressions.NumericLiteralExp;
49
import org.eclipse.ocl.expressions.OCLExpression;
50
import org.eclipse.ocl.expressions.OperationCallExp;
51
import org.eclipse.ocl.expressions.PrimitiveLiteralExp;
52
import org.eclipse.ocl.expressions.PropertyCallExp;
53
import org.eclipse.ocl.expressions.RealLiteralExp;
54
import org.eclipse.ocl.expressions.StateExp;
55
import org.eclipse.ocl.expressions.StringLiteralExp;
56
import org.eclipse.ocl.expressions.TupleLiteralExp;
57
import org.eclipse.ocl.expressions.TupleLiteralPart;
58
import org.eclipse.ocl.expressions.TypeExp;
59
import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp;
60
import org.eclipse.ocl.expressions.UnspecifiedValueExp;
61
import org.eclipse.ocl.expressions.Variable;
62
import org.eclipse.ocl.expressions.VariableExp;
30
import org.eclipse.ocl.internal.OCLPlugin;
63
import org.eclipse.ocl.internal.OCLPlugin;
31
64
32
/**
65
/**
(-)src/org/eclipse/ocl/expressions/util/ExpressionsSwitch.java (-2 lines)
Lines 21-28 Link Here
21
21
22
import org.eclipse.emf.ecore.EClass;
22
import org.eclipse.emf.ecore.EClass;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
24
25
//import org.eclipse.ocl.expressions.*;
26
import org.eclipse.ocl.expressions.AssociationClassCallExp;
24
import org.eclipse.ocl.expressions.AssociationClassCallExp;
27
import org.eclipse.ocl.expressions.BooleanLiteralExp;
25
import org.eclipse.ocl.expressions.BooleanLiteralExp;
28
import org.eclipse.ocl.expressions.CallExp;
26
import org.eclipse.ocl.expressions.CallExp;
(-)src/org/eclipse/ocl/expressions/util/ExpressionsAdapterFactory.java (-2 lines)
Lines 21-28 Link Here
21
import org.eclipse.emf.common.notify.Notifier;
21
import org.eclipse.emf.common.notify.Notifier;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
22
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
23
import org.eclipse.emf.ecore.EObject;
23
import org.eclipse.emf.ecore.EObject;
24
25
//import org.eclipse.ocl.expressions.*;
26
import org.eclipse.ocl.expressions.AssociationClassCallExp;
24
import org.eclipse.ocl.expressions.AssociationClassCallExp;
27
import org.eclipse.ocl.expressions.BooleanLiteralExp;
25
import org.eclipse.ocl.expressions.BooleanLiteralExp;
28
import org.eclipse.ocl.expressions.CallExp;
26
import org.eclipse.ocl.expressions.CallExp;
(-)src/org/eclipse/ocl/lpg/KeywordTemplateF.gi (+119 lines)
Added Link Here
1
--
2
-- An LPG Lexer Template Using lpg.jar
3
--
4
-- An instance of this template must have a $Export section and the export_terminals option
5
-- There must be only one non-terminal, the start symbol, for the keywords
6
-- The action for each keyword should be a call to $setResult(terminal_symbol)
7
--
8
-- Macro that may be redefined in an instance of this template
9
--
10
--     $eof_char
11
--
12
-- B E G I N N I N G   O F   T E M P L A T E   KeywordTemplateF (Similar to KeywordTemplateD)
13
--
14
%Options Programming_Language=java,margin=4
15
%Options table
16
%options action-block=("*.java", "/.", "./")
17
%options ParseTable=lpg.runtime.ParseTable
18
%Options prefix=Char_
19
%Options single-productions
20
21
--
22
-- This template requires that the name of the EOF token be set
23
-- to EOF and that the prefix be "Char_" to be consistent with
24
-- LexerTemplateD.
25
--
26
%Eof
27
    EOF
28
%End
29
30
%Define
31
    --
32
    -- Macro that may be respecified in an instance of this template
33
    --
34
    $eof_char /.$sym_type$.$prefix$EOF$suffix$./
35
36
    --
37
    -- Macros useful for specifying actions
38
    --
39
    $setResult /.keywordKind[$rule_number] = ./
40
41
    $Header
42
    /.
43
            //
44
            // Rule $rule_number:  $rule_text
45
            //
46
            ./
47
48
    $BeginAction /.$Header./
49
50
    $EndAction /../
51
52
    $BeginJava /.$BeginAction./
53
54
    $EndJava /.$EndAction./
55
%End
56
57
%Headers
58
    /.
59
    public class $action_type extends $prs_type
60
    {
61
        private char[] inputChars;
62
        private final int keywordKind[] = new int[$num_rules + 1];
63
64
        public int[] getKeywordKinds() { return keywordKind; }
65
66
        public int lexer(int curtok, int lasttok)
67
        {
68
            int current_kind = getKind(inputChars[curtok]),
69
                act;
70
71
            for (act = tAction(START_STATE, current_kind);
72
                 act > NUM_RULES && act < ACCEPT_ACTION;
73
                 act = tAction(act, current_kind))
74
            {
75
                curtok++;
76
                current_kind = (curtok > lasttok
77
                                       ? $eof_char
78
                                       : getKind(inputChars[curtok]));
79
            }
80
81
            if (act > ERROR_ACTION)
82
            {
83
                curtok++;
84
                act -= ERROR_ACTION;
85
            }
86
87
            return keywordKind[act == ERROR_ACTION  || curtok <= lasttok ? 0 : act];
88
        }
89
90
        public void setInputChars(char[] inputChars) { this.inputChars = inputChars; }
91
92
    ./
93
%End
94
95
%Rules
96
    /.
97
98
        public $action_type(char[] inputChars, int identifierKind)
99
        {
100
            this.inputChars = inputChars;
101
            keywordKind[0] = identifierKind;
102
    ./
103
%End
104
105
%Trailers
106
    /.
107
            for (int i = 0; i < keywordKind.length; i++)
108
            {
109
                if (keywordKind[i] == 0)
110
                    keywordKind[i] = identifierKind;
111
            }
112
        }
113
    }
114
    ./
115
%End
116
117
--
118
-- E N D   O F   T E M P L A T E
119
--
(-)src/org/eclipse/ocl/parser/backtracking/OCLParserErrors.gi (+205 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008 Eclipse.org, Open Canarias S.L. and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   E.D. Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
13
-- *
14
-- * </copyright>
15
-- *
16
-- * $Id: OCLParserErrors.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
17
-- */
18
--
19
-- Additional ERROR_TOKEN rules for The OCL Parser
20
--
21
22
%Import
23
	OCLParser.g
24
%End
25
26
%Import
27
	EssentialOCLErrors.gi
28
%End
29
30
%Rules
31
32
	classifierContextDeclCS ::= context pathNameCS ERROR_TOKEN
33
		/.$BeginCode
34
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_INV_OR_DEF);
35
					CSTNode result = createClassifierContextDeclCS(
36
							(PathNameCS)$getSym(2),
37
							new BasicEList<InvOrDefCS>()
38
						);
39
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
40
					$setResult(result);
41
		  $EndCode
42
		./
43
		
44
	defExpressionCS ::= typedVariableCS ERROR_TOKEN
45
		/.$BeginCode
46
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_EQUALS);
47
					VariableCS variableCS = (VariableCS)$getSym(1);
48
					CSTNode result = createDefExpressionCS(
49
							variableCS,
50
							null,
51
							null
52
						);
53
					setOffsets(result, variableCS, getIToken($getToken(2)));
54
					$setResult(result);
55
		  $EndCode
56
		./
57
	defExpressionCS ::= IDENTIFIER ERROR_Colon
58
		/.$BeginCode
59
					VariableCS variableCS = createVariableCS(
60
								getTokenText($getToken(1)),
61
								null,
62
								null
63
							);
64
					setOffsets(variableCS, getIToken($getToken(1)), getIToken($getToken(2)));
65
					CSTNode result = createDefExpressionCS(
66
							variableCS,
67
							null,
68
							null
69
						);
70
					setOffsets(result, variableCS, getIToken($getToken(2)));
71
					$setResult(result);
72
		  $EndCode
73
		./
74
75
	initOrDerValueCS ::= initOrDerValueCSopt init ERROR_Colon
76
		/.$BeginCode
77
					CSTNode result = createInitValueCS(
78
							(InitOrDerValueCS)$getSym(1),
79
							null
80
						);
81
					if ($getSym(1) != null) {
82
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(3)));
83
					} else {
84
						setOffsets(result, getIToken($getToken(2)), getIToken($getToken(3)));
85
					}
86
					$setResult(result);
87
		  $EndCode
88
		./
89
	initOrDerValueCS ::= initOrDerValueCSopt derive ERROR_Colon
90
		/.$BeginCode
91
					CSTNode result = createDerValueCS(
92
							(InitOrDerValueCS)$getSym(1),
93
							null
94
						);
95
					if ($getSym(1) != null) {
96
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(3)));
97
					} else {
98
						setOffsets(result, getIToken($getToken(2)), getIToken($getToken(3)));
99
					}
100
					$setResult(result);
101
		  $EndCode
102
		./
103
		
104
	invOrDefCS ::= inv simpleNameCS ERROR_Colon
105
		/.$BeginCode
106
					CSTNode result = createInvCS(
107
							(SimpleNameCS)$getSym(2),
108
							null
109
						);
110
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
111
					$setResult(result);
112
		  $EndCode
113
		./	
114
	invOrDefCS ::= def simpleNameCS ERROR_Colon
115
		/.$BeginCode
116
					CSTNode result = createDefCS(
117
							(SimpleNameCS)$getSym(2),
118
							null
119
						);
120
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
121
					$setResult(result);
122
		  $EndCode
123
		./
124
125
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt ERROR_Empty endpackage
126
		/.$BeginCode
127
					CSTNode result = createPackageDeclarationCS(
128
							(PathNameCS)$getSym(2),
129
							(EList)$getSym(3)
130
						);
131
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
132
					$setResult(result);
133
		  $EndCode
134
		./
135
	packageDeclarationCS ::= package pathNameCS contextDeclCSmopt ERROR_TOKEN
136
		/.$BeginCode
137
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_ENDPACKAGE);
138
					CSTNode result = createPackageDeclarationCS(
139
							(PathNameCS)$getSym(2),
140
							(EList)$getSym(3)
141
						);
142
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
143
					$setResult(result);
144
		  $EndCode
145
		./
146
	packageDeclarationCS ::= package ERROR_PathNameCS
147
		/.$BeginCode
148
					CSTNode result = createPackageDeclarationCS(
149
							(PathNameCS)$getSym(2),
150
							new BasicEList()
151
						);
152
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
153
					$setResult(result);
154
		  $EndCode
155
		./
156
		
157
	prePostOrBodyDeclCS ::= pre simpleNameCS ERROR_Colon
158
		/.$BeginCode
159
					CSTNode result = createPrePostOrBodyDeclCS(
160
							PrePostOrBodyEnum.PRE_LITERAL,
161
							(SimpleNameCS)$getSym(2),
162
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
163
						);
164
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
165
					$setResult(result);
166
		  $EndCode
167
		./
168
	prePostOrBodyDeclCS ::= post simpleNameCS ERROR_Colon
169
		/.$BeginCode
170
					CSTNode result = createPrePostOrBodyDeclCS(
171
							PrePostOrBodyEnum.POST_LITERAL,
172
							(SimpleNameCS)$getSym(2),
173
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
174
						);
175
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
176
					$setResult(result);
177
		  $EndCode
178
		./
179
	prePostOrBodyDeclCS ::= body simpleNameCS ERROR_Colon
180
		/.$BeginCode
181
					CSTNode result = createPrePostOrBodyDeclCS(
182
							PrePostOrBodyEnum.BODY_LITERAL,
183
							(SimpleNameCS)$getSym(2),
184
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
185
						);
186
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
187
					$setResult(result);
188
		  $EndCode
189
		./
190
		
191
	propertyContextCS ::= context pathNameCS '::' ERROR_SimpleNameCS
192
		/.$BeginCode
193
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(4);
194
					CSTNode result = createPropertyContextCS(
195
							(PathNameCS)$getSym(2),
196
							simpleNameCS,
197
							null,
198
							null
199
						);
200
					setOffsets(result, getIToken($getToken(1)), simpleNameCS);
201
					$setResult(result);
202
		  $EndCode
203
		./
204
		
205
%End
(-)src/org/eclipse/ocl/parser/OCLKWLexer.gi (+547 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation  Zeligsoft Inc, Open Canarias S.L., and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
14
-- *
15
-- * </copyright>
16
-- *
17
-- * $Id: OCLKWLexer.g,v 1.1 2007/10/11 23:05:00 cdamus Exp $
18
-- */
19
--
20
-- The OCL KeyWord Lexer
21
--
22
23
%Options slr
24
%Options fp=OCLKWLexer,prefix=Char_
25
%options noserialize
26
%options package=org.eclipse.ocl.parser
27
%options template=../lpg/KeywordTemplateF.gi
28
%options export_terminals=("OCLParsersym.java", "TK_")
29
%options include_directory="../lpg"
30
31
%Define
32
33
	--
34
	-- Definition of macros used in the template
35
	--
36
	$action_class /.$file_prefix./
37
	$eof_char /.Char_EOF./
38
	$copyright_contributions /.*./
39
	
40
%End
41
42
%Notice
43
	/./**
44
 * <copyright>
45
 *
46
 * Copyright (c) 2005, 2009 IBM Corporation, Zeligsoft Inc, Open Canarias S.L., and others.
47
 * All rights reserved.   This program and the accompanying materials
48
 * are made available under the terms of the Eclipse Public License v1.0
49
 * which accompanies this distribution, and is available at
50
 * http://www.eclipse.org/legal/epl-v10.html
51
 *
52
 * Contributors:
53
 *   IBM - Initial API and implementation
54
 *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
55
 *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
56
$copyright_contributions
57
 * </copyright>
58
 *
59
 * 
60
 */
61
	./
62
%End
63
64
%Globals
65
	/../
66
%End
67
68
%Import
69
	KWLexerMapF.gi
70
%End
71
72
%Export
73
	self
74
	inv
75
	pre
76
	post
77
	context
78
	package
79
	endpackage
80
	def
81
	if
82
	then
83
	else
84
	endif
85
	and
86
	or
87
	xor
88
	not
89
	implies
90
	let
91
	in
92
	true
93
	false
94
95
	--
96
	-- the following appear to have been omitted from the list of
97
	-- OCL reserved words in Section 7.4.9.  They will be treated 
98
	-- as unreserved for compliance
99
	--
100
	body
101
	derive
102
	init
103
	null
104
	invalid
105
--  return  -- don't need a keyword for LPG purposes
106
	
107
	--
108
	-- the following are not used in the OCL concrete syntax, but
109
	-- are defined as reserved words in the Spec 7.4.9
110
	--
111
	attr
112
	oper
113
114
	--
115
	-- the remainder of the LPG keywords are defined as such for the
116
	-- purpose of constructing the CST grammar.  They are not OCL
117
	-- reserved words
118
	--		
119
	Set
120
	Bag
121
	Sequence
122
	Collection
123
	OrderedSet
124
125
	iterate
126
	forAll
127
	exists
128
	isUnique
129
	any
130
	one
131
132
	collect
133
	select
134
	reject
135
	collectNested
136
	sortedBy
137
138
	closure
139
140
	oclIsKindOf
141
	oclIsTypeOf
142
	oclAsType
143
	oclIsNew
144
	oclIsUndefined
145
	oclIsInvalid
146
	oclIsInState
147
	allInstances
148
149
	String
150
	Integer
151
	UnlimitedNatural
152
	Real
153
	Boolean
154
	Tuple
155
	OclAny
156
	OclVoid
157
	OclInvalid
158
	OclMessage
159
%End
160
161
%Start
162
	KeyWord
163
%End
164
165
%Rules
166
167
-- The Goal for the parser is a single Keyword
168
169
	KeyWord ::=
170
		s e l f
171
		/.$BeginAction
172
			$setResult($_self);
173
		  $EndAction
174
		./
175
176
		| i n v
177
		/.$BeginAction
178
			$setResult($_inv);
179
		  $EndAction
180
		./
181
182
		| p r e
183
		/.$BeginAction
184
			$setResult($_pre);
185
		  $EndAction
186
		./
187
188
		| p o s t
189
		/.$BeginAction
190
			$setResult($_post);
191
		  $EndAction
192
		./
193
		
194
		| b o d y
195
		/.$BeginAction
196
			$setResult($_body);
197
		  $EndAction
198
		./
199
		
200
		| c o n t e x t
201
		/.$BeginAction
202
			$setResult($_context);
203
		  $EndAction
204
		./
205
		
206
		| p a c k a g e
207
		/.$BeginAction
208
			$setResult($_package);
209
		  $EndAction
210
		./
211
		
212
		| e n d p a c k a g e
213
		/.$BeginAction
214
			$setResult($_endpackage);
215
		  $EndAction
216
		./
217
		
218
		| d e f
219
		/.$BeginAction
220
			$setResult($_def);
221
		  $EndAction
222
		./
223
		
224
		| d e r i v e
225
		/.$BeginAction
226
			$setResult($_derive);
227
		  $EndAction
228
		./
229
		
230
		| i n i t
231
		/.$BeginAction
232
			$setResult($_init);
233
		  $EndAction
234
		./
235
		
236
		| i f
237
		/.$BeginAction
238
			$setResult($_if);
239
		  $EndAction
240
		./
241
		
242
		| t h e n
243
		/.$BeginAction
244
			$setResult($_then);
245
		  $EndAction
246
		./
247
		
248
		| e l s e
249
		/.$BeginAction
250
			$setResult($_else);
251
		  $EndAction
252
		./
253
		
254
		| e n d i f
255
		/.$BeginAction
256
			$setResult($_endif);
257
		  $EndAction
258
		./
259
		
260
		| a n d
261
		/.$BeginAction
262
			$setResult($_and);
263
		  $EndAction
264
		./
265
		
266
		| o r
267
		/.$BeginAction
268
			$setResult($_or);
269
		  $EndAction
270
		./
271
		
272
		| x o r
273
		/.$BeginAction
274
			$setResult($_xor);
275
		  $EndAction
276
		./
277
		
278
		| n o t
279
		/.$BeginAction
280
			$setResult($_not);
281
		  $EndAction
282
		./
283
		
284
		| i m p l i e s
285
		/.$BeginAction
286
			$setResult($_implies);
287
		  $EndAction
288
		./
289
		
290
		| l e t
291
		/.$BeginAction
292
			$setResult($_let);
293
		  $EndAction
294
		./
295
		
296
		| i n
297
		/.$BeginAction
298
			$setResult($_in);
299
		  $EndAction
300
		./
301
		
302
		| t r u e
303
		/.$BeginAction
304
			$setResult($_true);
305
		  $EndAction
306
		./
307
		
308
		| f a l s e
309
		/.$BeginAction
310
			$setResult($_false);
311
		  $EndAction
312
		./
313
		
314
		| S e t
315
		/.$BeginAction
316
			$setResult($_Set);
317
		  $EndAction
318
		./
319
		
320
		| B a g
321
		/.$BeginAction
322
			$setResult($_Bag);
323
		  $EndAction
324
		./
325
		
326
		| S e q u e n c e
327
		/.$BeginAction
328
			$setResult($_Sequence);
329
		  $EndAction
330
		./
331
		
332
		| C o l l e c t i o n
333
		/.$BeginAction
334
			$setResult($_Collection);
335
		  $EndAction
336
		./
337
338
		| O r d e r e d S e t
339
		/.$BeginAction
340
			$setResult($_OrderedSet);
341
		  $EndAction
342
		./
343
344
		| i t e r a t e
345
		/.$BeginAction
346
			$setResult($_iterate);
347
		  $EndAction
348
		./
349
		
350
		| f o r A l l
351
		/.$BeginAction
352
			$setResult($_forAll);
353
		  $EndAction
354
		./
355
		
356
		| e x i s t s
357
		/.$BeginAction
358
			$setResult($_exists);
359
		  $EndAction
360
		./
361
		
362
		| i s U n i q u e
363
		/.$BeginAction
364
			$setResult($_isUnique);
365
		  $EndAction
366
		./
367
		
368
		| a n y
369
		/.$BeginAction
370
			$setResult($_any);
371
		  $EndAction
372
		./
373
		
374
		| o n e
375
		/.$BeginAction
376
			$setResult($_one);
377
		  $EndAction
378
		./
379
380
		| c o l l e c t
381
		/.$BeginAction
382
			$setResult($_collect);
383
		  $EndAction
384
		./
385
		
386
		| s e l e c t
387
		/.$BeginAction
388
			$setResult($_select);
389
		  $EndAction
390
		./
391
		
392
		| r e j e c t
393
		/.$BeginAction
394
			$setResult($_reject);
395
		  $EndAction
396
		./
397
		
398
		| c o l l e c t N e s t e d
399
		/.$BeginAction
400
			$setResult($_collectNested);
401
		  $EndAction
402
		./
403
		
404
		| s o r t e d B y
405
		/.$BeginAction
406
			$setResult($_sortedBy);
407
		  $EndAction
408
		./
409
410
		| c l o s u r e
411
		/.$BeginAction
412
			$setResult($_closure);
413
		  $EndAction
414
		./
415
		
416
		| o c l I s K i n d O f
417
		/.$BeginAction
418
			$setResult($_oclIsKindOf);
419
		  $EndAction
420
		./
421
422
		| o c l I s T y p e O f
423
		/.$BeginAction
424
			$setResult($_oclIsTypeOf);
425
		  $EndAction
426
		./
427
		
428
		| o c l A s T y p e
429
		/.$BeginAction
430
			$setResult($_oclAsType);
431
		  $EndAction
432
		./
433
		
434
		| o c l I s N e w
435
		/.$BeginAction
436
			$setResult($_oclIsNew);
437
		  $EndAction
438
		./
439
		
440
		| o c l I s U n d e f i n e d
441
		/.$BeginAction
442
			$setResult($_oclIsUndefined);
443
		  $EndAction
444
		./
445
		
446
		| o c l I s I n v a l i d
447
		/.$BeginAction
448
			$setResult($_oclIsInvalid);
449
		  $EndAction
450
		./
451
		
452
		| o c l I s I n S t a t e
453
		/.$BeginAction
454
			$setResult($_oclIsInState);
455
		  $EndAction
456
		./
457
		
458
		| a l l I n s t a n c e s
459
		/.$BeginAction
460
			$setResult($_allInstances);
461
		  $EndAction
462
		./
463
464
		| S t r i n g
465
		/.$BeginAction
466
			$setResult($_String);
467
		  $EndAction
468
		./
469
470
		| I n t e g e r
471
		/.$BeginAction
472
			$setResult($_Integer);
473
		  $EndAction
474
		./
475
		
476
		| U n l i m i t e d N a t u r a l
477
		/.$BeginAction
478
			$setResult($_UnlimitedNatural);
479
		  $EndAction
480
		./
481
		
482
		| R e a l
483
		/.$BeginAction
484
			$setResult($_Real);
485
		  $EndAction
486
		./
487
		
488
		| B o o l e a n
489
		/.$BeginAction
490
			$setResult($_Boolean);
491
		  $EndAction
492
		./
493
494
		| T u p l e
495
		/.$BeginAction
496
			$setResult($_Tuple);
497
		  $EndAction
498
		./
499
500
		| O c l A n y
501
		/.$BeginAction
502
			$setResult($_OclAny);
503
		  $EndAction
504
		./
505
506
		| O c l V o i d
507
		/.$BeginAction
508
			$setResult($_OclVoid);
509
		  $EndAction
510
		./
511
512
		| O c l I n v a l i d
513
		/.$BeginAction
514
			$setResult($_OclInvalid);
515
		  $EndAction
516
		./
517
518
		| O c l M e s s a g e
519
		/.$BeginAction
520
			$setResult($_OclMessage);
521
		  $EndAction
522
		./
523
524
		| n u l l
525
		/.$BeginAction
526
			$setResult($_null);
527
		  $EndAction
528
		./
529
530
		| i n v a l i d
531
		/.$BeginAction
532
			$setResult($_invalid);
533
		  $EndAction
534
		./
535
536
		| a t t r
537
		/.$BeginAction
538
			$setResult($_attr);
539
		  $EndAction
540
		./
541
542
		| o p e r
543
		/.$BeginAction
544
			$setResult($_oper);
545
		  $EndAction
546
		./
547
%End
(-)src/org/eclipse/ocl/lpg/KWLexerMapF.gi (+78 lines)
Added Link Here
1
%Terminals
2
    DollarSign ::= '$'
3
    Percent ::= '%'
4
    _
5
    a b c d e f g h i j k l m n o p q r s t u v w x y z
6
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
7
%End
8
9
%Headers
10
    /.
11
        final static int tokenKind[] = new int[128];
12
        static
13
        {
14
            tokenKind['$'] = $sym_type.$prefix$DollarSign$suffix$;
15
            tokenKind['%'] = $sym_type.$prefix$Percent$suffix$;
16
            tokenKind['_'] = $sym_type.$prefix$_$suffix$;
17
18
            tokenKind['a'] = $sym_type.$prefix$a$suffix$;
19
            tokenKind['b'] = $sym_type.$prefix$b$suffix$;
20
            tokenKind['c'] = $sym_type.$prefix$c$suffix$;
21
            tokenKind['d'] = $sym_type.$prefix$d$suffix$;
22
            tokenKind['e'] = $sym_type.$prefix$e$suffix$;
23
            tokenKind['f'] = $sym_type.$prefix$f$suffix$;
24
            tokenKind['g'] = $sym_type.$prefix$g$suffix$;
25
            tokenKind['h'] = $sym_type.$prefix$h$suffix$;
26
            tokenKind['i'] = $sym_type.$prefix$i$suffix$;
27
            tokenKind['j'] = $sym_type.$prefix$j$suffix$;
28
            tokenKind['k'] = $sym_type.$prefix$k$suffix$;
29
            tokenKind['l'] = $sym_type.$prefix$l$suffix$;
30
            tokenKind['m'] = $sym_type.$prefix$m$suffix$;
31
            tokenKind['n'] = $sym_type.$prefix$n$suffix$;
32
            tokenKind['o'] = $sym_type.$prefix$o$suffix$;
33
            tokenKind['p'] = $sym_type.$prefix$p$suffix$;
34
            tokenKind['q'] = $sym_type.$prefix$q$suffix$;
35
            tokenKind['r'] = $sym_type.$prefix$r$suffix$;
36
            tokenKind['s'] = $sym_type.$prefix$s$suffix$;
37
            tokenKind['t'] = $sym_type.$prefix$t$suffix$;
38
            tokenKind['u'] = $sym_type.$prefix$u$suffix$;
39
            tokenKind['v'] = $sym_type.$prefix$v$suffix$;
40
            tokenKind['w'] = $sym_type.$prefix$w$suffix$;
41
            tokenKind['x'] = $sym_type.$prefix$x$suffix$;
42
            tokenKind['y'] = $sym_type.$prefix$y$suffix$;
43
            tokenKind['z'] = $sym_type.$prefix$z$suffix$;
44
45
            tokenKind['A'] = $sym_type.$prefix$A$suffix$;
46
            tokenKind['B'] = $sym_type.$prefix$B$suffix$;
47
            tokenKind['C'] = $sym_type.$prefix$C$suffix$;
48
            tokenKind['D'] = $sym_type.$prefix$D$suffix$;
49
            tokenKind['E'] = $sym_type.$prefix$E$suffix$;
50
            tokenKind['F'] = $sym_type.$prefix$F$suffix$;
51
            tokenKind['G'] = $sym_type.$prefix$G$suffix$;
52
            tokenKind['H'] = $sym_type.$prefix$H$suffix$;
53
            tokenKind['I'] = $sym_type.$prefix$I$suffix$;
54
            tokenKind['J'] = $sym_type.$prefix$J$suffix$;
55
            tokenKind['K'] = $sym_type.$prefix$K$suffix$;
56
            tokenKind['L'] = $sym_type.$prefix$L$suffix$;
57
            tokenKind['M'] = $sym_type.$prefix$M$suffix$;
58
            tokenKind['N'] = $sym_type.$prefix$N$suffix$;
59
            tokenKind['O'] = $sym_type.$prefix$O$suffix$;
60
            tokenKind['P'] = $sym_type.$prefix$P$suffix$;
61
            tokenKind['Q'] = $sym_type.$prefix$Q$suffix$;
62
            tokenKind['R'] = $sym_type.$prefix$R$suffix$;
63
            tokenKind['S'] = $sym_type.$prefix$S$suffix$;
64
            tokenKind['T'] = $sym_type.$prefix$T$suffix$;
65
            tokenKind['U'] = $sym_type.$prefix$U$suffix$;
66
            tokenKind['V'] = $sym_type.$prefix$V$suffix$;
67
            tokenKind['W'] = $sym_type.$prefix$W$suffix$;
68
            tokenKind['X'] = $sym_type.$prefix$X$suffix$;
69
            tokenKind['Y'] = $sym_type.$prefix$Y$suffix$;
70
            tokenKind['Z'] = $sym_type.$prefix$Z$suffix$;
71
        };
72
    
73
        final int getKind(char c)
74
        {
75
            return (((c & 0xFFFFFF80) == 0) /* 0 <= c < 128? */ ? tokenKind[c] : 0);
76
        }
77
    ./
78
%End
(-)src/org/eclipse/ocl/lpg/LexerBasicMapF.gi (+269 lines)
Added Link Here
1
%Headers
2
    --
3
    -- Additional methods for the action class not provided in the template
4
    --
5
    
6
	--
7
	-- In grammar file including this .gi file should define the following macros
8
	--        $kw_lexeR_class  => the keyword lexer class
9
	--        $super_stream_class => the class which the generated lexer inherits from
10
	--
11
    -- [cwd] Template provided by LPG defines a constructor that uses an Option
12
    --       class that does not exist in LPG Runtime.  Deleted this constructor
13
    
14
    -- [adolfosbh] The previous old cwd's comment has been corrected in this
15
    --       template version   
16
17
    -- [adolfosbh] a constructor method has been moved to LexerTemplate D.gi file	
18
    /.
19
        //
20
        // The Lexer contains an array of characters as the input stream to be parsed.
21
        // There are methods to retrieve and classify characters.
22
        // The lexparser "token" is implemented simply as the index of the next character in the array.
23
        // The Lexer extends the abstract class LpgLexStream with an implementation of the abstract
24
        // method getKind.  The template defines the Lexer class and the lexer() method.
25
        // A driver creates the action class, "Lexer", passing an Option object to the constructor.
26
        //
27
        $kw_lexer_class kwLexer;
28
        boolean printTokens;
29
        private final static int ECLIPSE_TAB_VALUE = 4;
30
31
        public int [] getKeywordKinds() { return kwLexer.getKeywordKinds(); }
32
33
34
        /**
35
         * @deprecated function replaced by {@link #reset(char [] content, String filename)}
36
         */
37
        public void initialize(char [] content, String filename)
38
        {
39
            reset(content, filename);
40
        }
41
        
42
        final void makeToken(int left_token, int right_token, int kind)
43
        {
44
            lexStream.makeToken(left_token, right_token, kind);
45
        }
46
        
47
        final void makeToken(int kind)
48
        {
49
            int startOffset = getLeftSpan(),
50
                endOffset = getRightSpan();
51
            lexStream.makeToken(startOffset, endOffset, kind);
52
            if (printTokens) printValue(startOffset, endOffset);
53
        }
54
55
        final void makeComment(int kind)
56
        {
57
            int startOffset = getLeftSpan(),
58
                endOffset = getRightSpan();
59
            lexStream.getIPrsStream().makeAdjunct(startOffset, endOffset, kind);
60
        }
61
62
        final void skipToken()
63
        {
64
            if (printTokens) printValue(getLeftSpan(), getRightSpan());
65
        }
66
        
67
        final void checkForKeyWord()
68
        {
69
            int startOffset = getLeftSpan(),
70
                endOffset = getRightSpan(),
71
                kwKind = kwLexer.lexer(startOffset, endOffset);
72
            lexStream.makeToken(startOffset, endOffset, kwKind);
73
            if (printTokens) printValue(startOffset, endOffset);
74
        }
75
        
76
        //
77
        // This flavor of checkForKeyWord is necessary when the default kind
78
        // (which is returned when the keyword filter doesn't match) is something
79
        // other than _IDENTIFIER.
80
        //
81
        final void checkForKeyWord(int defaultKind)
82
        {
83
            int startOffset = getLeftSpan(),
84
                endOffset = getRightSpan(),
85
                kwKind = kwLexer.lexer(startOffset, endOffset);
86
            if (kwKind == $_IDENTIFIER)
87
                kwKind = defaultKind;
88
            lexStream.makeToken(startOffset, endOffset, kwKind);
89
            if (printTokens) printValue(startOffset, endOffset);
90
        }
91
        
92
        final void printValue(int startOffset, int endOffset)
93
        {
94
            String s = new String(lexStream.getInputChars(), startOffset, endOffset - startOffset + 1);
95
            System.out.print(s);
96
        }
97
98
        //
99
        //
100
        //
101
        static class $super_stream_class extends AbstractLexerStream
102
        {
103
        public final static int tokenKind[] =
104
        {
105
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 000    0x00
106
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 001    0x01
107
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 002    0x02
108
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 003    0x03
109
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 004    0x04
110
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 005    0x05
111
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 006    0x06
112
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 007    0x07
113
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 008    0x08
114
            $sym_type.$prefix$HT$suffix$,              // 009    0x09
115
            $sym_type.$prefix$LF$suffix$,              // 010    0x0A
116
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 011    0x0B
117
            $sym_type.$prefix$FF$suffix$,              // 012    0x0C
118
            $sym_type.$prefix$CR$suffix$,              // 013    0x0D
119
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 014    0x0E
120
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 015    0x0F
121
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 016    0x10
122
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 017    0x11
123
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 018    0x12
124
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 019    0x13
125
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 020    0x14
126
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 021    0x15
127
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 022    0x16
128
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 023    0x17
129
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 024    0x18
130
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 025    0x19
131
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 026    0x1A
132
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 027    0x1B
133
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 028    0x1C
134
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 029    0x1D
135
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 030    0x1E
136
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 031    0x1F
137
            $sym_type.$prefix$Space$suffix$,           // 032    0x20
138
            $sym_type.$prefix$Exclamation$suffix$,     // 033    0x21
139
            $sym_type.$prefix$DoubleQuote$suffix$,     // 034    0x22
140
            $sym_type.$prefix$Sharp$suffix$,           // 035    0x23
141
            $sym_type.$prefix$DollarSign$suffix$,      // 036    0x24
142
            $sym_type.$prefix$Percent$suffix$,         // 037    0x25
143
            $sym_type.$prefix$Ampersand$suffix$,       // 038    0x26
144
            $sym_type.$prefix$SingleQuote$suffix$,     // 039    0x27
145
            $sym_type.$prefix$LeftParen$suffix$,       // 040    0x28
146
            $sym_type.$prefix$RightParen$suffix$,      // 041    0x29
147
            $sym_type.$prefix$Star$suffix$,            // 042    0x2A
148
            $sym_type.$prefix$Plus$suffix$,            // 043    0x2B
149
            $sym_type.$prefix$Comma$suffix$,           // 044    0x2C
150
            $sym_type.$prefix$Minus$suffix$,           // 045    0x2D
151
            $sym_type.$prefix$Dot$suffix$,             // 046    0x2E
152
            $sym_type.$prefix$Slash$suffix$,           // 047    0x2F
153
            $sym_type.$prefix$0$suffix$,               // 048    0x30
154
            $sym_type.$prefix$1$suffix$,               // 049    0x31
155
            $sym_type.$prefix$2$suffix$,               // 050    0x32
156
            $sym_type.$prefix$3$suffix$,               // 051    0x33
157
            $sym_type.$prefix$4$suffix$,               // 052    0x34
158
            $sym_type.$prefix$5$suffix$,               // 053    0x35
159
            $sym_type.$prefix$6$suffix$,               // 054    0x36
160
            $sym_type.$prefix$7$suffix$,               // 055    0x37
161
            $sym_type.$prefix$8$suffix$,               // 056    0x38
162
            $sym_type.$prefix$9$suffix$,               // 057    0x39
163
            $sym_type.$prefix$Colon$suffix$,           // 058    0x3A
164
            $sym_type.$prefix$SemiColon$suffix$,       // 059    0x3B
165
            $sym_type.$prefix$LessThan$suffix$,        // 060    0x3C
166
            $sym_type.$prefix$Equal$suffix$,           // 061    0x3D
167
            $sym_type.$prefix$GreaterThan$suffix$,     // 062    0x3E
168
            $sym_type.$prefix$QuestionMark$suffix$,    // 063    0x3F
169
            $sym_type.$prefix$AtSign$suffix$,          // 064    0x40
170
            $sym_type.$prefix$A$suffix$,               // 065    0x41
171
            $sym_type.$prefix$B$suffix$,               // 066    0x42
172
            $sym_type.$prefix$C$suffix$,               // 067    0x43
173
            $sym_type.$prefix$D$suffix$,               // 068    0x44
174
            $sym_type.$prefix$E$suffix$,               // 069    0x45
175
            $sym_type.$prefix$F$suffix$,               // 070    0x46
176
            $sym_type.$prefix$G$suffix$,               // 071    0x47
177
            $sym_type.$prefix$H$suffix$,               // 072    0x48
178
            $sym_type.$prefix$I$suffix$,               // 073    0x49
179
            $sym_type.$prefix$J$suffix$,               // 074    0x4A
180
            $sym_type.$prefix$K$suffix$,               // 075    0x4B
181
            $sym_type.$prefix$L$suffix$,               // 076    0x4C
182
            $sym_type.$prefix$M$suffix$,               // 077    0x4D
183
            $sym_type.$prefix$N$suffix$,               // 078    0x4E
184
            $sym_type.$prefix$O$suffix$,               // 079    0x4F
185
            $sym_type.$prefix$P$suffix$,               // 080    0x50
186
            $sym_type.$prefix$Q$suffix$,               // 081    0x51
187
            $sym_type.$prefix$R$suffix$,               // 082    0x52
188
            $sym_type.$prefix$S$suffix$,               // 083    0x53
189
            $sym_type.$prefix$T$suffix$,               // 084    0x54
190
            $sym_type.$prefix$U$suffix$,               // 085    0x55
191
            $sym_type.$prefix$V$suffix$,               // 086    0x56
192
            $sym_type.$prefix$W$suffix$,               // 087    0x57
193
            $sym_type.$prefix$X$suffix$,               // 088    0x58
194
            $sym_type.$prefix$Y$suffix$,               // 089    0x59
195
            $sym_type.$prefix$Z$suffix$,               // 090    0x5A
196
            $sym_type.$prefix$LeftBracket$suffix$,     // 091    0x5B
197
            $sym_type.$prefix$BackSlash$suffix$,       // 092    0x5C
198
            $sym_type.$prefix$RightBracket$suffix$,    // 093    0x5D
199
            $sym_type.$prefix$Caret$suffix$,           // 094    0x5E
200
            $sym_type.$prefix$_$suffix$,               // 095    0x5F
201
            $sym_type.$prefix$BackQuote$suffix$,       // 096    0x60
202
            $sym_type.$prefix$a$suffix$,               // 097    0x61
203
            $sym_type.$prefix$b$suffix$,               // 098    0x62
204
            $sym_type.$prefix$c$suffix$,               // 099    0x63
205
            $sym_type.$prefix$d$suffix$,               // 100    0x64
206
            $sym_type.$prefix$e$suffix$,               // 101    0x65
207
            $sym_type.$prefix$f$suffix$,               // 102    0x66
208
            $sym_type.$prefix$g$suffix$,               // 103    0x67
209
            $sym_type.$prefix$h$suffix$,               // 104    0x68
210
            $sym_type.$prefix$i$suffix$,               // 105    0x69
211
            $sym_type.$prefix$j$suffix$,               // 106    0x6A
212
            $sym_type.$prefix$k$suffix$,               // 107    0x6B
213
            $sym_type.$prefix$l$suffix$,               // 108    0x6C
214
            $sym_type.$prefix$m$suffix$,               // 109    0x6D
215
            $sym_type.$prefix$n$suffix$,               // 110    0x6E
216
            $sym_type.$prefix$o$suffix$,               // 111    0x6F
217
            $sym_type.$prefix$p$suffix$,               // 112    0x70
218
            $sym_type.$prefix$q$suffix$,               // 113    0x71
219
            $sym_type.$prefix$r$suffix$,               // 114    0x72
220
            $sym_type.$prefix$s$suffix$,               // 115    0x73
221
            $sym_type.$prefix$t$suffix$,               // 116    0x74
222
            $sym_type.$prefix$u$suffix$,               // 117    0x75
223
            $sym_type.$prefix$v$suffix$,               // 118    0x76
224
            $sym_type.$prefix$w$suffix$,               // 119    0x77
225
            $sym_type.$prefix$x$suffix$,               // 120    0x78
226
            $sym_type.$prefix$y$suffix$,               // 121    0x79
227
            $sym_type.$prefix$z$suffix$,               // 122    0x7A
228
            $sym_type.$prefix$LeftBrace$suffix$,       // 123    0x7B
229
            $sym_type.$prefix$VerticalBar$suffix$,     // 124    0x7C
230
            $sym_type.$prefix$RightBrace$suffix$,      // 125    0x7D
231
            $sym_type.$prefix$Tilde$suffix$,           // 126    0x7E
232
            $sym_type.$prefix$CtlCharNotWS$suffix$,    // 127    0x7F
233
234
            $sym_type.$prefix$Acute$suffix$,           // for the acute accent 0xb4
235
            $sym_type.$prefix$AfterASCIINotAcute$suffix$,      // for all chars in range 0x80..0xfffe excluding the acute accent
236
            $sym_type.$prefix$EOF$suffix$              // for '\uffff' or 65535 
237
        };
238
                
239
        public final int getKind(int i)  // Classify character at ith location
240
        {
241
            char c = (i >= getStreamLength() ? '\uffff' : getCharValue(i));
242
            return (c < 128) // ASCII Character
243
                      ? tokenKind[c] 
244
                      : (c == '\uffff')
245
	                      ?$sym_type.$prefix$EOF$suffix$
246
	                      : (c == '\u00b4')
247
                                ? $sym_type.$prefix$EOF$suffix$
248
                                : $sym_type.$prefix$AfterASCIINotAcute$suffix$;
249
        }
250
251
        public String[] orderedExportedSymbols() { return $exp_type.orderedTerminalSymbols; }
252
253
        public $super_stream_class($environment_class environment, String filename, int tab) throws java.io.IOException
254
        {
255
            super($adapt_environment, filename, tab);
256
        }
257
258
        public $super_stream_class($environment_class environment, char[] input_chars, String filename, int tab)
259
        {
260
            super($adapt_environment, input_chars, filename, tab);
261
        }
262
    
263
        public $super_stream_class($environment_class environment, char[] input_chars, String filename)
264
        {
265
            super($adapt_environment, input_chars, filename, 1);
266
        }
267
        }
268
    ./
269
%End
(-)src/org/eclipse/ocl/lpg/AbstractLexerStream.java (+63 lines)
Added Link Here
1
package org.eclipse.ocl.lpg;
2
3
import lpg.runtime.LpgLexStream;
4
5
6
/**
7
 * @since 3.0
8
 */
9
public abstract class AbstractLexerStream extends LpgLexStream {
10
	
11
	protected final static int ECLIPSE_TAB_VALUE = 4;	
12
	private BasicEnvironment environment;
13
	
14
    public AbstractLexerStream(BasicEnvironment environment, String filename, int tab) throws java.io.IOException 
15
    {
16
        super(filename, tab);
17
        this.environment = environment;
18
    }
19
20
    public AbstractLexerStream(BasicEnvironment environment, char[] input_chars, String filename, int tab)
21
    {
22
        super(input_chars, filename, tab);
23
        this.environment = environment;
24
    }
25
26
    public AbstractLexerStream() {
27
    	super();
28
    	setTab(ECLIPSE_TAB_VALUE);
29
    }
30
    
31
	protected int computeErrorCode(int leftToken, int rightToken) {
32
		if (rightToken >= getStreamLength())
33
		    return EOF_CODE;
34
		else if (leftToken == rightToken)
35
		    return LEX_ERROR_CODE;
36
		else
37
			return INVALID_TOKEN_CODE;
38
	}
39
	
40
    /**
41
	 * Define the input text as a given array of characters.
42
     * @param buffer the characters
43
     */
44
	public void initialize(char[] inputChars) {	
45
		setInputChars(inputChars);
46
        setStreamLength(inputChars.length);
47
        computeLineOffsets();
48
	}
49
	
50
	/**
51
	 * Errors generated within the lexer are redirected to the error handler if there is one.
52
	 * 
53
	 * Note that other variants of reportError either feed this one, are fed from a default implementation
54
	 * of this one or originate in the parser, where a ParserErrorHandler can intercept them.
55
	 */
56
	public void reportError(int errorCode, int leftToken, int errorToken,
57
			int rightToken, String[] errorInfo) {
58
		if (environment != null)
59
			environment.lexerError(errorCode, errorToken, rightToken);
60
		reportError(errorCode, leftToken, errorToken, rightToken, errorInfo);
61
	}
62
63
}
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingKWLexer.gi (+35 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 IBM Corporation, Open Canarias S.L. and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
14
-- *
15
-- * </copyright>
16
-- *
17
-- * $Id: OCLBacktrackingKWLexer.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
18
-- */
19
--
20
-- The OCL Backtracking KeyWord Lexer, which is nominally identical to the
21
-- normal KeyWord Lexer, however the extra ERROR_TOKEN symbol makes it difficult
22
-- to share reliably.
23
--
24
25
%options slr
26
%options fp=OCLBacktrackingKWLexer,prefix=Char_
27
%options noserialize
28
%options package=org.eclipse.ocl.parser.backtracking
29
%options template=../../lpg/KeywordTemplateF.gi
30
%options export_terminals=("OCLBacktrackingParsersym.java", "TK_")
31
%options include_directory="..;../../lpg"
32
33
%Import
34
	OCLKWLexer.gi
35
%End
(-)src/org/eclipse/ocl/lpg/OCLParserStream.java (+150 lines)
Added Link Here
1
package org.eclipse.ocl.lpg;
2
3
import java.util.ArrayList;
4
5
import lpg.runtime.ErrorToken;
6
import lpg.runtime.ILexStream;
7
import lpg.runtime.IToken;
8
import lpg.runtime.PrsStream;
9
import lpg.runtime.Token;
10
11
12
/**
13
 * @since 3.0
14
 */
15
public class OCLParserStream extends PrsStream {
16
	
17
	 private BasicEnvironment environment;
18
	 
19
	 public OCLParserStream(BasicEnvironment env, ILexStream iLexStream) {
20
		 super(iLexStream);
21
		 this.environment = env;
22
	 }
23
	 
24
	 @Override
25
		public void reportError(int errorCode, int leftToken, int errorToken,
26
				int rightToken, String errorInfo[]) {		
27
			if (environment == null) {
28
				super.reportError(errorCode, leftToken, errorToken, rightToken, errorInfo);
29
			} else {
30
				// TODO Revise this. BasicEnvironment.parserError doesn't have a String[] argument
31
				String tokenText = errorInfo.length > 0 ? errorInfo[0] : ""; //$NON-NLS-1$		
32
				if (errorCode == PrsStream.DELETION_CODE || errorCode == PrsStream.MISPLACED_CODE) {
33
					tokenText = ""; //$NON-NLS-1$
34
				}
35
				environment
36
					.parserError(errorCode, leftToken, rightToken, tokenText); 
37
			}
38
		}
39
	/**
40
	 * Overridden to search only the non-Error nodes, which are the only tokens
41
	 * in monotonic order.
42
	 */
43
	@Override
44
	public int getTokenIndexAtCharacter(int offset) {
45
		int low = 0;
46
		int high = getSize();
47
		while (high > low) {
48
			IToken highToken = getTokenAt(high - 1);
49
			if (!(highToken instanceof ErrorToken)) {
50
				break;
51
			}
52
			high--;
53
		}
54
		while (high > low) {
55
			int mid = (high + low) / 2;
56
			IToken mid_element = getTokenAt(mid);
57
			if (offset >= mid_element.getStartOffset()
58
				&& offset <= mid_element.getEndOffset()) {
59
				return mid;
60
			} else if (offset < mid_element.getStartOffset()) {
61
				high = mid;
62
			} else {
63
				low = mid + 1;
64
			}
65
		}
66
67
		return -(low - 1);
68
	}
69
	
70
	@Override
71
	public int makeErrorToken(int firsttok, int lasttok, int errortok, int kind) {
72
		@SuppressWarnings("unchecked")
73
		ArrayList<IToken> tokens = getTokens();
74
		int index = tokens.size(); // the next index
75
76
		//
77
		// Note that when creating an error token, we do not remap its kind.
78
		// Since this is not a lexical operation, it is the responsibility of
79
		// the calling program (a parser driver) to pass to us the proper kind
80
		// that it wants for an error token.
81
		//
82
		Token token = new ErrorToken(getIToken(firsttok), getIToken(lasttok),
83
			getIToken(errortok), getStartOffset(firsttok),
84
			getEndOffset(lasttok), kind) {
85
86
			@Override
87
			public String toString() {
88
				if (getIPrsStream() == null) {
89
					return "<toString>"; //$NON-NLS-1$
90
				}
91
				int startOffset = getStartOffset();
92
				int length = getEndOffset() - startOffset;
93
				if (length < 0) {
94
					length = -length - 1;
95
					startOffset = getEndOffset();
96
				}
97
				if ((startOffset + length) > getIPrsStream().getInputChars().length) {
98
					return String.valueOf(IToken.EOF);
99
				}
100
				return new String(getIPrsStream().getInputChars(), startOffset,
101
					length);
102
			}
103
104
		};
105
		token.setTokenIndex(index);
106
		tokens.add(token);
107
		token.setAdjunctIndex(getAdjuncts().size());
108
		return index;
109
	}
110
111
	/**
112
	 * @since 1.3
113
	 */
114
	public int getErrorTokens() {
115
		return getTokens().size() - getStreamLength();
116
	}
117
118
	/**
119
	 * This function returns the index of the token element containing the
120
	 * offset specified. If such a token does not exist, it returns the negation
121
	 * of the index of the element immediately preceding the offset.
122
	 * 
123
	 * @since 1.3
124
	 */
125
	public ErrorToken getErrorTokenAtCharacter(int offset) {
126
		ErrorToken bestToken = null;
127
		for (int i = getSize(); --i >= 0;) {
128
			IToken token = getTokenAt(i);
129
			if (!(token instanceof ErrorToken)) {
130
				break;
131
			}
132
			IToken errorToken = ((ErrorToken) token).getErrorToken();
133
			if (offset >= errorToken.getStartOffset()
134
				&& offset <= errorToken.getEndOffset()) {
135
				if ((bestToken == null)
136
					|| ((bestToken.getStartOffset() <= errorToken
137
						.getStartOffset()) && (token.getEndOffset() <= errorToken
138
						.getEndOffset()))) {
139
					bestToken = (ErrorToken) token;
140
				}
141
			}
142
		}
143
		return bestToken;
144
	}
145
	public AbstractLexer getLexer() {
146
		return (AbstractLexer) super.getILexStream();
147
	}
148
	
149
	
150
}
(-)src/org/eclipse/ocl/lpg/dtParserTemplateF.gi (+377 lines)
Added Link Here
1
--
2
-- In a parser using this template, the following macro may be redefined:
3
--
4
--     $additional_interfaces
5
--     $ast_class
6
--
7
-- B E G I N N I N G   O F   T E M P L A T E   dtParserTemplateF
8
--
9
%Options programming_language=java,margin=4
10
%Options table,error_maps,scopes
11
%Options prefix=TK_
12
%Options action-block=("*.java", "/.", "./")
13
%Options ParseTable=lpg.runtime.ParseTable
14
15
--
16
-- This template requires that the name of the EOF token be set
17
-- to EOF_TOKEN to be consistent with LexerTemplateD and LexerTemplateE
18
--
19
%EOF
20
    EOF_TOKEN
21
%End
22
23
%ERROR
24
    ERROR_TOKEN
25
%End
26
27
%Define
28
	$Header
29
	/.
30
				//
31
				// Rule $rule_number:  $rule_text
32
				//
33
				./
34
35
    $BeginAction
36
    /.$Header$case $rule_number: {./
37
38
    $EndAction
39
    /.                break;
40
                }./
41
42
	-- BeginJava does nothing
43
	-- block-actions should call BeginCode, instead
44
    $BeginJava /../
45
    
46
  	-- EndJava does nothing
47
	-- block-actions should call EndCode, instead
48
	$EndJava /../
49
	
50
	$BeginCode
51
	/.$BeginAction
52
					$symbol_declarations./
53
54
	$EndCode /.$EndAction./
55
56
    $NoAction
57
    /.$Header$case $rule_number:
58
                    break;./
59
60
    $BadAction
61
    /.$Header$case $rule_number:
62
                    throw new Error("No action specified for rule " + $rule_number);./
63
64
    $NullAction
65
    /.$Header$case $rule_number:
66
                    setResult(null);
67
                    break;./
68
69
	$EmptyListAction
70
	/. $Header
71
				case $rule_number:
72
					setResult(new BasicEList());
73
					break;./
74
	
75
	$BeginActions
76
	/.
77
		@SuppressWarnings("unchecked")
78
        public void ruleAction(int ruleNumber)
79
        {
80
            switch (ruleNumber)
81
            {./
82
            
83
    $SplitActions
84
    /.
85
	            default:
86
	                ruleAction$rule_number(ruleNumber);
87
	                break;
88
	        }
89
	        return;
90
	    }
91
	
92
	    public void ruleAction$rule_number(int ruleNumber)
93
	    {
94
	        switch (ruleNumber)
95
	        {./
96
97
	$EndActions
98
	/.
99
				default:
100
					break;
101
			}
102
			return;
103
		}./
104
105
    $entry_declarations
106
    /.
107
        public $ast_class parse$entry_name()
108
        {
109
            return parse$entry_name(null, getDefaultRepairCount());
110
        }
111
            
112
        public $ast_class parse$entry_name(Monitor monitor)
113
        {
114
            return parse$entry_name(monitor, getDefaultRepairCount());
115
        }
116
            
117
        public $ast_class parse$entry_name(int error_repair_count)
118
        {
119
            return parse$entry_name(null, error_repair_count);
120
        }
121
            
122
        public void resetParse$entry_name()
123
        {
124
            dtParser.resetParserEntry($sym_type.$entry_marker);
125
        }
126
        
127
        public $ast_class parse$entry_name(Monitor monitor, int error_repair_count)
128
        {
129
            dtParser.setMonitor(monitor);
130
            
131
            try
132
            {
133
                return ($ast_class) dtParser.parseEntry($sym_type.$entry_marker);
134
            }
135
            catch (BadParseException e)
136
            {
137
                prsStream.reset(e.error_token); // point to error token
138
139
                DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable);
140
                diagnoseParser.diagnoseEntry($sym_type.$entry_marker, e.error_token);
141
            }
142
143
            return null;
144
        }
145
    ./
146
        
147
	$additional_interfaces /../
148
	$ast_class /.$ast_type./
149
	$unimplemented_symbols_warning /.false./
150
151
    $setSym1 /. // macro setSym1 is deprecated. Use function setResult
152
                getParser().setSym1./
153
    $setResult /. // macro setResult is deprecated. Use function setResult
154
                 getParser().setSym1./
155
    $getSym /. // macro getSym is deprecated. Use function getRhsSym
156
              getParser().getSym./
157
    $getToken /. // macro getToken is deprecated. Use function getRhsTokenIndex
158
                getParser().getToken./
159
    $getIToken /. // macro getIToken is deprecated. Use function getRhsIToken
160
                 prsStream.getIToken./
161
    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan
162
                   getParser().getFirstToken./
163
    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan
164
                    getParser().getLastToken./
165
	
166
	$prs_stream /.prsStream./ -- DEPRECATED
167
	
168
	-- modified to include throwing exceptions
169
	$parserCore
170
	/.
171
172
	./
173
	-- OCL ADDITIONS
174
	
175
	-- Definition of macros used in the parser template
176
	--
177
	$super_parser_class /.AbstractOCLParser./
178
	$prs_stream_class /.OCLParserStream./		
179
	$prs_parser_class /.DeterministicParser./	
180
	$prs_parser_exception /.NotDeterministicParseTableException./
181
	$prs_parser_throw /.throw new RuntimeException("****Error: Regenerate $prs_type.java with -NOBACKTRACK option")./
182
	$prs_parse_args /../
183
	$lex_stream_class /.AbstractLexer./
184
	$action_class /.$file_prefix./  -- DEPRECATED
185
	$copyright_contributions /.*./
186
187
	-- package namespace of the LPG Runtime API
188
	$lpg_ns /.lpg.runtime./
189
190
	$NewCase
191
	/. $Header
192
				case $rule_number:./
193
%End
194
195
%Headers
196
    /.
197
   	public class $action_type extends $super_parser_class implements RuleAction$additional_interfaces
198
	{
199
		private $prs_stream_class prsStream = null;
200
		
201
		private boolean unimplementedSymbolsWarning = $unimplemented_symbols_warning;
202
203
		private static ParseTable prsTable = new $prs_type();
204
		public ParseTable getParseTable() { return prsTable; }
205
		
206
		private $prs_parser_class dtParser = null;
207
		public $prs_parser_class getParser() { return dtParser; }
208
		
209
		 private void setResult(Object object) { dtParser.setSym1(object); }
210
        public Object getRhsSym(int i) { return dtParser.getSym(i); }
211
212
        public int getRhsTokenIndex(int i) { return dtParser.getToken(i); }
213
        public IToken getRhsIToken(int i) { return prsStream.getIToken(getRhsTokenIndex(i)); }
214
        
215
        public int getRhsFirstTokenIndex(int i) { return dtParser.getFirstToken(i); }
216
        public IToken getRhsFirstIToken(int i) { return prsStream.getIToken(getRhsFirstTokenIndex(i)); }
217
218
        public int getRhsLastTokenIndex(int i) { return dtParser.getLastToken(i); }
219
        public IToken getRhsLastIToken(int i) { return prsStream.getIToken(getRhsLastTokenIndex(i)); }
220
221
        public int getLeftSpan() { return dtParser.getFirstToken(); }
222
        public IToken getLeftIToken()  { return prsStream.getIToken(getLeftSpan()); }
223
224
        public int getRightSpan() { return dtParser.getLastToken(); }
225
        public IToken getRightIToken() { return prsStream.getIToken(getRightSpan()); }
226
227
        public int getRhsErrorTokenIndex(int i)
228
        {
229
            int index = dtParser.getToken(i);
230
            IToken err = prsStream.getIToken(index);
231
            return (err instanceof ErrorToken ? index : 0);
232
        }
233
        public ErrorToken getRhsErrorIToken(int i)
234
        {
235
            int index = dtParser.getToken(i);
236
            IToken err = prsStream.getIToken(index);
237
            return (ErrorToken) (err instanceof ErrorToken ? err : null);
238
        }
239
240
		public void reset(ILexStream lexStream)
241
        {
242
            prsStream = new $prs_stream_class(getEnvironment(), lexStream);
243
            dtParser.reset(prsStream);
244
245
            try
246
            {
247
                prsStream.remapTerminalSymbols(orderedTerminalSymbols(), prsTable.getEoftSymbol());
248
            }
249
            catch(NullExportedSymbolsException e) {
250
            }
251
            catch(NullTerminalSymbolsException e) {
252
            }
253
            catch(UnimplementedTerminalsException e)
254
            {
255
                if (unimplementedSymbolsWarning) {
256
                    java.util.ArrayList<?> unimplemented_symbols = e.getSymbols();
257
                    System.out.println("The Lexer will not scan the following token(s):");
258
                    for (int i = 0; i < unimplemented_symbols.size(); i++)
259
                    {
260
                        Integer id = (Integer) unimplemented_symbols.get(i);
261
                        System.out.println("    " + $sym_type.orderedTerminalSymbols[id.intValue()]);               
262
                    }
263
                    System.out.println();
264
                }
265
            }
266
            catch(UndefinedEofSymbolException e)
267
            {
268
                throw new Error(new UndefinedEofSymbolException
269
                                    ("The Lexer does not implement the Eof symbol " +
270
                                     $sym_type.orderedTerminalSymbols[prsTable.getEoftSymbol()]));
271
            }
272
        }
273
	
274
        public $action_type($lex_stream_class lexer)
275
        {
276
        		super(lexer);        		
277
            try
278
            {
279
                dtParser = new $prs_parser_class(prsStream, prsTable, this);
280
            }
281
            catch ($prs_parser_exception e)
282
            {
283
                $prs_parser_throw;
284
            }
285
            catch (BadParseSymFileException e)
286
            {
287
                throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- $sym_type.java. Regenerate $prs_type.java"));
288
            }
289
            
290
            reset(lexer.getILexStream());
291
        }		
292
293
        public int numTokenKinds() { return $sym_type.numTokenKinds; }
294
        public String[] orderedTerminalSymbols() { return $sym_type.orderedTerminalSymbols; }
295
        public String getTokenKindName(int kind) { return $sym_type.orderedTerminalSymbols[kind]; }            
296
        public int getEOFTokenKind() { return prsTable.getEoftSymbol(); }
297
        public $prs_stream_class getIPrsStream() { return prsStream; }
298
299
        /**
300
         * @deprecated replaced by {@link #getIPrsStream()}
301
         *
302
         */
303
        public PrsStream getPrsStream() { return prsStream; }
304
305
        /**
306
         * @deprecated replaced by {@link #getIPrsStream()}
307
         *
308
         */
309
        public PrsStream getParseStream() { return prsStream; }
310
311
        public $ast_class parser()
312
        {
313
            return parser(null, getDefaultRepairCount());
314
        }
315
            
316
        public $ast_class parser(Monitor monitor)
317
        {
318
            return parser(monitor, getDefaultRepairCount());
319
        }
320
            
321
        public $ast_class parser(int error_repair_count)
322
        {
323
            return parser(null, error_repair_count);
324
        }
325
            
326
        public $ast_class parser(Monitor monitor, int error_repair_count)
327
        {
328
            dtParser.setMonitor(monitor);
329
330
            try
331
            {
332
                return ($ast_class) dtParser.parse();
333
            }
334
            catch (BadParseException e)
335
            {
336
                prsStream.reset(e.error_token); // point to error token
337
338
                DiagnoseParser diagnoseParser = new DiagnoseParser(prsStream, prsTable);
339
                diagnoseParser.diagnose(e.error_token);
340
            }
341
342
            return null;
343
        }
344
345
        //
346
        // Additional entry points, if any
347
        //
348
        $entry_declarations
349
   
350
        // OCL Additions
351
352
		public $environment_class getOCLEnvironment() {
353
			return getLexer().getOCLEnvironment();
354
		}
355
		
356
		@Override
357
		public $lex_stream_class getLexer() {
358
			return ($lex_stream_class) super.getLexer();
359
		}
360
    ./
361
362
%End
363
364
%Rules
365
    /.$BeginActions./
366
%End
367
368
%Trailers
369
    /.
370
        $EndActions
371
    }
372
    ./
373
%End
374
375
--
376
-- E N D   O F   T E M P L A T E
377
--
(-)src/org/eclipse/ocl/parser/EssentialOCL.gi (+1573 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation, Zeligsoft Inc., Borland Software Corp., 
5
-- * Open Canarias S.L and others.
6
-- * All rights reserved.   This program and the accompanying materials
7
-- * are made available under the terms of the Eclipse Public License v1.0
8
-- * which accompanies this distribution, and is available at
9
-- * http://www.eclipse.org/legal/epl-v10.html
10
-- *
11
-- * Contributors:
12
-- *   IBM - Initial API and implementation
13
-- *   E.D.Willink - Elimination of some shift-reduce conflicts
14
-- *   E.D.Willink - Remove unnecessary warning suppression
15
-- *   E.D.Willink - Bugs 225493, 243976, 259818
16
-- *   Zeligsoft - Bug 243976
17
-- *   Borland - Bug 242880
18
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v 2.0.17 adoption
19
-- *
20
-- * </copyright>
21
-- *
22
-- * $Id: EssentialOCL.gi,v 1.7 2009/03/05 14:12:14 cdamus Exp $
23
-- */
24
--
25
-- The EssentialOCL Parser
26
--
27
28
29
%Notice
30
	/./**
31
 * <copyright>
32
 *
33
 * Copyright (c) 2005, 2009 IBM Corporation, Zeligsoft Inc., Borland Software Corp., 
34
 * Open Canarias S.L. and others.
35
 * All rights reserved.   This program and the accompanying materials
36
 * are made available under the terms of the Eclipse Public License v1.0
37
 * which accompanies this distribution, and is available at
38
 * http://www.eclipse.org/legal/epl-v10.html
39
 *
40
 * Contributors:
41
 *   IBM - Initial API and implementation
42
 *   E.D.Willink - Elimination of some shift-reduce conflicts
43
 *   E.D.Willink - Remove unnecessary warning suppression
44
 *   E.D.Willink - Bugs 225493, 243976, 259818
45
 *   Zeligsoft - Bug 243976
46
 *   Borland - Bug 242880
47
 *   E.D.Willink - Bug 282882 resolve invalid confusion
48
 *   Adolfo Sanchez- Barbudo Herrera - LPG v 2.0.17 adoption
49
$copyright_contributions
50
 * </copyright>
51
 *
52
 * $Id: EssentialOCL.g,v 1.7 2009/03/05 14:12:14 cdamus Exp $
53
 */
54
	./
55
%End
56
57
%Globals
58
	/.import org.eclipse.emf.common.util.BasicEList;
59
	import org.eclipse.emf.common.util.EList;
60
	import org.eclipse.ocl.cst.CSTNode;
61
	import org.eclipse.ocl.cst.CallExpCS;
62
	import org.eclipse.ocl.cst.CollectionTypeIdentifierEnum;
63
	import org.eclipse.ocl.cst.DotOrArrowEnum;
64
	import org.eclipse.ocl.cst.IntegerLiteralExpCS;
65
	import org.eclipse.ocl.cst.IsMarkedPreCS;
66
	import org.eclipse.ocl.cst.MessageExpCS;
67
	import org.eclipse.ocl.cst.OCLExpressionCS;
68
	import org.eclipse.ocl.cst.OCLMessageArgCS;
69
	import org.eclipse.ocl.cst.OperationCallExpCS;
70
	import org.eclipse.ocl.cst.PathNameCS;
71
	import org.eclipse.ocl.cst.SimpleNameCS;
72
	import org.eclipse.ocl.cst.SimpleTypeEnum;
73
	import org.eclipse.ocl.cst.StateExpCS;
74
	import org.eclipse.ocl.cst.StringLiteralExpCS;
75
	import org.eclipse.ocl.cst.TypeCS;
76
	import org.eclipse.ocl.cst.VariableCS;
77
	import org.eclipse.ocl.util.OCLStandardLibraryUtil;
78
	import org.eclipse.ocl.utilities.PredefinedType;
79
	import org.eclipse.ocl.lpg.OCLParserStream;
80
	
81
	import $lpg_ns.BadParseException;
82
	import $lpg_ns.BadParseSymFileException;
83
	import $lpg_ns.$prs_parser_class;
84
	import $lpg_ns.DiagnoseParser;
85
	import $lpg_ns.ErrorToken;
86
	import $lpg_ns.IToken;
87
	import $lpg_ns.ILexStream;
88
	import $lpg_ns.Monitor;
89
	import $lpg_ns.$prs_parser_exception;
90
	import $lpg_ns.NullExportedSymbolsException;
91
	import $lpg_ns.NullTerminalSymbolsException;
92
	import $lpg_ns.ParseTable;
93
	import $lpg_ns.PrsStream;
94
	import $lpg_ns.RuleAction;
95
	import $lpg_ns.UndefinedEofSymbolException;
96
	import $lpg_ns.UnimplementedTerminalsException;	
97
	./
98
%End
99
100
%KeyWords
101
	self
102
	inv
103
	pre
104
	post
105
	endpackage
106
	def
107
	if
108
	then
109
	else
110
	endif
111
	and
112
	or
113
	xor
114
	not
115
	implies
116
	let
117
	in
118
	true
119
	false
120
121
	--
122
	-- the following appear to have been omitted from the list of
123
	-- OCL reserved words in Section 7.4.9.  They will be treated 
124
	-- as unreserved for compliance
125
	--
126
	body
127
	derive
128
	init
129
	null
130
	invalid
131
--  return  -- don't need a keyword for LPG purposes
132
133
	--
134
	-- the remainder of the LPG keywords are defined as such for the
135
	-- purpose of constructing the CST grammar.  They are not OCL
136
	-- reserved words
137
	--		
138
	Set
139
	Bag
140
	Sequence
141
	Collection
142
	OrderedSet
143
144
	iterate
145
	forAll
146
	exists
147
	isUnique
148
	any
149
	one
150
151
	collect
152
	select
153
	reject
154
	collectNested
155
	sortedBy
156
157
	closure
158
159
	oclIsKindOf
160
	oclIsTypeOf
161
	oclAsType
162
	oclIsNew
163
	oclIsUndefined
164
	oclIsInvalid
165
	oclIsInState
166
	allInstances
167
168
	String
169
	Integer
170
	UnlimitedNatural
171
	Real
172
	Boolean
173
	Tuple
174
	OclAny
175
	OclVoid
176
	Invalid
177
	OclInvalid
178
	OclMessage
179
%End
180
181
%Identifier
182
	IDENTIFIER
183
%End
184
185
%Terminals
186
	
187
	NUMERIC_OPERATION
188
189
	STRING_LITERAL
190
	INTEGER_LITERAL
191
	REAL_LITERAL
192
	
193
	PLUS     ::= '+'
194
	MINUS    ::= '-'
195
	MULTIPLY ::= '*'
196
	DIVIDE   ::= '/'
197
198
	GREATER       ::= '>'
199
	LESS          ::= '<'
200
	EQUAL         ::= '='
201
	GREATER_EQUAL ::= '>='
202
	LESS_EQUAL    ::= '<='
203
	NOT_EQUAL     ::= '<>'
204
205
	LPAREN   ::= '('
206
	RPAREN   ::= ')'
207
	LBRACE   ::= '{'
208
	RBRACE   ::= '}'
209
	LBRACKET ::= '['
210
	RBRACKET ::= ']'
211
212
	ARROW      ::= '->'
213
	BAR        ::= '|'
214
	COMMA      ::= ','
215
	COLON      ::= ':'
216
	COLONCOLON ::= '::'
217
	SEMICOLON  ::= ';'
218
	DOT        ::= '.'
219
	DOTDOT     ::= '..'
220
	ATPRE      ::= '@pre'
221
222
	CARET        ::= '^'
223
	CARETCARET   ::= '^^'
224
	QUESTIONMARK ::= '?'
225
226
%End
227
228
--$EOL
229
--	SEMICOLON
230
--$End
231
232
--$Start
233
--    goal
234
--$End
235
236
%Headers
237
	/.
238
	
239
	// Some methods to keep compatibility backwards
240
   /**
241
    * @since 3.0
242
    */
243
   protected IToken getIToken(int i) {
244
		return prsStream.getIToken(i);
245
	}
246
		
247
	protected String getTokenText(int i) {
248
		return prsStream.getTokenText(i);
249
	}
250
251
	./
252
%End
253
254
%Rules
255
256
	-- opt = optional
257
	-- m = multiple
258
259
	--
260
	-- Define a group of names that we define as keywords for the purpose
261
	-- of constructing an LPG grammar, but that are not reserved by OCL
262
	-- and are commonly used in models such as the UML metamodel, itself
263
	--
264
	
265
	binaryIdentifier -> oclIsUndefined
266
	binaryIdentifier -> oclIsInvalid
267
	binaryIdentifier -> oclIsNew
268
	binaryIdentifier -> oclAsType
269
	binaryIdentifier -> oclIsKindOf
270
	binaryIdentifier -> oclIsTypeOf
271
	binaryIdentifier -> EQUAL
272
	binaryIdentifier -> NOT_EQUAL
273
	binaryIdentifier -> PLUS
274
	binaryIdentifier -> MULTIPLY
275
	binaryIdentifier -> DIVIDE
276
	binaryIdentifier -> GREATER
277
	binaryIdentifier -> LESS
278
	binaryIdentifier -> GREATER_EQUAL
279
	binaryIdentifier -> LESS_EQUAL
280
	binaryIdentifier -> and
281
	binaryIdentifier -> or
282
	binaryIdentifier -> xor
283
284
	unaryIdentifier -> MINUS
285
	unaryIdentifier -> not
286
287
	iteratorIdentifier -> forAll
288
	iteratorIdentifier -> exists
289
	iteratorIdentifier -> isUnique
290
	iteratorIdentifier -> any
291
	iteratorIdentifier -> one
292
	iteratorIdentifier -> collect
293
	iteratorIdentifier -> select
294
	iteratorIdentifier -> reject
295
	iteratorIdentifier -> collectNested
296
	iteratorIdentifier -> sortedBy
297
	iteratorIdentifier -> closure
298
299
	keywordAsIdentifier1 -> iterate
300
	keywordAsIdentifier1 -> iteratorIdentifier
301
	keywordAsIdentifier1 -> allInstances
302
	keywordAsIdentifier1 -> body
303
	keywordAsIdentifier1 -> derive
304
	keywordAsIdentifier1 -> init
305
	keywordAsIdentifier1 -> Set
306
	keywordAsIdentifier1 -> Bag
307
	keywordAsIdentifier1 -> Sequence
308
	keywordAsIdentifier1 -> Collection
309
	keywordAsIdentifier1 -> OrderedSet
310
	--------
311
	keywordAsIdentifier -> keywordAsIdentifier1
312
	keywordAsIdentifier -> null
313
314
	binaryName -> simpleNameCS
315
	binaryName ::= binaryIdentifier
316
		/.$NewCase./
317
	keywordAsName ::= keywordAsIdentifier
318
		/.$NewCase./
319
	keywordAsName1 ::= keywordAsIdentifier1
320
		/.$NewCase./
321
	unaryName ::= unaryIdentifier
322
		/.$BeginCode
323
					SimpleNameCS result = createSimpleNameCS(
324
								SimpleTypeEnum.IDENTIFIER_LITERAL,
325
								getTokenText($getToken(1))
326
							);
327
					setOffsets(result, getIToken($getToken(1)));
328
					$setResult(result);
329
		  $EndCode
330
		./
331
		
332
	iterateName ::= iterate
333
		/.$NewCase./
334
	iteratorName ::= iteratorIdentifier
335
		/.$NewCase./
336
	oclIsInStateName ::= oclIsInState
337
		/.$BeginCode
338
					SimpleNameCS result = createSimpleNameCS(
339
								SimpleTypeEnum.KEYWORD_LITERAL,
340
								getTokenText($getToken(1))
341
							);
342
					setOffsets(result, getIToken($getToken(1)));
343
					$setResult(result);
344
		  $EndCode
345
		./
346
347
	--
348
	-- the 'operationCS' non-terminal is not referenced in this grammar
349
	--
350
	operationCS -> operationCS1
351
	operationCS -> operationCS2
352
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ')' ':' typeCSopt
353
		/.$BeginCode
354
					CSTNode result = createOperationCS(
355
							getTokenText($getToken(1)),
356
							(EList)$getSym(3),
357
							(TypeCS)$getSym(6)
358
						);
359
					if ($getSym(6) != null) {
360
						setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(6));
361
					} else {
362
						setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
363
					}
364
					$setResult(result);
365
		  $EndCode
366
		./
367
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ')' ':' typeCSopt
368
		/.$BeginCode
369
					CSTNode result = createOperationCS(
370
							(PathNameCS)$getSym(1),
371
							(SimpleNameCS)$getSym(3),
372
							(EList)$getSym(5),
373
							(TypeCS)$getSym(8)
374
						);
375
					if ($getSym(8) != null) {
376
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(8));
377
					} else {
378
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(7)));
379
					}
380
					$setResult(result);
381
		  $EndCode
382
		./
383
384
385
	parametersCSopt ::= %empty
386
		/.$EmptyListAction./
387
	parametersCSopt -> parametersCS
388
	parametersCS ::= variableCS
389
		/.$BeginCode
390
					EList result = new BasicEList();
391
					result.add($getSym(1));
392
					$setResult(result);
393
		  $EndCode
394
		./
395
	parametersCS ::= parametersCS ',' variableCS
396
		/.$BeginCode
397
					EList result = (EList)$getSym(1);
398
					result.add($getSym(3));
399
					$setResult(result);
400
		  $EndCode
401
		./
402
403
	simpleNameCSopt ::= %empty
404
		/.$NullAction./
405
	simpleNameCSopt -> simpleNameCS	
406
407
	oclExpressionCS -> impliesExpCS
408
	oclExpressionCS -> impliesWithLet
409
	
410
	impliesExpCS -> andOrXorExpCS
411
	impliesWithLet -> andOrXorWithLet
412
	impliesExpCS ::= impliesExpCS implies andOrXorExpCS
413
		/.$NewCase./
414
	impliesWithLet ::= impliesExpCS implies andOrXorWithLet
415
		/.$NewCase./
416
417
	andOrXorExpCS -> equalityExpCS
418
	andOrXorWithLet -> equalityWithLet
419
	andOrXorExpCS ::= andOrXorExpCS and equalityExpCS
420
		/.$NewCase./
421
	andOrXorExpCS ::= andOrXorExpCS or equalityExpCS
422
		/.$NewCase./
423
	andOrXorExpCS ::= andOrXorExpCS xor equalityExpCS
424
		/.$NewCase./
425
	andOrXorWithLet ::= andOrXorExpCS and equalityWithLet
426
		/.$NewCase./
427
	andOrXorWithLet ::= andOrXorExpCS or equalityWithLet
428
		/.$NewCase./
429
	andOrXorWithLet ::= andOrXorExpCS xor equalityWithLet
430
		/.$BeginCode
431
					SimpleNameCS simpleNameCS = createSimpleNameCS(
432
								SimpleTypeEnum.STRING_LITERAL,
433
								getTokenText($getToken(2))
434
							);
435
					setOffsets(simpleNameCS, getIToken($getToken(2)));
436
					EList args = new BasicEList();
437
					args.add($getSym(3));
438
					CSTNode result = createOperationCallExpCS(
439
							(OCLExpressionCS)$getSym(1),
440
							simpleNameCS,
441
							args
442
						);
443
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
444
					$setResult(result);
445
		  $EndCode
446
		./
447
448
	equalityExpCS -> relationalExpCS
449
	equalityWithLet -> relationalWithLet
450
	equalityExpCS ::= equalityExpCS '=' relationalExpCS
451
		/.$NewCase./
452
	equalityWithLet ::= equalityExpCS '=' relationalWithLet
453
		/.$BeginCode
454
					SimpleNameCS simpleNameCS = createSimpleNameCS(
455
								SimpleTypeEnum.STRING_LITERAL,
456
								OCLStandardLibraryUtil.getOperationName(PredefinedType.EQUAL)
457
							);
458
					setOffsets(simpleNameCS, getIToken($getToken(2)));
459
					EList args = new BasicEList();
460
					args.add($getSym(3));
461
					CSTNode result = createOperationCallExpCS(
462
							(OCLExpressionCS)$getSym(1),
463
							simpleNameCS,
464
							args
465
						);
466
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
467
					$setResult(result);
468
		  $EndCode
469
		./
470
	equalityExpCS ::= equalityExpCS '<>' relationalExpCS
471
		/.$NewCase./
472
	equalityWithLet ::= equalityExpCS '<>' relationalWithLet
473
		/.$BeginCode
474
					SimpleNameCS simpleNameCS = createSimpleNameCS(
475
								SimpleTypeEnum.STRING_LITERAL,
476
								OCLStandardLibraryUtil.getOperationName(PredefinedType.NOT_EQUAL)
477
							);
478
					setOffsets(simpleNameCS, getIToken($getToken(2)));
479
					EList args = new BasicEList();
480
					args.add($getSym(3));
481
					CSTNode result = createOperationCallExpCS(
482
							(OCLExpressionCS)$getSym(1),
483
							simpleNameCS,
484
							args
485
						);
486
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
487
					$setResult(result);
488
		  $EndCode
489
		./
490
	
491
	relationalExpCS -> ifExpCSPrec
492
	-- Note that ifExp already embeds let, so we needn't deal with it here
493
	relationalWithLet -> additiveWithLet
494
	relationalExpCS ::= relationalExpCS '>' ifExpCSPrec
495
		/.$NewCase./
496
	relationalWithLet ::= relationalExpCS '>' additiveWithLet
497
		/.$BeginCode
498
					SimpleNameCS simpleNameCS = createSimpleNameCS(
499
								SimpleTypeEnum.STRING_LITERAL,
500
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN)
501
							);
502
					setOffsets(simpleNameCS, getIToken($getToken(2)));
503
					EList args = new BasicEList();
504
					args.add($getSym(3));
505
					CSTNode result = createOperationCallExpCS(
506
							(OCLExpressionCS)$getSym(1),
507
							simpleNameCS,
508
							args
509
						);
510
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
511
					$setResult(result);
512
		  $EndCode
513
		./
514
	relationalExpCS ::= relationalExpCS '<' ifExpCSPrec
515
		/.$NewCase./
516
	relationalWithLet ::= relationalExpCS '<' additiveWithLet
517
		/.$BeginCode
518
					SimpleNameCS simpleNameCS = createSimpleNameCS(
519
								SimpleTypeEnum.STRING_LITERAL,
520
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN)
521
							);
522
					setOffsets(simpleNameCS, getIToken($getToken(2)));
523
					EList args = new BasicEList();
524
					args.add($getSym(3));
525
					CSTNode result = createOperationCallExpCS(
526
							(OCLExpressionCS)$getSym(1),
527
							simpleNameCS,
528
							args
529
						);
530
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
531
					$setResult(result);
532
		  $EndCode
533
		./
534
	relationalExpCS ::= relationalExpCS '>=' ifExpCSPrec
535
		/.$NewCase./
536
	relationalWithLet ::= relationalExpCS '>=' additiveWithLet
537
		/.$BeginCode
538
					SimpleNameCS simpleNameCS = createSimpleNameCS(
539
								SimpleTypeEnum.STRING_LITERAL,
540
								OCLStandardLibraryUtil.getOperationName(PredefinedType.GREATER_THAN_EQUAL)
541
							);
542
					setOffsets(simpleNameCS, getIToken($getToken(2)));
543
					EList args = new BasicEList();
544
					args.add($getSym(3));
545
					CSTNode result = createOperationCallExpCS(
546
							(OCLExpressionCS)$getSym(1),
547
							simpleNameCS,
548
							args
549
						);
550
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
551
					$setResult(result);
552
		  $EndCode
553
		./
554
	relationalExpCS ::= relationalExpCS '<=' ifExpCSPrec
555
		/.$NewCase./
556
	relationalWithLet ::= relationalExpCS '<=' additiveWithLet
557
		/.$BeginCode
558
					SimpleNameCS simpleNameCS = createSimpleNameCS(
559
								SimpleTypeEnum.STRING_LITERAL,
560
								OCLStandardLibraryUtil.getOperationName(PredefinedType.LESS_THAN_EQUAL)
561
							);
562
					setOffsets(simpleNameCS, getIToken($getToken(2)));
563
					EList args = new BasicEList();
564
					args.add($getSym(3));
565
					CSTNode result = createOperationCallExpCS(
566
							(OCLExpressionCS)$getSym(1),
567
							simpleNameCS,
568
							args
569
						);
570
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
571
					$setResult(result);
572
		  $EndCode
573
		./
574
	
575
	ifExpCSPrec -> additiveExpCS
576
	ifExpCSPrec -> ifExpCS
577
578
	additiveExpCS -> multiplicativeExpCS
579
	additiveWithLet -> multiplicativeWithLet
580
	additiveExpCS ::= additiveExpCS '+' multiplicativeExpCS
581
		/.$NewCase./
582
	additiveWithLet ::= additiveExpCS '+' multiplicativeWithLet
583
		/.$BeginCode
584
					SimpleNameCS simpleNameCS = createSimpleNameCS(
585
								SimpleTypeEnum.STRING_LITERAL,
586
								OCLStandardLibraryUtil.getOperationName(PredefinedType.PLUS)
587
							);
588
					setOffsets(simpleNameCS, getIToken($getToken(2)));
589
					EList args = new BasicEList();
590
					args.add($getSym(3));
591
					CSTNode result = createOperationCallExpCS(
592
							(OCLExpressionCS)$getSym(1),
593
							simpleNameCS,
594
							args
595
						);
596
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
597
					$setResult(result);
598
		  $EndCode
599
		./
600
	additiveExpCS ::= additiveExpCS '-' multiplicativeExpCS
601
		/.$NewCase./
602
	additiveWithLet ::= additiveExpCS '-' multiplicativeWithLet
603
		/.$BeginCode
604
					SimpleNameCS simpleNameCS = createSimpleNameCS(
605
								SimpleTypeEnum.STRING_LITERAL,
606
								OCLStandardLibraryUtil.getOperationName(PredefinedType.MINUS)
607
							);
608
					setOffsets(simpleNameCS, getIToken($getToken(2)));
609
					EList args = new BasicEList();
610
					args.add($getSym(3));
611
					CSTNode result = createOperationCallExpCS(
612
							(OCLExpressionCS)$getSym(1),
613
							simpleNameCS,
614
							args
615
						);
616
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
617
					$setResult(result);
618
		  $EndCode
619
		./
620
	
621
	multiplicativeExpCS -> unaryExpCS
622
	multiplicativeWithLet -> unaryWithLet
623
	multiplicativeExpCS ::= multiplicativeExpCS '*' unaryExpCS
624
		/.$NewCase./
625
	multiplicativeWithLet ::= multiplicativeExpCS '*' unaryWithLet
626
		/.$BeginCode
627
					SimpleNameCS simpleNameCS = createSimpleNameCS(
628
								SimpleTypeEnum.STRING_LITERAL,
629
								OCLStandardLibraryUtil.getOperationName(PredefinedType.TIMES)
630
							);
631
					setOffsets(simpleNameCS, getIToken($getToken(2)));
632
					EList args = new BasicEList();
633
					args.add($getSym(3));
634
					CSTNode result = createOperationCallExpCS(
635
							(OCLExpressionCS)$getSym(1),
636
							simpleNameCS,
637
							args
638
						);
639
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
640
					$setResult(result);
641
		  $EndCode
642
		./
643
	multiplicativeExpCS ::= multiplicativeExpCS '/' unaryExpCS
644
		/.$NewCase./
645
	multiplicativeWithLet ::= multiplicativeExpCS '/' unaryWithLet
646
		/.$BeginCode
647
					SimpleNameCS simpleNameCS = createSimpleNameCS(
648
								SimpleTypeEnum.STRING_LITERAL,
649
								OCLStandardLibraryUtil.getOperationName(PredefinedType.DIVIDE)
650
							);
651
					setOffsets(simpleNameCS, getIToken($getToken(2)));
652
					EList args = new BasicEList();
653
					args.add($getSym(3));
654
					CSTNode result = createOperationCallExpCS(
655
							(OCLExpressionCS)$getSym(1),
656
							simpleNameCS,
657
							args
658
						);
659
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
660
					$setResult(result);
661
		  $EndCode
662
		./
663
	
664
	unaryExpCS -> dotArrowExpCS
665
	unaryWithLet -> letExpCS
666
	unaryExpCS ::= '-' unaryExpCS
667
		/.$BeginCode
668
					SimpleNameCS simpleNameCS = createSimpleNameCS(
669
								SimpleTypeEnum.STRING_LITERAL,
670
								OCLStandardLibraryUtil.getOperationName(PredefinedType.MINUS)
671
							);
672
					setOffsets(simpleNameCS, getIToken($getToken(1)));
673
					CSTNode result = createOperationCallExpCS(
674
							(OCLExpressionCS)$getSym(2),
675
							simpleNameCS,
676
							new BasicEList()
677
						);
678
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(2));
679
					$setResult(result);
680
		  $EndCode
681
		./
682
	unaryExpCS ::= not unaryExpCS
683
		/.$BeginCode
684
					SimpleNameCS simpleNameCS = createSimpleNameCS(
685
								SimpleTypeEnum.STRING_LITERAL,
686
								getTokenText($getToken(1))
687
							);
688
					setOffsets(simpleNameCS, getIToken($getToken(1)));
689
					CSTNode result = createOperationCallExpCS(
690
							(OCLExpressionCS)$getSym(2),
691
							simpleNameCS,
692
							new BasicEList()
693
						);
694
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(2));
695
					$setResult(result);
696
		  $EndCode
697
		./
698
699
	dotArrowExpCS -> oclExpCS
700
	dotArrowExpCS ::= dotArrowExpCS callExpCS
701
		/.$BeginCode
702
					CallExpCS result = (CallExpCS)$getSym(2);
703
					result.setSource((OCLExpressionCS)$getSym(1));
704
					setOffsets(result, (CSTNode)$getSym(1), result);
705
					$setResult(result);
706
		  $EndCode
707
		./
708
	dotArrowExpCS ::= dotArrowExpCS messageExpCS
709
		/.$BeginCode
710
					MessageExpCS result = (MessageExpCS)$getSym(2);
711
					result.setTarget((OCLExpressionCS)$getSym(1));
712
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
713
					$setResult(result);
714
		  $EndCode
715
		./
716
	dotArrowExpCS ::= NUMERIC_OPERATION '(' argumentsCSopt ')'
717
		/.$BeginCode
718
					// NUMERIC_OPERATION -> Integer '.' Identifier
719
					String text = getTokenText(dtParser.getToken(1));
720
					int index = text.indexOf('.');
721
					String integer = text.substring(0, index);
722
					String simpleName = text.substring(index + 1);
723
724
					// create the IntegerLiteralExpCS
725
					IToken numericToken = getIToken($getToken(1));
726
					int startOffset = numericToken.getStartOffset();
727
					int endOffset = startOffset + integer.length() - 1; // inclusive
728
729
					IntegerLiteralExpCS integerLiteralExpCS = createIntegerLiteralExpCS(integer);
730
					integerLiteralExpCS.setStartOffset(startOffset);
731
					integerLiteralExpCS.setEndOffset(endOffset);
732
					integerLiteralExpCS.setStartToken(numericToken);
733
					integerLiteralExpCS.setEndToken(numericToken);
734
735
					startOffset = endOffset + 2; // end of integerLiteral + 1('.') + 1(start of simpleName)
736
					endOffset = getIToken($getToken(1)).getEndOffset();
737
738
					// create the SimpleNameCS
739
					SimpleNameCS simpleNameCS = createSimpleNameCS(
740
								SimpleTypeEnum.IDENTIFIER_LITERAL,
741
								simpleName
742
							);
743
					simpleNameCS.setStartOffset(startOffset);
744
					simpleNameCS.setEndOffset(endOffset);
745
					simpleNameCS.setStartToken(numericToken);
746
					simpleNameCS.setEndToken(numericToken);
747
748
					// create the OperationCallExpCS
749
					CSTNode result = createOperationCallExpCS(
750
							integerLiteralExpCS,
751
							simpleNameCS,
752
							(EList)$getSym(3)
753
						);
754
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
755
					$setResult(result);
756
		  $EndCode
757
		./
758
759
    -- static operation call (@pre is not permitted in this context)
760
	dotArrowExpCS ::=  pathNameCS '::' simpleNameCS '(' argumentsCSopt ')'
761
		/.$BeginCode
762
					OperationCallExpCS result = createOperationCallExpCS(
763
							(PathNameCS)$getSym(1),
764
							(SimpleNameCS)$getSym(3),
765
							(EList)$getSym(5)
766
						);
767
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(6)));
768
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
769
					$setResult(result);
770
		  $EndCode
771
		./
772
773
774
	oclExpCS -> variableExpCS
775
	oclExpCS -> literalExpCS
776
	oclExpCS -> operationCallExpCS
777
	oclExpCS -> keywordOperationCallExpCS
778
779
	oclExpCS ::= '(' oclExpressionCS ')'
780
		/.$BeginCode
781
					CSTNode result = (CSTNode)$getSym(2);
782
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
783
					$setResult(result);
784
		  $EndCode
785
		./
786
787
	variableExpCS ::= simpleNameCS isMarkedPreCS
788
		/.$NewCase./
789
	variableExpCS ::= keywordAsName1 isMarkedPreCS
790
		/.$BeginCode
791
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(2);
792
					CSTNode result = createVariableExpCS(
793
							(SimpleNameCS)$getSym(1),
794
							new BasicEList(),
795
							isMarkedPreCS
796
						);
797
					if (isMarkedPreCS.isPre()) {
798
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
799
					} else {
800
						setOffsets(result, (CSTNode)$getSym(1));
801
					}
802
					$setResult(result);
803
		  $EndCode
804
		./
805
	variableExpCS ::= simpleNameCS '[' argumentsCS ']' isMarkedPreCS
806
		/.$NewCase./
807
	variableExpCS ::= keywordAsName1 '[' argumentsCS ']' isMarkedPreCS
808
		/.$BeginCode
809
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(5);
810
					CSTNode result = createVariableExpCS(
811
							(SimpleNameCS)$getSym(1),
812
							(EList)$getSym(3),
813
							isMarkedPreCS
814
						);
815
					if (isMarkedPreCS.isPre()) {
816
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(5));
817
					} else {
818
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
819
					}
820
					$setResult(result);
821
		  $EndCode
822
		./
823
824
825
	simpleNameCS -> primitiveTypeCS
826
	simpleNameCS ::= self
827
		/.$BeginCode
828
					CSTNode result = createSimpleNameCS(
829
							SimpleTypeEnum.SELF_LITERAL,
830
							getTokenText($getToken(1))
831
						);
832
					setOffsets(result, getIToken($getToken(1)));
833
					$setResult(result);
834
		  $EndCode
835
		./
836
	simpleNameCS ::= IDENTIFIER
837
		/.$BeginCode
838
					CSTNode result = createSimpleNameCS(
839
							SimpleTypeEnum.IDENTIFIER_LITERAL,
840
							getTokenText($getToken(1))
841
						);
842
					setOffsets(result, getIToken($getToken(1)));
843
					$setResult(result);
844
		  $EndCode
845
		./
846
847
	primitiveTypeCS ::= Integer
848
		/.$BeginCode
849
					CSTNode result = createPrimitiveTypeCS(
850
							SimpleTypeEnum.INTEGER_LITERAL,
851
							getTokenText($getToken(1))
852
						);
853
					setOffsets(result, getIToken($getToken(1)));
854
					$setResult(result);
855
		  $EndCode
856
		./
857
	primitiveTypeCS ::= UnlimitedNatural
858
		/.$BeginCode
859
					CSTNode result = createPrimitiveTypeCS(
860
							SimpleTypeEnum.UNLIMITED_NATURAL_LITERAL,
861
							getTokenText($getToken(1))
862
						);
863
					setOffsets(result, getIToken($getToken(1)));
864
					$setResult(result);
865
		  $EndCode
866
		./
867
	primitiveTypeCS ::= String
868
		/.$BeginCode
869
					CSTNode result = createPrimitiveTypeCS(
870
							SimpleTypeEnum.STRING_LITERAL,
871
							getTokenText($getToken(1))
872
						);
873
					setOffsets(result, getIToken($getToken(1)));
874
					$setResult(result);
875
		  $EndCode
876
		./
877
	primitiveTypeCS ::= Real
878
		/.$BeginCode
879
					CSTNode result = createPrimitiveTypeCS(
880
							SimpleTypeEnum.REAL_LITERAL,
881
							getTokenText($getToken(1))
882
						);
883
					setOffsets(result, getIToken($getToken(1)));
884
					$setResult(result);
885
		  $EndCode
886
		./
887
	primitiveTypeCS ::= Boolean
888
		/.$BeginCode
889
					CSTNode result = createPrimitiveTypeCS(
890
							SimpleTypeEnum.BOOLEAN_LITERAL,
891
							getTokenText($getToken(1))
892
						);
893
					setOffsets(result, getIToken($getToken(1)));
894
					$setResult(result);
895
		  $EndCode
896
		./
897
	primitiveTypeCS ::= OclAny
898
		/.$BeginCode
899
					CSTNode result = createPrimitiveTypeCS(
900
							SimpleTypeEnum.OCL_ANY_LITERAL,
901
							getTokenText($getToken(1))
902
						);
903
					setOffsets(result, getIToken($getToken(1)));
904
					$setResult(result);
905
		  $EndCode
906
		./
907
	primitiveTypeCS ::= OclVoid
908
		/.$BeginCode
909
					CSTNode result = createPrimitiveTypeCS(
910
							SimpleTypeEnum.OCL_VOID_LITERAL,
911
							getTokenText($getToken(1))
912
						);
913
					setOffsets(result, getIToken($getToken(1)));
914
					$setResult(result);
915
		  $EndCode
916
		./
917
	primitiveTypeCS ::= OclInvalid
918
		/.$BeginCode
919
					CSTNode result = createPrimitiveTypeCS(
920
							SimpleTypeEnum.INVALID_LITERAL,
921
							getTokenText($getToken(1))
922
						);
923
					setOffsets(result, getIToken($getToken(1)));
924
					$setResult(result);
925
		  $EndCode
926
		./
927
	primitiveTypeCS ::= OclMessage
928
		/.$BeginCode
929
					CSTNode result = createPrimitiveTypeCS(
930
							SimpleTypeEnum.OCL_MESSAGE_LITERAL,
931
							getTokenText($getToken(1))
932
						);
933
					setOffsets(result, getIToken($getToken(1)));
934
					$setResult(result);
935
		  $EndCode
936
		./
937
938
	pathNameCS ::= IDENTIFIER
939
		/.$BeginCode
940
					CSTNode result = createPathNameCS(getTokenText($getToken(1)));
941
					setOffsets(result, getIToken($getToken(1)));
942
					$setResult(result);
943
		  $EndCode
944
		./
945
	pathNameCS ::= pathNameCS '::' simpleNameCS
946
		/.$BeginCode
947
					PathNameCS result = (PathNameCS)$getSym(1);
948
					result = extendPathNameCS(result, getTokenText(dtParser.getToken(3)));
949
					setOffsets(result, result, (CSTNode)$getSym(3));
950
					$setResult(result);
951
		  $EndCode
952
		./
953
954
	pathNameCSOpt ::= %empty
955
		/.$BeginCode
956
					CSTNode result = createPathNameCS();
957
					$setResult(result);
958
		  $EndCode
959
		./
960
	pathNameCSOpt -> pathNameCS
961
962
	literalExpCS -> enumLiteralExpCS
963
	literalExpCS -> collectionLiteralExpCS
964
	literalExpCS -> tupleLiteralExpCS
965
	literalExpCS -> primitiveLiteralExpCS
966
	literalExpCS -> nullLiteralExpCS
967
	literalExpCS -> invalidLiteralExpCS
968
969
    -- also covers the case of static attribute call, in which
970
    --    case @pre is not allowed anyway
971
	enumLiteralExpCS ::= pathNameCS '::' keywordAsName
972
		/.$NewCase./
973
	enumLiteralExpCS ::= pathNameCS '::' simpleNameCS
974
		/.$BeginCode
975
					CSTNode result = createEnumLiteralExpCS(
976
							(PathNameCS)$getSym(1),
977
							(SimpleNameCS)$getSym(3)
978
						);
979
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
980
					$setResult(result);
981
		  $EndCode
982
		./
983
984
	collectionLiteralExpCS ::= collectionTypeIdentifierCS '{' collectionLiteralPartsCSopt '}'
985
		/.$BeginCode
986
					Object[] objs = (Object[])$getSym(1);
987
					CSTNode result = createCollectionLiteralExpCS(
988
							(CollectionTypeIdentifierEnum)objs[1],
989
							(EList)$getSym(3)
990
						);
991
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
992
					$setResult(result);
993
		  $EndCode
994
		./
995
996
	collectionTypeIdentifierCS ::= Set
997
		/.$BeginCode
998
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.SET_LITERAL});
999
		  $EndCode
1000
		./
1001
	collectionTypeIdentifierCS ::= Bag
1002
		/.$BeginCode
1003
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.BAG_LITERAL});
1004
		  $EndCode
1005
		./
1006
	collectionTypeIdentifierCS ::= Sequence
1007
		/.$BeginCode
1008
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.SEQUENCE_LITERAL});
1009
		  $EndCode
1010
		./
1011
	collectionTypeIdentifierCS ::= Collection
1012
		/.$BeginCode
1013
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.COLLECTION_LITERAL});
1014
		  $EndCode
1015
		./
1016
	collectionTypeIdentifierCS ::= OrderedSet
1017
		/.$BeginCode
1018
					$setResult(new Object[]{getIToken($getToken(1)), CollectionTypeIdentifierEnum.ORDERED_SET_LITERAL});
1019
		  $EndCode
1020
		./
1021
1022
	collectionLiteralPartsCSopt ::= %empty
1023
		/.$EmptyListAction./
1024
	collectionLiteralPartsCSopt -> collectionLiteralPartsCS
1025
1026
	collectionLiteralPartsCS ::= collectionLiteralPartCS
1027
		/.$BeginCode
1028
					EList result = new BasicEList();
1029
					result.add($getSym(1));
1030
					$setResult(result);
1031
		  $EndCode
1032
		./
1033
	collectionLiteralPartsCS ::= collectionLiteralPartsCS ',' collectionLiteralPartCS
1034
		/.$BeginCode
1035
					EList result = (EList)$getSym(1);
1036
					result.add($getSym(3));
1037
					$setResult(result);
1038
		  $EndCode
1039
		./
1040
1041
	collectionLiteralPartCS -> collectionRangeCS
1042
	collectionLiteralPartCS ::= oclExpressionCS
1043
		/.$BeginCode
1044
					CSTNode result = createCollectionLiteralPartCS(
1045
							(OCLExpressionCS)$getSym(1)
1046
						);
1047
					setOffsets(result, (CSTNode)$getSym(1));
1048
					$setResult(result);
1049
		  $EndCode
1050
		./
1051
1052
	collectionRangeCS ::= '-' INTEGER_RANGE_START oclExpressionCS
1053
		/.$BeginCode
1054
					OCLExpressionCS rangeStart = createRangeStart(
1055
							getTokenText($getToken(2)), true);
1056
					CSTNode result = createCollectionRangeCS(
1057
							rangeStart,
1058
							(OCLExpressionCS)$getSym(3)
1059
						);
1060
					setOffsets(result, rangeStart, (CSTNode)$getSym(3));
1061
					$setResult(result);
1062
		  $EndCode
1063
		./
1064
	collectionRangeCS ::= INTEGER_RANGE_START oclExpressionCS
1065
		/.$BeginCode
1066
					OCLExpressionCS rangeStart = createRangeStart(
1067
							getTokenText($getToken(1)), false);
1068
					CSTNode result = createCollectionRangeCS(
1069
							rangeStart,
1070
							(OCLExpressionCS)$getSym(2)
1071
						);
1072
					setOffsets(result, rangeStart, (CSTNode)$getSym(2));
1073
					$setResult(result);
1074
		  $EndCode
1075
		./
1076
	collectionRangeCS ::= oclExpressionCS '..' oclExpressionCS
1077
		/.$BeginCode
1078
					CSTNode result = createCollectionRangeCS(
1079
							(OCLExpressionCS)$getSym(1),
1080
							(OCLExpressionCS)$getSym(3)
1081
						);
1082
					setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(3));
1083
					$setResult(result);
1084
		  $EndCode
1085
		./
1086
1087
	primitiveLiteralExpCS -> integerLiteralExpCS
1088
	primitiveLiteralExpCS -> unlimitedNaturalLiteralExpCS
1089
	primitiveLiteralExpCS -> realLiteralExpCS
1090
	primitiveLiteralExpCS -> stringLiteralExpCS
1091
	primitiveLiteralExpCS -> booleanLiteralExpCS
1092
1093
	tupleLiteralExpCS ::= Tuple '{' variableListCS2 '}'
1094
		/.$BeginCode
1095
					CSTNode result = createTupleLiteralExpCS((EList)$getSym(3));
1096
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
1097
					$setResult(result);
1098
		  $EndCode
1099
		./
1100
	integerLiteralExpCS ::= INTEGER_LITERAL
1101
		/.$BeginCode
1102
					CSTNode result = createIntegerLiteralExpCS(getTokenText($getToken(1)));
1103
					setOffsets(result, getIToken($getToken(1)));
1104
					$setResult(result);
1105
		  $EndCode
1106
		./
1107
	unlimitedNaturalLiteralExpCS ::= '*'
1108
		/.$BeginCode
1109
					CSTNode result = createUnlimitedNaturalLiteralExpCS(getTokenText($getToken(1)));
1110
					setOffsets(result, getIToken($getToken(1)));
1111
					$setResult(result);
1112
		  $EndCode
1113
		./
1114
	realLiteralExpCS ::= REAL_LITERAL
1115
		/.$BeginCode
1116
					CSTNode result = createRealLiteralExpCS(getTokenText($getToken(1)));
1117
					setOffsets(result, getIToken($getToken(1)));
1118
					$setResult(result);
1119
		  $EndCode
1120
		./
1121
	stringLiteralExpCS ::= STRING_LITERAL
1122
		/.$BeginCode
1123
					IToken literalToken = getIToken($getToken(1));
1124
					StringLiteralExpCS result = createStringLiteralExpCS(literalToken.toString());
1125
					result.setUnescapedStringSymbol(unescape(literalToken));
1126
					setOffsets(result, literalToken);
1127
					$setResult(result);
1128
		  $EndCode
1129
		./
1130
	booleanLiteralExpCS ::= true
1131
		/.$BeginCode
1132
					CSTNode result = createBooleanLiteralExpCS(getTokenText($getToken(1)));
1133
					setOffsets(result, getIToken($getToken(1)));
1134
					$setResult(result);
1135
		  $EndCode
1136
		./
1137
	booleanLiteralExpCS ::= false
1138
		/.$BeginCode
1139
					CSTNode result = createBooleanLiteralExpCS(getTokenText($getToken(1)));
1140
					setOffsets(result, getIToken($getToken(1)));
1141
					$setResult(result);
1142
		  $EndCode
1143
		./
1144
1145
	nullLiteralExpCS ::= null
1146
		/.$BeginCode
1147
					CSTNode result = createNullLiteralExpCS(getTokenText($getToken(1)));
1148
					setOffsets(result, getIToken($getToken(1)));
1149
					$setResult(result);
1150
		  $EndCode
1151
		./
1152
1153
	invalidLiteralExpCS ::= invalid
1154
		/.$BeginCode
1155
					CSTNode result = createInvalidLiteralExpCS(getTokenText($getToken(1)));
1156
					setOffsets(result, getIToken($getToken(1)));
1157
					$setResult(result);
1158
		  $EndCode
1159
		./
1160
1161
1162
	callExpCS ::= '->' featureCallExpCS
1163
		/.$NewCase./
1164
	callExpCS ::= '->' loopExpCS
1165
		/.$BeginCode
1166
					CallExpCS result = (CallExpCS)$getSym(2);
1167
					result.setAccessor(DotOrArrowEnum.ARROW_LITERAL);
1168
					$setResult(result);
1169
		  $EndCode
1170
		./
1171
	callExpCS ::= '.' keywordOperationCallExpCS
1172
		/.$NewCase./
1173
	callExpCS ::= '.' featureCallExpCS
1174
		/.$BeginCode
1175
					CallExpCS result = (CallExpCS)$getSym(2);
1176
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
1177
					$setResult(result);
1178
		  $EndCode
1179
		./
1180
1181
	loopExpCS -> iteratorExpCS
1182
	loopExpCS -> iterateExpCS
1183
1184
	iteratorExpCS ::= iteratorName '(' oclExpressionCS ')'
1185
		/.$BeginCode
1186
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1187
					CSTNode result = createIteratorExpCS(
1188
							simpleNameCS,
1189
							null,
1190
							null,
1191
							(OCLExpressionCS)$getSym(3)
1192
						);
1193
					setOffsets(result, simpleNameCS, getIToken($getToken(4)));
1194
					$setResult(result);
1195
		  $EndCode
1196
		./
1197
	iteratorExpCS ::= iteratorName '(' variableCS '|' oclExpressionCS ')'
1198
		/.$BeginCode
1199
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1200
					CSTNode result = createIteratorExpCS(
1201
							simpleNameCS,
1202
							(VariableCS)$getSym(3),
1203
							null,
1204
							(OCLExpressionCS)$getSym(5)
1205
						);
1206
					setOffsets(result, simpleNameCS, getIToken($getToken(6)));
1207
					$setResult(result);
1208
		  $EndCode
1209
		./
1210
	iteratorExpCS ::= iteratorName '(' variableCS ',' variableCS '|' oclExpressionCS ')'
1211
		/.$BeginCode
1212
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1213
					CSTNode result = createIteratorExpCS(
1214
							simpleNameCS,
1215
							(VariableCS)$getSym(3),
1216
							(VariableCS)$getSym(5),
1217
							(OCLExpressionCS)$getSym(7)
1218
						);
1219
					setOffsets(result, simpleNameCS, getIToken($getToken(8)));
1220
					$setResult(result);
1221
		  $EndCode
1222
		./
1223
1224
	iterateExpCS ::= iterateName '(' variableCS '|' oclExpressionCS ')'
1225
		/.$BeginCode
1226
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1227
					CSTNode result = createIterateExpCS(
1228
							simpleNameCS,
1229
							(VariableCS)$getSym(3),
1230
							null,
1231
							(OCLExpressionCS)$getSym(5)
1232
						);
1233
					setOffsets(result, simpleNameCS, getIToken($getToken(6)));
1234
					$setResult(result);
1235
		  $EndCode
1236
		./
1237
	iterateExpCS ::= iterateName '(' variableCS ';' variableCS '|' oclExpressionCS ')'
1238
		/.$BeginCode
1239
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1240
					CSTNode result = createIterateExpCS(
1241
							simpleNameCS,
1242
							(VariableCS)$getSym(3),
1243
							(VariableCS)$getSym(5),
1244
							(OCLExpressionCS)$getSym(7)
1245
						);
1246
					setOffsets(result, simpleNameCS, getIToken($getToken(8)));
1247
					$setResult(result);
1248
		  $EndCode
1249
		./
1250
1251
	variableCS ::= IDENTIFIER
1252
		/.$BeginCode
1253
					CSTNode result = createVariableCS(
1254
							getTokenText($getToken(1)),
1255
							null,
1256
							null
1257
						);
1258
					setOffsets(result, getIToken($getToken(1)));
1259
					$setResult(result);
1260
		  $EndCode
1261
		./
1262
	typedVariableCS ::= IDENTIFIER ':' typeCS
1263
		/.$BeginCode
1264
					CSTNode result = createVariableCS(
1265
							getTokenText($getToken(1)),
1266
							(TypeCS)$getSym(3),
1267
							null
1268
						);
1269
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1270
					$setResult(result);
1271
		  $EndCode
1272
		./
1273
	variableCS -> typedVariableCS
1274
	variableCS ::= IDENTIFIER ':' typeCS '=' oclExpressionCS
1275
		/.$BeginCode
1276
					CSTNode result = createVariableCS(
1277
							getTokenText($getToken(1)),
1278
							(TypeCS)$getSym(3),
1279
							(OCLExpressionCS)$getSym(5)
1280
						);
1281
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(5));
1282
					$setResult(result);
1283
		  $EndCode
1284
		./
1285
1286
	-- this form of variable declaration is only used in tuple literals
1287
	variableCS2 ::= IDENTIFIER '=' oclExpressionCS
1288
		/.$BeginCode
1289
					CSTNode result = createVariableCS(
1290
							getTokenText($getToken(1)),
1291
							null,
1292
							(OCLExpressionCS)$getSym(3)
1293
						);
1294
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1295
					$setResult(result);
1296
		  $EndCode
1297
		./
1298
1299
	typeCSopt ::= %empty
1300
		/.$NullAction./
1301
	typeCSopt -> typeCS
1302
1303
	-- the order of these rules is important!  Try to match primitives
1304
	--   first, then tuples (more complex), and finally collections.
1305
	--   Looking for type names in the Ecore model is a last resort
1306
	typeCS -> primitiveTypeCS
1307
	typeCS -> tupleTypeCS
1308
	typeCS -> collectionTypeCS
1309
	typeCS -> pathNameCS
1310
1311
	collectionTypeCS ::= collectionTypeIdentifierCS '(' typeCS ')'
1312
		/.$BeginCode
1313
					Object[] objs = (Object[])$getSym(1);
1314
					CSTNode result = createCollectionTypeCS(
1315
							(CollectionTypeIdentifierEnum)objs[1],
1316
							(TypeCS)$getSym(3)
1317
						);
1318
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
1319
					$setResult(result);
1320
		  $EndCode
1321
		./
1322
1323
	tupleTypeCS ::= Tuple '(' variableListCSopt ')'
1324
		/.$BeginCode
1325
					CSTNode result = createTupleTypeCS((EList)$getSym(3));
1326
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
1327
					$setResult(result);
1328
		  $EndCode
1329
		./
1330
1331
	
1332
	variableListCSopt ::= %empty
1333
		/.$EmptyListAction./
1334
	variableListCSopt -> variableListCS
1335
	variableListCS ::= variableCS 
1336
		/.$BeginCode
1337
					EList result = new BasicEList();
1338
					result.add($getSym(1));
1339
					$setResult(result);
1340
		  $EndCode
1341
		./
1342
	variableListCS ::= variableListCS ',' variableCS
1343
		/.$BeginCode
1344
					EList result = (EList)$getSym(1);
1345
					result.add($getSym(3));
1346
					$setResult(result);
1347
		  $EndCode
1348
		./
1349
	
1350
	-- this form of variable declaration list is only used in tuple literals
1351
	variableListCS2 ::= variableCS2
1352
		/.$NewCase./
1353
	variableListCS2 ::= variableCS
1354
		/.$BeginCode
1355
					EList result = new BasicEList();
1356
					result.add($getSym(1));
1357
					$setResult(result);
1358
		  $EndCode
1359
		./
1360
	variableListCS2 ::= variableListCS2 ',' variableCS2
1361
		/.$NewCase./
1362
	variableListCS2 ::= variableListCS2 ',' variableCS
1363
		/.$BeginCode
1364
					EList result = (EList)$getSym(1);
1365
					result.add($getSym(3));
1366
					$setResult(result);
1367
		  $EndCode
1368
		./
1369
	
1370
	-- covers attributeCallExpCS and navigationCallExpCS
1371
	featureCallExpCS -> attrOrNavCallExpCS
1372
1373
	featureCallExpCS -> operationCallExpCS
1374
	featureCallExpCS ::= unaryName isMarkedPreCS '(' argumentsCSopt ')'
1375
		/.$NewCase./
1376
	-- even though these operations do not use @pre or do not accept multiple arguments
1377
	-- in order to get better error reporting, the rule signature must comply with
1378
	-- the full rule of an operationCallExpCS
1379
	-- the alternative would be to remove these as keywords, but then the parser
1380
	-- would accept variable declarations where the var can be named "oclIsNew" for example
1381
	operationCallExpCS ::= binaryName isMarkedPreCS '(' argumentsCSopt ')'
1382
		/.$NewCase./
1383
	keywordOperationCallExpCS ::= keywordAsName isMarkedPreCS '(' argumentsCSopt ')'
1384
		/.$BeginCode
1385
					CSTNode result = createOperationCallExpCS(
1386
							(SimpleNameCS)$getSym(1),
1387
							(IsMarkedPreCS)$getSym(2),
1388
							(EList)$getSym(4)
1389
						);
1390
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
1391
					$setResult(result);
1392
		  $EndCode
1393
		./
1394
1395
	stateExpCS ::= pathNameCSOpt
1396
		/.$BeginCode
1397
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
1398
					StateExpCS result = createStateExpCS(pathNameCS);
1399
					setOffsets(result, pathNameCS);
1400
					$setResult(result);
1401
		  $EndCode
1402
		./
1403
	-- FIXME StateExpCS creates a needless irregularity; unwrap its content as an argument list
1404
	operationCallExpCS ::= oclIsInStateName isMarkedPreCS '(' stateExpCS ')'
1405
		/.$BeginCode
1406
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
1407
					CSTNode result = createOperationCallExpCS(
1408
							simpleNameCS,
1409
							(IsMarkedPreCS)$getSym(2),
1410
							(StateExpCS)$getSym(4)
1411
						);
1412
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
1413
					$setResult(result);
1414
		  $EndCode
1415
		./
1416
1417
	attrOrNavCallExpCS ::= simpleNameCS isMarkedPreCS
1418
		/.$NewCase./
1419
	attrOrNavCallExpCS ::= keywordAsName isMarkedPreCS
1420
		/.$BeginCode
1421
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(2);
1422
					CSTNode result = createFeatureCallExpCS(
1423
							(SimpleNameCS)$getSym(1),
1424
							new BasicEList(),
1425
							isMarkedPreCS
1426
						);
1427
					if (isMarkedPreCS.isPre()) {
1428
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(2));
1429
					} else {
1430
						setOffsets(result, (CSTNode)$getSym(1));
1431
					}
1432
					$setResult(result);
1433
		  $EndCode
1434
		./
1435
	attrOrNavCallExpCS ::= simpleNameCS '[' argumentsCS ']' isMarkedPreCS
1436
		/.$BeginCode
1437
					IsMarkedPreCS isMarkedPreCS = (IsMarkedPreCS)$getSym(5);
1438
					CSTNode result = createFeatureCallExpCS(
1439
							(SimpleNameCS)$getSym(1),
1440
							(EList)$getSym(3),
1441
							isMarkedPreCS
1442
						);
1443
					if (isMarkedPreCS.isPre()) {
1444
						setOffsets(result, (CSTNode)$getSym(1), (CSTNode)$getSym(5));
1445
					} else {
1446
						setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
1447
					}
1448
					$setResult(result);
1449
		  $EndCode
1450
		./
1451
1452
	isMarkedPreCS ::= %empty
1453
		/.$BeginCode
1454
					CSTNode result = createIsMarkedPreCS(false);
1455
					setOffsets(result, getIToken($getToken(1)));
1456
					$setResult(result);
1457
		  $EndCode
1458
		./
1459
	isMarkedPreCS ::= '@pre'
1460
		/.$BeginCode
1461
					CSTNode result = createIsMarkedPreCS(true);
1462
					setOffsets(result, getIToken($getToken(1)));
1463
					$setResult(result);
1464
		  $EndCode
1465
		./
1466
1467
	argumentsCSopt ::= %empty
1468
		/.$EmptyListAction./
1469
	argumentsCSopt -> argumentsCS
1470
1471
	argumentsCS ::= oclExpressionCS
1472
		/.$BeginCode
1473
					EList result = new BasicEList();
1474
					result.add($getSym(1));
1475
					$setResult(result);
1476
		  $EndCode
1477
		./
1478
	argumentsCS ::= argumentsCS ',' oclExpressionCS
1479
		/.$BeginCode
1480
					EList result = (EList)$getSym(1);
1481
					result.add($getSym(3));
1482
					$setResult(result);
1483
		  $EndCode
1484
		./
1485
1486
	letExpCS ::= let variableListCS in oclExpressionCS
1487
		/.$BeginCode
1488
					CSTNode result = createLetExpCS(
1489
							(EList)$getSym(2),
1490
							(OCLExpressionCS)$getSym(4)
1491
						);
1492
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(4));
1493
					$setResult(result);
1494
		  $EndCode
1495
		./
1496
1497
	ifExpCS ::= if oclExpressionCS then oclExpressionCS else oclExpressionCS endif
1498
		/.$BeginCode
1499
					CSTNode result = createIfExpCS(
1500
							(OCLExpressionCS)$getSym(2),
1501
							(OCLExpressionCS)$getSym(4),
1502
							(OCLExpressionCS)$getSym(6)
1503
						);
1504
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(7)));
1505
					$setResult(result);
1506
		  $EndCode
1507
		./
1508
1509
	messageExpCS ::= '^' simpleNameCS '(' oclMessageArgumentsCSopt ')'
1510
		/.$NewCase./
1511
	messageExpCS ::= '^^' simpleNameCS '(' oclMessageArgumentsCSopt ')'
1512
		/.$BeginCode
1513
					CSTNode result = createMessageExpCS(
1514
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
1515
							(SimpleNameCS)$getSym(2),
1516
							(EList<OCLMessageArgCS>)$getSym(4)
1517
						);
1518
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
1519
					$setResult(result);
1520
		  $EndCode
1521
		./
1522
1523
	oclMessageArgumentsCSopt ::= %empty
1524
		/.$EmptyListAction./
1525
	oclMessageArgumentsCSopt -> oclMessageArgumentsCS
1526
1527
	oclMessageArgumentsCS ::= oclMessageArgCS
1528
		/.$BeginCode
1529
					EList result = new BasicEList();
1530
					result.add($getSym(1));
1531
					$setResult(result);
1532
		  $EndCode
1533
		./
1534
	oclMessageArgumentsCS ::= oclMessageArgumentsCS ',' oclMessageArgCS
1535
		/.$BeginCode
1536
					EList result = (EList)$getSym(1);
1537
					result.add($getSym(3));
1538
					$setResult(result);
1539
		  $EndCode
1540
		./
1541
1542
	oclMessageArgCS ::= oclExpressionCS
1543
		/.$BeginCode
1544
					CSTNode result = createOCLMessageArgCS(
1545
							null,
1546
							(OCLExpressionCS)$getSym(1)
1547
						);
1548
					setOffsets(result, (CSTNode)$getSym(1));
1549
					$setResult(result);
1550
		  $EndCode
1551
		./
1552
	oclMessageArgCS ::= '?'
1553
		/.$BeginCode
1554
					CSTNode result = createOCLMessageArgCS(
1555
							null,
1556
							null
1557
						);
1558
					setOffsets(result, getIToken($getToken(1)));
1559
					$setResult(result);
1560
		  $EndCode
1561
		./
1562
	oclMessageArgCS ::= '?' ':' typeCS
1563
		/.$BeginCode
1564
					CSTNode result = createOCLMessageArgCS(
1565
							(TypeCS)$getSym(3),
1566
							null
1567
						);
1568
					setOffsets(result, getIToken($getToken(1)), (CSTNode)$getSym(3));
1569
					$setResult(result);
1570
		  $EndCode
1571
		./
1572
1573
%End
(-)src/org/eclipse/ocl/parser/backtracking/OCLBacktrackingLexer.gi (+42 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 Eclipse.org, Open Canarias S.L., and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
14
-- *
15
-- * </copyright>
16
-- *
17
-- * $Id: OCLBacktrackingLexer.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
18
-- */
19
--
20
-- The OCL Backtracking Lexer, which is nominally identical to the
21
-- normal Lexer, however the extra ERROR_TOKEN symbol makes it difficult
22
-- to share reliably.
23
--
24
25
%options escape=$
26
%options la=2
27
%options fp=OCLBacktrackingLexer,prefix=Char_
28
%options single-productions
29
%options noserialize
30
%options package=org.eclipse.ocl.parser.backtracking
31
%options template=../../lpg/LexerTemplateF.gi
32
%options filter=OCLBacktrackingKWLexer.gi
33
%options export_terminals=("OCLBacktrackingParsersym.java", "TK_")
34
%options include_directory="..;../../lpg"
35
36
%Import
37
	OCLLexer.gi
38
%End
39
40
%Define
41
	$kw_lexer_class /.OCLBacktrackingKWLexer./
42
%End
(-)src/org/eclipse/ocl/parser/backtracking/EssentialOCLErrors.gi (+419 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2008, 2009 Eclipse.org, Open Canarias S.L, and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   E.D.Willink - Initial API and implementation
12
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
13
-- *
14
-- * </copyright>
15
-- *
16
-- * $Id: EssentialOCLErrors.g,v 1.1 2009/01/13 20:31:30 cdamus Exp $
17
-- */
18
--
19
-- Additional ERROR_TOKEN rules for The EssentialOCL Backtracking Parser
20
--
21
22
%Rules
23
	ERROR_Colon ::= ERROR_TOKEN
24
		/.$BeginCode
25
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_COLON);
26
		  $EndCode
27
		./
28
	ERROR_Empty ::= ERROR_TOKEN
29
		/.$BeginCode
30
					reportErrorTokenMessage($getToken(1), OCLParserErrors.EXTRA_TOKENS);
31
		  $EndCode
32
		./
33
	ERROR_IsMarkedPreCS ::= ERROR_TOKEN
34
		/.$BeginCode
35
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_AT_PRE);
36
					IsMarkedPreCS result = createIsMarkedPreCS(false);
37
					setOffsets(result, getIToken($getToken(1)));
38
					$setResult(result);
39
		  $EndCode
40
		./
41
42
	ERROR_PathNameCS ::= ERROR_TOKEN
43
		/.$BeginCode
44
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_PATH_NAME);
45
					CSTNode result = createPathNameCS(getTokenText($getToken(1)));
46
					setOffsets(result, getIToken($getToken(1)));
47
					$setResult(result);
48
		  $EndCode
49
		./
50
		
51
	ERROR_SimpleNameCS ::= ERROR_TOKEN
52
		/.$BeginCode
53
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_SIMPLE_NAME);
54
					SimpleNameCS result = createSimpleNameCS(
55
							SimpleTypeEnum.IDENTIFIER_LITERAL,
56
							getTokenText($getToken(1))
57
						);
58
					setOffsets(result, getIToken($getToken(1)));
59
					$setResult(result);
60
		  $EndCode
61
		./
62
63
	attrOrNavCallExpCS ::= simpleNameCS '[' argumentsCS ERROR_TOKEN
64
		/.$BeginCode
65
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RBRACK);
66
					CSTNode result = createFeatureCallExpCS(
67
							(SimpleNameCS)$getSym(1),
68
							(EList)$getSym(3),
69
							createIsMarkedPreCS(false)
70
						);
71
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
72
					$setResult(result);
73
		  $EndCode
74
		./
75
		
76
	collectionTypeCS ::= collectionTypeIdentifierCS '(' typeCS ERROR_TOKEN
77
		/.$BeginCode
78
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RPAREN);
79
					Object[] objs = (Object[])$getSym(1);
80
					CSTNode result = createCollectionTypeCS(
81
							(CollectionTypeIdentifierEnum)objs[1],
82
							(TypeCS)$getSym(3)
83
						);
84
					setOffsets(result, (IToken)objs[0], getIToken($getToken(4)));
85
					$setResult(result);
86
		  $EndCode
87
		./
88
	collectionTypeCS ::= collectionTypeIdentifierCS ERROR_TOKEN
89
		/.$BeginCode
90
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_LPAREN);
91
					Object[] objs = (Object[])$getSym(1);
92
					CSTNode result = createCollectionTypeCS(
93
							(CollectionTypeIdentifierEnum)objs[1],
94
							null
95
						);
96
					setOffsets(result, (IToken)objs[0], getIToken($getToken(2)));
97
					$setResult(result);
98
		  $EndCode
99
		./
100
101
	dotArrowExpCS ::=  pathNameCS '::' ERROR_SimpleNameCS '(' argumentsCSopt ')'
102
		/.$BeginCode
103
					OperationCallExpCS result = createOperationCallExpCS(
104
							(PathNameCS)$getSym(1),
105
							(SimpleNameCS)$getSym(3),
106
							(EList)$getSym(5)
107
						);
108
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(6)));
109
					result.setAccessor(DotOrArrowEnum.DOT_LITERAL);
110
					$setResult(result);
111
		  $EndCode
112
		./
113
-- FIXME	dotArrowExpCS ::= NUMERIC_OPERATION ERROR_SimpleNameCS
114
115
	enumLiteralExpCS ::= pathNameCS '::' ERROR_SimpleNameCS
116
		/.$BeginCode
117
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
118
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(3);
119
					CSTNode result = createEnumLiteralExpCS(
120
							pathNameCS,
121
							simpleNameCS
122
						);
123
					setOffsets(result, pathNameCS, simpleNameCS);
124
					$setResult(result);
125
		  $EndCode
126
		./
127
		
128
	featureCallExpCS ::= unaryName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
129
		/.$NewCase./
130
	keywordOperationCallExpCS ::= keywordAsName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
131
		/.$NewCase./
132
	operationCallExpCS ::= binaryName ERROR_IsMarkedPreCS '(' argumentsCSopt ')'
133
		/.$BeginCode
134
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
135
					CSTNode result = createOperationCallExpCS(
136
							simpleNameCS,
137
							(IsMarkedPreCS)$getSym(2),
138
							(EList)$getSym(4)
139
						);
140
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
141
					$setResult(result);
142
		  $EndCode
143
		./
144
	operationCallExpCS ::= oclIsInStateName ERROR_IsMarkedPreCS '(' stateExpCS ')'
145
		/.$BeginCode
146
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(1);
147
					CSTNode result = createOperationCallExpCS(
148
							simpleNameCS,
149
							(IsMarkedPreCS)$getSym(2),
150
							(StateExpCS)$getSym(4)
151
						);
152
					setOffsets(result, simpleNameCS, getIToken($getToken(5)));
153
					$setResult(result);
154
		  $EndCode
155
		./
156
157
	ifExpCS ::= if oclExpressionCS then oclExpressionCS else oclExpressionCS ERROR_TOKEN
158
		/.$BeginCode
159
					reportErrorTokenMessage($getToken(7), OCLParserErrors.MISSING_ENDIF);
160
					CSTNode result = createIfExpCS(
161
							(OCLExpressionCS)$getSym(2),
162
							(OCLExpressionCS)$getSym(4),
163
							(OCLExpressionCS)$getSym(6)
164
						);
165
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(7)));
166
					$setResult(result);
167
		  $EndCode
168
		./
169
	ifExpCS ::= if oclExpressionCS then oclExpressionCS ERROR_TOKEN
170
		/.$BeginCode
171
					reportErrorTokenMessage($getToken(5), OCLParserErrors.MISSING_ELSE_ENDIF);
172
					CSTNode result = createIfExpCS(
173
							(OCLExpressionCS)$getSym(2),
174
							(OCLExpressionCS)$getSym(4),
175
							createInvalidLiteralExpCS(getTokenText($getToken(5)))
176
						);
177
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
178
					$setResult(result);
179
		  $EndCode
180
		./
181
	ifExpCS ::= if oclExpressionCS ERROR_TOKEN
182
		/.$BeginCode
183
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_THEN_ELSE_ENDIF);
184
					CSTNode result = createIfExpCS(
185
							(OCLExpressionCS)$getSym(2),
186
							createInvalidLiteralExpCS(getTokenText($getToken(3))),
187
							createInvalidLiteralExpCS(getTokenText($getToken(3)))
188
						);
189
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
190
					$setResult(result);
191
		  $EndCode
192
		./
193
	ifExpCS ::= if ERROR_TOKEN endif
194
		/.$BeginCode
195
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_THEN_ELSE);
196
					CSTNode result = createIfExpCS(
197
							createInvalidLiteralExpCS(getTokenText($getToken(2))),
198
							createInvalidLiteralExpCS(getTokenText($getToken(2))),
199
							createInvalidLiteralExpCS(getTokenText($getToken(2)))
200
						);
201
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
202
					$setResult(result);
203
		  $EndCode
204
		./
205
		
206
	messageExpCS ::= '^' simpleNameCS ERROR_TOKEN
207
		/.$NewCase./
208
	messageExpCS ::= '^^' simpleNameCS ERROR_TOKEN
209
		/.$BeginCode
210
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_MESSAGE_ARGUMENTS);
211
					CSTNode result = createMessageExpCS(
212
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
213
							(SimpleNameCS)$getSym(2),
214
							new BasicEList<OCLMessageArgCS>()
215
						);
216
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
217
					$setResult(result);
218
		  $EndCode
219
		./
220
	messageExpCS ::= '^' ERROR_SimpleNameCS
221
		/.$NewCase./
222
	messageExpCS ::= '^^' ERROR_SimpleNameCS
223
		/.$BeginCode
224
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(2);
225
					CSTNode result = createMessageExpCS(
226
							getIToken($getToken(1)).getKind() == $sym_type.TK_CARET,
227
							simpleNameCS,
228
							new BasicEList<OCLMessageArgCS>()
229
						);
230
					setOffsets(result, getIToken($getToken(1)), simpleNameCS);
231
					$setResult(result);
232
		  $EndCode
233
		./
234
235
	oclExpCS ::= ERROR_TOKEN
236
		/.$BeginCode
237
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_EXPR);
238
					CSTNode result = createInvalidLiteralExpCS(getTokenText($getToken(1)));
239
					setOffsets(result, getIToken($getToken(1)));
240
					$setResult(result);
241
		  $EndCode
242
		./
243
	oclExpCS ::= '(' oclExpressionCS ERROR_TOKEN
244
		/.$BeginCode
245
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_RPAREN);
246
					CSTNode result = (CSTNode)$getSym(2);
247
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(3)));
248
					$setResult(result);
249
		  $EndCode
250
		./
251
252
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ')' ERROR_Colon
253
		/.$BeginCode
254
					CSTNode result = createOperationCS(
255
							getTokenText($getToken(1)),
256
							(EList)$getSym(3),
257
							null
258
						);
259
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(5)));
260
					$setResult(result);
261
		  $EndCode
262
		./
263
	operationCS1 ::= IDENTIFIER '(' parametersCSopt ERROR_TOKEN
264
		/.$BeginCode
265
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RPAREN);
266
					CSTNode result = createOperationCS(
267
							getTokenText($getToken(1)),
268
							(EList)$getSym(3),
269
							null
270
						);
271
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
272
					$setResult(result);
273
		  $EndCode
274
		./
275
	operationCS1 ::= IDENTIFIER ERROR_TOKEN
276
		/.$BeginCode
277
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_LPAREN);
278
					CSTNode result = createOperationCS(
279
							getTokenText($getToken(1)),
280
							new BasicEList(),
281
							null
282
						);
283
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
284
					$setResult(result);
285
		  $EndCode
286
		./
287
	operationCS1 ::= ERROR_TOKEN
288
		/.$BeginCode
289
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_IDENTIFIER);
290
					CSTNode result = createOperationCS(
291
							getTokenText($getToken(1)),
292
							new BasicEList(),
293
							null
294
						);
295
					setOffsets(result, getIToken($getToken(1)));
296
					$setResult(result);
297
		  $EndCode
298
		./
299
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ')' ERROR_Colon
300
		/.$BeginCode
301
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
302
					CSTNode result = createOperationCS(
303
							pathNameCS,
304
							(SimpleNameCS)$getSym(3),
305
							(EList)$getSym(5),
306
							(TypeCS)$getSym(8)
307
						);
308
					setOffsets(result, pathNameCS, getIToken($getToken(7)));
309
					$setResult(result);
310
		  $EndCode
311
		./
312
	operationCS2 ::= pathNameCS '::' simpleNameCS '(' parametersCSopt ERROR_TOKEN
313
		/.$BeginCode
314
					reportErrorTokenMessage($getToken(6), OCLParserErrors.MISSING_RPAREN);
315
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
316
					CSTNode result = createOperationCS(
317
							pathNameCS,
318
							(SimpleNameCS)$getSym(3),
319
							(EList)$getSym(5),
320
							null
321
						);
322
					setOffsets(result, pathNameCS, getIToken($getToken(7)));
323
					$setResult(result);
324
		  $EndCode
325
		./
326
	operationCS2 ::= pathNameCS '::' simpleNameCS ERROR_TOKEN
327
		/.$BeginCode
328
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_LPAREN);
329
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
330
					CSTNode result = createOperationCS(
331
							pathNameCS,
332
							(SimpleNameCS)$getSym(3),
333
							new BasicEList(),
334
							null
335
						);
336
					setOffsets(result, pathNameCS, getIToken($getToken(4)));
337
					$setResult(result);
338
		  $EndCode
339
		./
340
	operationCS2 ::= pathNameCS '::' ERROR_SimpleNameCS
341
		/.$BeginCode
342
					PathNameCS pathNameCS = (PathNameCS)$getSym(1);
343
					SimpleNameCS simpleNameCS = (SimpleNameCS)$getSym(3);
344
					CSTNode result = createOperationCS(
345
							pathNameCS,
346
							simpleNameCS,
347
							new BasicEList(),
348
							null
349
						);
350
					setOffsets(result, pathNameCS, simpleNameCS);
351
					$setResult(result);
352
		  $EndCode
353
		./
354
355
	parametersCS ::= ERROR_TOKEN
356
		/.$BeginCode
357
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_PARAMETERS);
358
					EList result = new BasicEList();
359
					$setResult(result);
360
		  $EndCode
361
		./
362
	parametersCS ::= parametersCS ',' ERROR_TOKEN
363
		/.$BeginCode
364
					reportErrorTokenMessage($getToken(3), OCLParserErrors.MISSING_PARAMETER);
365
		  $EndCode
366
		./
367
368
	pathNameCS -> ERROR_PathNameCS
369
		
370
	simpleNameCSopt -> ERROR_SimpleNameCS
371
372
	tupleLiteralExpCS ::= Tuple ERROR_TOKEN
373
		/.$BeginCode
374
					reportErrorTokenMessage($getToken(7), OCLParserErrors.MISSING_LBRACE);
375
					CSTNode result = createTupleLiteralExpCS((EList)$getSym(3));
376
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(4)));
377
					$setResult(result);
378
		  $EndCode
379
		./
380
381
	variableCS ::= IDENTIFIER ERROR_TOKEN
382
		/.$BeginCode
383
					reportErrorTokenMessage($getToken(2), OCLParserErrors.MISSING_VARIABLE_TYPE);
384
					CSTNode result = createVariableCS(
385
							getTokenText($getToken(1)),
386
							null,
387
							null
388
						);
389
					setOffsets(result, getIToken($getToken(1)), getIToken($getToken(2)));
390
					$setResult(result);
391
		  $EndCode
392
		./
393
394
	variableExpCS ::= simpleNameCS '[' argumentsCS ERROR_TOKEN
395
		/.$NewCase./
396
	variableExpCS ::= keywordAsName1 '[' argumentsCS ERROR_TOKEN
397
		/.$BeginCode
398
					reportErrorTokenMessage($getToken(4), OCLParserErrors.MISSING_RBRACK);
399
					CSTNode result = createVariableExpCS(
400
							(SimpleNameCS)$getSym(1),
401
							(EList)$getSym(3),
402
							createIsMarkedPreCS(false)
403
						);
404
					setOffsets(result, (CSTNode)$getSym(1), getIToken($getToken(4)));
405
					$setResult(result);
406
		  $EndCode
407
		./
408
409
	variableListCS ::= ERROR_TOKEN
410
		/.$NewCase./
411
	variableListCS2 ::= ERROR_TOKEN
412
		/.$BeginCode
413
					reportErrorTokenMessage($getToken(1), OCLParserErrors.MISSING_VARIABLES);
414
					EList result = new BasicEList();
415
					$setResult(result);
416
		  $EndCode
417
		./
418
419
%End
(-)src/org/eclipse/ocl/lpg/LexerTemplateF.gi (+331 lines)
Added Link Here
1
--
2
-- An instance of this template must have a $Export section and the export_terminals option
3
--
4
-- Macros that may be redefined in an instance of this template
5
--
6
--     $eof_token
7
--     $additional_interfaces
8
--     $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind
9
--     $prs_stream_class -- use /.PrsStream./ if not subclassing
10
--
11
-- B E G I N N I N G   O F   T E M P L A T E   LexerTemplateF
12
--
13
%Options programming_language=java,margin=4
14
%Options table
15
%options action-block=("*.java", "/.", "./")
16
%options ParseTable=lpg.runtime.ParseTable
17
%Options prefix=Char_
18
19
--
20
-- This template requires that the name of the EOF token be set
21
-- to EOF and that the prefix be "Char_" to be consistent with
22
-- KeywordTemplateD.
23
--
24
%Eof
25
    EOF
26
%End
27
28
--
29
-- This template also requires that the name of the parser EOF
30
-- Token to be exported be set to EOF_TOKEN
31
--
32
%Export
33
    EOF_TOKEN
34
%End
35
36
%Define
37
    --
38
    -- Macros that are be needed in an instance of this template
39
    --
40
    $eof_token /.$_EOF_TOKEN./
41
    
42
    $additional_interfaces /../
43
    $super_lexer_class  /.AbstractLexer./    
44
    $super_stream_class /.$file_prefix$Stream./
45
    $prs_stream_class /.OCLParserStream./    
46
47
    $environment_class /.BasicEnvironment./
48
    $adapt_environment /.environment./
49
50
    $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream
51
                  getPrsStream()./
52
    $setSym1 /. // macro setSym1 is deprecated. Use function setResult
53
               lexParser.setSym1./
54
    $setResult /. // macro setResult is deprecated. Use function setResult
55
                 lexParser.setSym1./
56
    $getSym /. // macro getSym is deprecated. Use function getLastToken
57
              lexParser.getSym./
58
    $getToken /. // macro getToken is deprecated. Use function getToken
59
                lexParser.getToken./
60
    $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan
61
                   lexParser.getFirstToken./
62
    $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan
63
                    lexParser.getLastToken./
64
65
    --
66
    -- Macros useful for specifying actions
67
    --
68
    $Header
69
    /.
70
                //
71
                // Rule $rule_number:  $rule_text
72
                //
73
                ./
74
75
    $DefaultAction
76
    /.$Header$case $rule_number: { ./
77
78
    $BeginAction /.$DefaultAction./
79
80
    $EndAction
81
    /.            break;
82
                }./
83
84
    $BeginJava
85
    /.$BeginAction
86
                $symbol_declarations./
87
88
    $EndJava /.$EndAction./
89
90
    $NoAction
91
    /.$Header$case $rule_number:
92
                    break; ./
93
94
    $BeginActions
95
    /.
96
        public void ruleAction(int ruleNumber)
97
        {
98
            switch(ruleNumber)
99
            {./
100
101
    $SplitActions
102
    /.
103
                    default:
104
                        ruleAction$rule_number(ruleNumber);
105
                        break;
106
                }
107
                return;
108
            }
109
110
            public void ruleAction$rule_number(int ruleNumber)
111
            {
112
                switch (ruleNumber)
113
                {./
114
115
    $EndActions
116
    /.
117
                default:
118
                    break;
119
            }
120
            return;
121
        }./
122
%End
123
124
%Globals
125
    /.import lpg.runtime.*;
126
    import org.eclipse.ocl.lpg.AbstractLexer;
127
    import org.eclipse.ocl.lpg.AbstractLexerStream;
128
    import org.eclipse.ocl.lpg.OCLParserStream;
129
    ./
130
%End
131
132
%Headers
133
    /.
134
    @SuppressWarnings("nls")
135
    public class $action_type extends $super_lexer_class implements RuleAction$additional_interfaces
136
    {
137
        private $super_stream_class lexStream;
138
139
        private static ParseTable prs = new $prs_type();
140
        public ParseTable getParseTable() { return prs; }
141
142
        private LexParser lexParser = new LexParser();
143
        public LexParser getParser() { return lexParser; }
144
145
        public int getToken(int i) { return lexParser.getToken(i); }
146
        public int getRhsFirstTokenIndex(int i) { return lexParser.getFirstToken(i); }
147
        public int getRhsLastTokenIndex(int i) { return lexParser.getLastToken(i); }
148
149
        public int getLeftSpan() { return lexParser.getToken(1); }
150
        public int getRightSpan() { return lexParser.getLastToken(); }
151
152
        public void resetKeywordLexer()
153
        {
154
            if (kwLexer == null)
155
                  this.kwLexer = new $kw_lexer_class(lexStream.getInputChars(), $_IDENTIFIER);
156
            else this.kwLexer.setInputChars(lexStream.getInputChars());
157
        }
158
159
        public void reset(String filename, int tab) throws java.io.IOException
160
        {
161
            lexStream = new $super_stream_class(getOCLEnvironment(), filename, tab);
162
            lexParser.reset(lexStream, prs, this);
163
            resetKeywordLexer();
164
        }
165
166
        public void reset(char[] input_chars, String filename)
167
        {
168
            reset(input_chars, filename, ECLIPSE_TAB_VALUE);
169
        }
170
171
        public void reset(char[] input_chars, String filename, int tab)
172
        {
173
            lexStream = new $super_stream_class(getOCLEnvironment(), input_chars, filename, tab);
174
            lexParser.reset(lexStream, prs, this);
175
            resetKeywordLexer();
176
        }
177
178
        // OCL addition to reset the lexer stream from an input reader
179
        public void reset(Reader reader, String filename) throws java.io.IOException {
180
            reset(reader, filename, ECLIPSE_TAB_VALUE);
181
        }
182
        
183
        // OCL addition to reset the lexer stream from an input reader
184
		  public void reset(Reader reader, String filename, int tab) throws java.io.IOException {
185
        		char[] input_chars = getInputChars(reader);
186
            reset(input_chars, filename, tab);
187
        }
188
189
		  /**
190
		   * @since 3.0
191
		   */
192
        public $action_type($environment_class environment, String filename, int tab) throws java.io.IOException {
193
            super($adapt_environment);
194
            reset(filename, tab);
195
            oclEnvironment = environment;
196
        }
197
198
		  /**
199
		   * @since 3.0
200
		   */
201
        public $action_type($environment_class environment, String filename) throws java.io.IOException{
202
            this(environment, filename, ECLIPSE_TAB_VALUE);
203
        }
204
205
        public $action_type($environment_class environment, char[] input_chars, String filename, int tab) {
206
            super($adapt_environment);
207
            reset(input_chars, filename, tab);
208
            oclEnvironment = environment;
209
        }
210
211
		  public $action_type($environment_class environment, char[] chars) {
212
            this(environment, chars, "OCL", ECLIPSE_TAB_VALUE);
213
		  }
214
215
		  /**
216
		   * @since 3.0
217
		   */
218
		  public $action_type($environment_class environment, Reader reader) throws java.io.IOException {
219
            this(environment, reader, "OCL");
220
		  }
221
222
		  /**
223
		   * @since 3.0
224
		   */
225
        public $action_type($environment_class environment, Reader reader, String filename) throws java.io.IOException {
226
				this(environment, reader, filename, ECLIPSE_TAB_VALUE);
227
		  }
228
		  
229
		  /**
230
		   * @since 3.0
231
		   */
232
		  public $action_type($environment_class environment, Reader reader, String filename, int tab) throws java.io.IOException {
233
				super($adapt_environment);
234
				reset(reader, filename, tab);
235
				oclEnvironment = environment;
236
		  }
237
        
238
        private final $environment_class oclEnvironment;
239
        
240
        public $environment_class getOCLEnvironment() {
241
        	return oclEnvironment;
242
        }
243
244
        public AbstractLexerStream getILexStream() { return lexStream; }
245
246
        /**
247
         * @deprecated replaced by {@link #getILexStream()}
248
         */
249
        public ILexStream getLexStream() { return lexStream; }
250
251
        private void initializeLexer($prs_stream_class prsStream, int start_offset, int end_offset)
252
        {
253
            if (lexStream.getInputChars() == null)
254
                throw new NullPointerException("LexStream was not initialized");
255
            lexStream.setPrsStream(prsStream);
256
            prsStream.makeToken(start_offset, end_offset, 0); // Token list must start with a bad token
257
        }
258
259
        private void addEOF($prs_stream_class prsStream, int end_offset)
260
        {
261
            prsStream.makeToken(end_offset, end_offset, $eof_token); // and end with the end of file token
262
            prsStream.setStreamLength(prsStream.getSize());
263
        }
264
265
        public void lexer($prs_stream_class prsStream)
266
        {
267
            lexer(null, prsStream);
268
        }
269
        
270
        public void lexer(Monitor monitor, $prs_stream_class prsStream)
271
        {
272
            initializeLexer(prsStream, 0, -1);
273
            lexParser.parseCharacters(monitor);  // Lex the input characters
274
            addEOF(prsStream, lexStream.getStreamIndex());
275
        }
276
277
        public void lexer($prs_stream_class prsStream, int start_offset, int end_offset)
278
        {
279
            lexer(null, prsStream, start_offset, end_offset);
280
        }
281
        
282
        public void lexer(Monitor monitor, $prs_stream_class prsStream, int start_offset, int end_offset)
283
        {
284
            if (start_offset <= 1)
285
                 initializeLexer(prsStream, 0, -1);
286
            else initializeLexer(prsStream, start_offset - 1, start_offset - 1);
287
288
            lexParser.parseCharacters(monitor, start_offset, end_offset);
289
290
            addEOF(prsStream, (end_offset >= lexStream.getStreamIndex() ? lexStream.getStreamIndex() : end_offset + 1));
291
        }
292
293
        /**
294
         * If a parse stream was not passed to this Lexical analyser then we
295
         * simply report a lexical error. Otherwise, we produce a bad token.
296
         */
297
        public void reportLexicalError(int startLoc, int endLoc) {
298
            IPrsStream prs_stream = lexStream.getIPrsStream();
299
            if (prs_stream == null)
300
                lexStream.reportLexicalError(startLoc, endLoc);
301
            else {
302
                //
303
                // Remove any token that may have been processed that fall in the
304
                // range of the lexical error... then add one error token that spans
305
                // the error range.
306
                //
307
                for (int i = prs_stream.getSize() - 1; i > 0; i--) {
308
                    if (prs_stream.getStartOffset(i) >= startLoc)
309
                         prs_stream.removeLastToken();
310
                    else break;
311
                }
312
                prs_stream.makeToken(startLoc, endLoc, 0); // add an error token to the prsStream
313
            }        
314
        }
315
    ./
316
%End
317
318
%Rules
319
    /.$BeginActions./
320
%End
321
322
%Trailers
323
    /.
324
        $EndActions
325
    }
326
    ./
327
%End
328
329
--
330
-- E N D   O F   T E M P L A T E
331
--
(-)src/org/eclipse/ocl/parser/OCLLexer.gi (+620 lines)
Added Link Here
1
--/**
2
-- * <copyright>
3
-- *
4
-- * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp., Open Canarias S.L. and others.
5
-- * All rights reserved.   This program and the accompanying materials
6
-- * are made available under the terms of the Eclipse Public License v1.0
7
-- * which accompanies this distribution, and is available at
8
-- * http://www.eclipse.org/legal/epl-v10.html
9
-- *
10
-- * Contributors:
11
-- *   IBM - Initial API and implementation
12
-- *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
13
-- *               - Bug 259818
14
-- *   Borland - Bug 242880
15
-- *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
16
-- *   
17
-- * </copyright>
18
-- *
19
-- * $Id: OCLLexer.g,v 1.2 2009/02/12 00:04:09 cdamus Exp $
20
-- */
21
--
22
-- The OCL Lexer
23
--
24
25
%options escape=$
26
%options la=2
27
%options fp=OCLLexer,prefix=Char_
28
%options single-productions
29
%options noserialize
30
%options package=org.eclipse.ocl.parser
31
%options template=../lpg/LexerTemplateF.gi
32
%options filter=OCLKWLexer.gi
33
%options export_terminals=("OCLParsersym.java", "TK_")
34
%options include_directory="../lpg"
35
36
%Define
37
38
	--
39
	-- Definition of macros used in the template
40
	--
41
	$action_class /.$file_prefix./ -- Deprecated.
42
	$eof_token /.$_EOF_TOKEN./
43
    $environment_class /.Environment<?,?,?,?,?,?,?,?,?,?,?,?>./
44
    $adapt_environment /.OCLUtil.getAdapter(environment, BasicEnvironment.class)./
45
    $environment_import /.org.eclipse.ocl.Environment./
46
 
47
	--
48
	-- Definition of macro used in the included file LexerBasicMap.g
49
	--
50
	$kw_lexer_class /.OCLKWLexer./
51
	$copyright_contributions /.*./
52
53
%End
54
55
%Notice
56
	/./**
57
 * <copyright>
58
 *
59
 * Copyright (c) 2005, 2009 IBM Corporation, Borland Software Corp., Open Canarias S.L. and others.
60
 * All rights reserved.   This program and the accompanying materials
61
 * are made available under the terms of the Eclipse Public License v1.0
62
 * which accompanies this distribution, and is available at
63
 * http://www.eclipse.org/legal/epl-v10.html
64
 *
65
 * Contributors:
66
 *   IBM - Initial API and implementation
67
 *   E.D.Willink - Lexer and Parser refactoring to support extensibility and flexible error handling
68
 *               - Bug 259818
69
 *   Borland - Bug 242880
70
 *   Adolfo Sanchez-Barbudo Herrera - LPG v2.0.17 adoption
71
 $copyright_contributions
72
 * </copyright>
73
 *
74
 * $Id$
75
 */
76
	./
77
%End
78
79
%Import
80
	LexerBasicMapF.gi
81
%End
82
83
%Globals
84
    /.
85
    import java.io.Reader;
86
    
87
    import $environment_import;
88
    import org.eclipse.ocl.lpg.BasicEnvironment;
89
    import org.eclipse.ocl.util.OCLUtil;
90
    ./
91
%End
92
93
%Export
94
95
	IDENTIFIER
96
	STRING_LITERAL
97
	INTEGER_LITERAL
98
	REAL_LITERAL
99
	NUMERIC_OPERATION
100
	INTEGER_RANGE_START
101
	
102
	PLUS
103
	MINUS
104
	MULTIPLY
105
	DIVIDE
106
107
	GREATER
108
	LESS
109
	EQUAL
110
	GREATER_EQUAL
111
	LESS_EQUAL
112
	NOT_EQUAL
113
114
	LPAREN
115
	RPAREN
116
	LBRACE
117
	RBRACE
118
	LBRACKET
119
	RBRACKET
120
121
	ARROW
122
	BAR
123
	COMMA
124
	COLON
125
	COLONCOLON
126
	SEMICOLON
127
	DOT
128
	DOTDOT
129
	ATPRE
130
	
131
	CARET
132
	CARETCARET
133
	QUESTIONMARK
134
		
135
	SINGLE_LINE_COMMENT
136
	MULTI_LINE_COMMENT
137
138
%End
139
140
%Terminals
141
	CtlCharNotWS
142
143
	LF   CR   HT   FF
144
145
	a b c d e f g h i j k l m n o p q r s t u v w x y z
146
	_
147
148
	A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
149
150
	0 1 2 3 4 5 6 7 8 9
151
152
	AfterASCIINotAcute
153
	Space        ::= ' '
154
	LF           ::= NewLine
155
	CR           ::= Return
156
	HT           ::= HorizontalTab
157
	FF           ::= FormFeed
158
	DoubleQuote  ::= '"'
159
	SingleQuote  ::= "'"
160
	Percent      ::= '%'
161
	VerticalBar  ::= '|'
162
	Exclamation  ::= '!'
163
	AtSign       ::= '@'
164
	BackQuote    ::= '`'
165
	Acute        ::= '�'
166
	Tilde        ::= '~'
167
	Sharp        ::= '#'
168
	DollarSign   ::= '$'
169
	Ampersand    ::= '&'
170
	Caret        ::= '^'
171
	Colon        ::= ':'
172
	SemiColon    ::= ';'
173
	BackSlash    ::= '\'
174
	LeftBrace    ::= '{'
175
	RightBrace   ::= '}'
176
	LeftBracket  ::= '['
177
	RightBracket ::= ']'
178
	QuestionMark ::= '?'
179
	Comma        ::= ','
180
	Dot          ::= '.'
181
	LessThan     ::= '<'
182
	GreaterThan  ::= '>'
183
	Plus         ::= '+'
184
	Minus        ::= '-'
185
	Slash        ::= '/'
186
	Star         ::= '*'
187
	LeftParen    ::= '('
188
	RightParen   ::= ')'
189
	Equal        ::= '='
190
191
%End
192
193
%Start
194
	Token
195
%End
196
197
%Rules
198
199
	---------------------  Rules for Scanned Tokens --------------------------------
200
	-- The lexer creates an array list of tokens which is defined in the PrsStream class.
201
	-- A token has three attributes: a start offset, an end offset and a kind.
202
	-- 
203
	-- Only rules that produce complete tokens have actions to create token objects.
204
	-- When making a token, calls to the methods, $getToken(1) and $getRightSpan(), 
205
	-- provide the offsets (i.e. the span) of a rule's right hand side (rhs) and thus of the token.
206
	-- For a rule of the form A ::= A1 A2 ... An, the start offset of the rhs of A is given by
207
	-- $getToken(1) or by $getLeftSpan() and the end offset by $getRightSpan().
208
	--  
209
	-- Regarding rules for parsing in general, note that for a rhs symbol Ai, the 
210
	-- method $getToken(i) returns the location of the leftmost character derived from Ai.  
211
	-- The method $getLeftSpan(i) returns the same location unless Ai produces %empty in which case
212
	-- it returns the location of the last character derived before reducing Ai to %empty. 
213
	-- The method $getRightSpan(i) returns the location of the rightmost character derived from Ai 
214
	-- unless Ai produces %empty in which case it returns the location of the last character 
215
	-- derived before reducing Ai to %empty.
216
	--------------------------------------------------------------------------------
217
	Token ::= Identifier
218
		/.$BeginAction
219
					checkForKeyWord();
220
		  $EndAction
221
		./
222
223
	-- an empty String literal looks just like an escaped single-quote
224
	Token ::= EscapedSQ
225
		/.$BeginAction
226
					makeToken($_STRING_LITERAL);
227
		  $EndAction
228
		./
229
230
	Token ::= SingleQuote SLNotSQ SingleQuote
231
		/.$BeginAction
232
					makeToken($_STRING_LITERAL);
233
		  $EndAction
234
		./
235
236
	Token ::= Acute SLNotSQOpt Acute
237
		/.$BeginAction
238
					makeToken($_STRING_LITERAL);
239
		  $EndAction
240
		./
241
242
	Token ::= BackQuote SLNotSQOpt Acute
243
		/.$BeginAction
244
					makeToken($_STRING_LITERAL);
245
		  $EndAction
246
		./
247
248
	Token ::= IntegerLiteral
249
		/.$BeginAction
250
					makeToken($_INTEGER_LITERAL);
251
		  $EndAction
252
		./
253
254
	Token ::= RealLiteral
255
		/.$BeginAction
256
					makeToken($_REAL_LITERAL);
257
		  $EndAction
258
		./
259
260
	Token ::= NumericOperation
261
		/.$BeginAction
262
					makeToken($_NUMERIC_OPERATION);
263
		  $EndAction
264
		./
265
266
	Token ::= IntegerRangeStart
267
		/.$BeginAction
268
					makeToken($_INTEGER_RANGE_START);
269
		  $EndAction
270
		./
271
272
	Token ::= SLC
273
		/.$BeginAction
274
					makeComment($_SINGLE_LINE_COMMENT);
275
		  $EndAction
276
		./
277
278
    Token ::= '/' '*' Inside Stars '/'
279
        /.$BeginAction
280
                    makeComment($_MULTI_LINE_COMMENT);
281
          $EndAction
282
        ./
283
284
	Token ::= WS -- White Space is scanned but not added to output vector
285
		/.$BeginAction
286
					skipToken();
287
		  $EndAction
288
		./
289
290
	Token ::= '+'
291
		/.$BeginAction
292
					makeToken($_PLUS);
293
		  $EndAction
294
		./
295
296
	Token ::= '-'
297
		/.$BeginAction
298
					makeToken($_MINUS);
299
		  $EndAction
300
		./
301
302
	Token ::= '*'
303
		/.$BeginAction
304
					makeToken($_MULTIPLY);
305
		  $EndAction
306
		./
307
308
	Token ::= '/'
309
		/.$BeginAction
310
					makeToken($_DIVIDE);
311
		  $EndAction
312
		./
313
314
	Token ::= '('
315
		/.$BeginAction
316
					makeToken($_LPAREN);
317
		  $EndAction
318
		./
319
320
	Token ::= ')'
321
		/.$BeginAction
322
					makeToken($_RPAREN);
323
		  $EndAction
324
		./
325
326
	Token ::= '>'
327
		/.$BeginAction
328
					makeToken($_GREATER);
329
		  $EndAction
330
		./
331
		
332
	Token ::= '<'
333
		/.$BeginAction
334
					makeToken($_LESS);
335
		  $EndAction
336
		./
337
338
	Token ::= '='
339
		/.$BeginAction
340
					makeToken($_EQUAL);
341
		  $EndAction
342
		./
343
344
	Token ::= '>' '='
345
		/.$BeginAction
346
					makeToken($_GREATER_EQUAL);
347
		  $EndAction
348
		./
349
350
	Token ::= '<' '='
351
		/.$BeginAction
352
					makeToken($_LESS_EQUAL);
353
		  $EndAction
354
		./
355
356
	Token ::= '<' '>'
357
		/.$BeginAction
358
					makeToken($_NOT_EQUAL);
359
		  $EndAction
360
		./
361
362
	Token ::= '['
363
		/.$BeginAction
364
					makeToken($_LBRACKET);
365
		  $EndAction
366
		./
367
368
	Token ::= ']'
369
		/.$BeginAction
370
					makeToken($_RBRACKET);
371
		  $EndAction
372
		./
373
374
	Token ::= '{'
375
		/.$BeginAction
376
					makeToken($_LBRACE);
377
		  $EndAction
378
		./
379
380
	Token ::= '}'
381
		/.$BeginAction
382
					makeToken($_RBRACE);
383
		  $EndAction
384
		./
385
386
	Token ::= '-' '>'
387
		/.$BeginAction
388
					makeToken($_ARROW);
389
		  $EndAction
390
		./
391
392
	Token ::= '|'
393
		/.$BeginAction
394
					makeToken($_BAR);
395
		  $EndAction
396
		./
397
398
	Token ::= ','
399
		/.$BeginAction
400
					makeToken($_COMMA);
401
		  $EndAction
402
		./
403
404
	Token ::= ':'
405
		/.$BeginAction
406
					makeToken($_COLON);
407
		  $EndAction
408
		./
409
410
	Token ::= ':' ':'
411
		/.$BeginAction
412
					makeToken($_COLONCOLON);
413
		  $EndAction
414
		./
415
416
	Token ::= ';'
417
		/.$BeginAction
418
					makeToken($_SEMICOLON);
419
		  $EndAction
420
		./
421
422
	Token ::= '.'
423
		/.$BeginAction
424
					makeToken($_DOT);
425
		  $EndAction
426
		./
427
428
	Token ::= '.' '.'
429
		/.$BeginAction
430
					makeToken($_DOTDOT);
431
		  $EndAction
432
		./
433
434
	Token ::= '@' p r e
435
		/.$BeginAction
436
					makeToken($_ATPRE);
437
		  $EndAction
438
		./
439
440
441
	Token ::= '^'
442
		/.$BeginAction
443
					makeToken($_CARET);
444
		  $EndAction
445
		./
446
447
	Token ::= '^' '^'
448
		/.$BeginAction
449
					makeToken($_CARETCARET);
450
		  $EndAction
451
		./
452
		
453
	Token ::= '?'
454
		/.$BeginAction
455
					makeToken($_QUESTIONMARK);
456
		  $EndAction
457
		./
458
459
460
    IntegerLiteral -> Integer
461
    --                | '0' LetterXx HexDigits
462
463
    RealLiteral -> Decimal
464
                 | Decimal Exponent
465
                 | Integer Exponent
466
467
    Inside ::= Inside Stars NotSlashOrStar
468
             | Inside '/'
469
             | Inside NotSlashOrStar
470
             | %empty
471
472
    Stars -> '*'
473
           | Stars '*'
474
475
    SLC -> '-' '-'
476
         | SLC NotEol
477
478
    Integer -> Digit
479
             | Integer Digit
480
481
    HexDigits -> HexDigit
482
               | HexDigits HexDigit
483
484
    Decimal -> Integer '.' Integer
485
486
    Exponent -> LetterEe Integer
487
              | LetterEe '-' Integer
488
              | LetterEe '+' Integer
489
490
    WSChar -> Space
491
            | LF
492
            | CR
493
            | HT
494
            | FF
495
496
    Letter -> LowerCaseLetter
497
            | UpperCaseLetter
498
            | _
499
            | AfterASCIINotAcute
500
501
    LowerCaseLetter -> a | b | c | d | e | f | g | h | i | j | k | l | m |
502
                       n | o | p | q | r | s | t | u | v | w | x | y | z
503
504
    UpperCaseLetter -> A | B | C | D | E | F | G | H | I | J | K | L | M |
505
                       N | O | P | Q | R | S | T | U | V | W | X | Y | Z
506
507
    Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
508
509
    OctalDigit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
510
511
    a..fA..F -> a | b | c | d | e | f | A | B | C | D | E | F
512
513
    HexDigit -> Digit
514
              | a..fA..F
515
516
    OctalDigits3 -> OctalDigit
517
                  | OctalDigit OctalDigit
518
                  | OctalDigit OctalDigit OctalDigit
519
520
    LetterEe -> 'E'
521
              | 'e'
522
523
    LetterXx -> 'X'
524
              | 'x'
525
526
    WS -> WSChar
527
        | WS WSChar
528
529
    Identifier -> Letter
530
                | Identifier Letter
531
                | Identifier Digit
532
                | Identifier DollarSign
533
                | QuotedName
534
535
    SpecialNotStar -> '+' | '-' | '/' | '(' | ')' | '"' | '!' | '@' | '`' | '~' |
536
                      '%' | '&' | '^' | ':' | ';' | "'" | '\' | '|' | '{' | '}' |
537
                      '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
538
539
    SpecialNotSlash -> '+' | '-' | -- exclude the star as well
540
                       '(' | ')' | '"' | '!' | '@' | '`' | '~' |
541
                       '%' | '&' | '^' | ':' | ';' | "'" | '\' | '|' | '{' | '}' |
542
                       '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
543
544
    SpecialNotSQNotDQ -> '+' | '-' | '/' | '(' | ')' | '*' | '!' | '@' | '`' | '~' |
545
                         '%' | '&' | '^' | ':' | ';' | '|' | '{' | '}' |
546
                         '[' | ']' | '?' | ',' | '.' | '<' | '>' | '=' | '#' | DollarSign
547
548
    
549
    SpecialNotDQ -> SpecialNotSQNotDQ | "'"
550
    SpecialNotSQ -> SpecialNotSQNotDQ | '"'
551
552
    EscapedSymbols -> NotSQNotDQ | '"' | "'" | '\'
553
    BackslashEscapedSymbol -> '\' EscapedSymbols
554
555
    NotSlashOrStar -> Letter
556
                    | Digit
557
                    | SpecialNotSlash
558
                    | WSChar
559
560
    NotEol -> Letter
561
            | Digit
562
            | Space
563
            | '*'
564
            | SpecialNotStar
565
            | HT
566
            | FF
567
            | CtlCharNotWS
568
569
    NotSQNotDQ -> Letter
570
           | Digit
571
           | SpecialNotSQNotDQ
572
           | Space
573
574
    NotDQ -> Letter
575
           | Digit
576
           | SpecialNotDQ
577
           | Space
578
           | EscapedDQ
579
           --| '\' u HexDigit HexDigit HexDigit HexDigit
580
           --| '\' OctalDigit
581
582
    NotSQ -> Letter
583
           | Digit
584
           | SpecialNotSQ
585
           | Space
586
           | EscapedSQ
587
           | BackslashEscapedSymbol
588
           --| '\' u HexDigit HexDigit HexDigit HexDigit
589
           --| '\' OctalDigit
590
591
	EscapedSQ -> SingleQuote SingleQuote
592
593
	-- maintain this for compatibility with the "...\"..." escapes in an
594
	-- escape mechanism (double-quotes) that isn't compliant, anyway
595
	EscapedDQ -> '\' DoubleQuote
596
597
	SLNotDQ -> NotDQ
598
	         | SLNotDQ NotDQ
599
600
	SLNotSQ -> NotSQ
601
	         | SLNotSQ NotSQ
602
603
	SLNotSQOpt -> %empty
604
	            | SLNotSQ
605
606
	QuotedName -> '"' SLNotDQ '"'
607
608
	NumericOperation -> Integer '.' Identifier
609
	NumericOperation -> Integer '.' '+'
610
	NumericOperation -> Integer '.' '-'
611
	NumericOperation -> Integer '.' '*'
612
	NumericOperation -> Integer '.' '/'
613
	NumericOperation -> Integer '.' '<'
614
	NumericOperation -> Integer '.' '<' '='
615
	NumericOperation -> Integer '.' '>' '='
616
	NumericOperation -> Integer '.' '>'
617
618
	IntegerRangeStart -> Integer '.' '.'
619
620
%End

Return to bug 242153