org.eclipse.ocl.parser
Class AbstractOCLParser

java.lang.Object
  extended by lpg.lpgjavaruntime.PrsStream
      extended by org.eclipse.ocl.lpg.AbstractParser
          extended by org.eclipse.ocl.parser.AbstractOCLParser
All Implemented Interfaces:
lpg.lpgjavaruntime.ParseErrorCodes, lpg.lpgjavaruntime.TokenStream
Direct Known Subclasses:
OCLBacktrackingParser, OCLParser

public abstract class AbstractOCLParser
extends AbstractParser


Field Summary
 
Fields inherited from interface lpg.lpgjavaruntime.ParseErrorCodes
BEFORE_CODE, DELETION_CODE, EOF_CODE, ERROR_CODE, errorMsgText, INSERTION_CODE, INVALID_CODE, INVALID_TOKEN_CODE, LEX_ERROR_CODE, MERGE_CODE, MISPLACED_CODE, SCOPE_CODE, SECONDARY_CODE, SUBSTITUTION_CODE
 
Constructor Summary
AbstractOCLParser(AbstractLexer lexStream)
           
AbstractOCLParser(BasicEnvironment environment)
           
 
Method Summary
protected  BooleanLiteralExpCS createBooleanLiteralExpCS(String string)
           
protected  ClassifierContextDeclCS createClassifierContextDeclCS(PathNameCS pathNameCS, EList<InvOrDefCS> constraints)
          Creates a classifier context declaration.
protected  ClassifierContextDeclCS createClassifierContextDeclCS(PathNameCS pathNameCS, InvOrDefCS invOrDefCS)
          Deprecated. As of 1.3, the createClassifierContextDeclCS(PathNameCS, EList) method should be used, instead.
protected  CollectionLiteralExpCS createCollectionLiteralExpCS(CollectionTypeIdentifierEnum type, EList<CollectionLiteralPartCS> collectionLiteralParts)
           
protected  CollectionLiteralPartCS createCollectionLiteralPartCS(OCLExpressionCS oclExpressionCS)
           
protected  CollectionRangeCS createCollectionRangeCS(OCLExpressionCS oclExpressionCS, OCLExpressionCS lastOCLExpressionCS)
           
protected  CollectionTypeCS createCollectionTypeCS(CollectionTypeIdentifierEnum collectionType, TypeCS typeCS)
           
protected  DefCS createDefCS(InvOrDefCS invOrDefCS, SimpleNameCS simpleNameCS, DefExpressionCS defExpressionCS)
          Deprecated. As of 1.3, the #createDefCS(SimpleNameCS, OCLExpressionCS) method should be used, instead.
protected  DefCS createDefCS(SimpleNameCS simpleNameCS, DefExpressionCS defExpressionCS)
          Creates a definition constraint.
protected  DefExpressionCS createDefExpressionCS(VariableCS variableCS, OperationCS operationCS, OCLExpressionCS oclExpressionCS)
           
protected  DerValueCS createDerValueCS(InitOrDerValueCS initOrDerValueCS, OCLExpressionCS oclExpressionCS)
           
protected  EnumLiteralExpCS createEnumLiteralExpCS(PathNameCS pathNameCS, SimpleNameCS simpleNameCS)
           
protected  EnumLiteralExpCS createEnumLiteralExpCS(PathNameCS pathNameCS, String simpleName)
          Deprecated. Use createEnumLiteralExpCS(PathNameCS, SimpleNameCS) , instead.
protected  FeatureCallExpCS createFeatureCallExpCS(SimpleNameCS simpleNameCS, EList<OCLExpressionCS> arguments, IsMarkedPreCS isMarkedPreCS)
           
protected  IfExpCS createIfExpCS(OCLExpressionCS condition, OCLExpressionCS thenExpression, OCLExpressionCS elseExpression)
           
protected  InitValueCS createInitValueCS(InitOrDerValueCS initOrDerValueCS, OCLExpressionCS oclExpressionCS)
           
protected  IntegerLiteralExpCS createIntegerLiteralExpCS(String string)
           
protected  InvalidLiteralExpCS createInvalidLiteralExpCS(String string)
           
protected  InvCS createInvCS(InvOrDefCS invOrDefCS, SimpleNameCS simpleNameCS, OCLExpressionCS oclExpressionCS)
          Deprecated. As of 1.3, the createInvCS(SimpleNameCS, OCLExpressionCS) method should be used, instead.
protected  InvCS createInvCS(SimpleNameCS simpleNameCS, OCLExpressionCS oclExpressionCS)
          Creates an invariant constraint.
protected  IsMarkedPreCS createIsMarkedPreCS(boolean isMarkedPre)
           
protected  IterateExpCS createIterateExpCS(SimpleNameCS simpleNameCS, VariableCS variable1, VariableCS variable2, OCLExpressionCS oclExpressionCS)
           
protected  IteratorExpCS createIteratorExpCS(SimpleNameCS simpleNameCS, VariableCS variable1, VariableCS variable2, OCLExpressionCS oclExpressionCS)
           
protected  LetExpCS createLetExpCS(EList<VariableCS> variables, OCLExpressionCS oclExpressionCS)
           
protected  MessageExpCS createMessageExpCS(boolean hasSent, SimpleNameCS simpleNameCS, EList<OCLMessageArgCS> oclMessageArgs)
           
protected  NullLiteralExpCS createNullLiteralExpCS(String string)
           
protected  OCLDocumentCS createOCLDocumentCS(PackageDeclarationCS packageDecl)
          Creates an OCL document CS from a chain of package context declarations.
protected  OCLMessageArgCS createOCLMessageArgCS(TypeCS typeCS, OCLExpressionCS oclExpressionCS)
           
protected  OperationCallExpCS createOperationCallExpCS(OCLExpressionCS oclExpressionCS, SimpleNameCS simpleNameCS, EList<OCLExpressionCS> arguments)
           
protected  OperationCallExpCS createOperationCallExpCS(OCLExpressionCS oclExpressionCS, SimpleNameCS simpleNameCS, IsMarkedPreCS isMarkedPreCS, EList<OCLExpressionCS> arguments)
           
protected  OperationCallExpCS createOperationCallExpCS(SimpleNameCS simpleNameCS, IsMarkedPreCS isMarkedPreCS, EList<OCLExpressionCS> arguments)
           
protected  OperationCallExpCS createOperationCallExpCS(SimpleNameCS simpleNameCS, IsMarkedPreCS isMarkedPreCS, StateExpCS stateExpCS)
           
protected  OperationContextDeclCS createOperationContextDeclCS(OperationCS operationCS, EList<PrePostOrBodyDeclCS> prePostOrBodyDecls)
           
protected  OperationCS createOperationCS(PathNameCS pathNameCS, SimpleNameCS simpleNameCS, EList<VariableCS> list, TypeCS typeCS)
           
protected  OperationCS createOperationCS(String simpleName, EList<VariableCS> list, TypeCS typeCS)
           
protected  PackageDeclarationCS createPackageDeclarationCS(PathNameCS pathNameCS, EList<ContextDeclCS> contextDecls)
           
protected  PathNameCS createPathNameCS()
           
protected  PathNameCS createPathNameCS(String pathName)
           
protected  PrePostOrBodyDeclCS createPrePostOrBodyDeclCS(PrePostOrBodyEnum kind, SimpleNameCS simpleNameCS, OCLExpressionCS oclExpressionCS)
           
protected  PrimitiveTypeCS createPrimitiveTypeCS(SimpleTypeEnum type, String value)
           
protected  PropertyContextCS createPropertyContextCS(PathNameCS pathNameCS, SimpleNameCS simpleNameCS, TypeCS typeCS, InitOrDerValueCS initOrDerValueCS)
           
protected  IntegerLiteralExpCS createRangeStart(String integerDotDot, boolean isNegative)
           
protected  RealLiteralExpCS createRealLiteralExpCS(String string)
           
protected  SimpleNameCS createSimpleNameCS(SimpleTypeEnum type, String value)
           
protected  StateExpCS createStateExpCS(PathNameCS pathName)
           
protected  StringLiteralExpCS createStringLiteralExpCS(String string)
           
protected  TupleLiteralExpCS createTupleLiteralExpCS(EList<VariableCS> variables)
           
protected  TupleTypeCS createTupleTypeCS(EList<VariableCS> variables)
           
protected  UnlimitedNaturalLiteralExpCS createUnlimitedNaturalLiteralExpCS(String string)
           
protected  VariableCS createVariableCS(String varName, TypeCS typeCS, OCLExpressionCS oclExpressionCS)
           
protected  VariableExpCS createVariableExpCS(SimpleNameCS simpleNameCS, EList<OCLExpressionCS> arguments, IsMarkedPreCS isMarkedPreCS)
           
protected  PathNameCS extendPathNameCS(PathNameCS path, String name)
           
protected  boolean isAtPre(IsMarkedPreCS atPreCS)
          Queries whether the specified @pre construct was actually present in the text.
protected  boolean isNonStdSQSupported()
          To be overridden in parsers which prohibit non-std SQL-like single quote escaping (" '' ").
protected  String unescape(lpg.lpgjavaruntime.IToken stringLiteral)
           Escaping support based on the QVT specification (8.4.3).
 
Methods inherited from class org.eclipse.ocl.lpg.AbstractParser
computeInputString, getDefaultRepairCount, getEnvironment, getErrorTokenAtCharacter, getErrorTokens, getLexer, getTokenIndexAtCharacter, makeErrorToken, parseTokensToCST, parseTokensToCST, reportError, reportErrorTokenMessage, resetLexStream, setDefaultRepairCount, setLexStream, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, unquote
 
Methods inherited from class lpg.lpgjavaruntime.PrsStream
addAdjunct, addToken, afterEol, badToken, dumpToken, dumpTokens, getAdjuncts, getColumn, getColumnOfTokenAt, getEndColumn, getEndColumnOfTokenAt, getEndLine, getEndLineNumberOfTokenAt, getEndOffset, getFileName, getFirstErrorToken, getFirstRealToken, getFollowingAdjuncts, getInputChars, getIToken, getKind, getLastErrorToken, getLastRealToken, getLexStream, getLine, getLineNumberOfTokenAt, getName, getNext, getPrecedingAdjuncts, getPrevious, getSize, getStartOffset, getStreamIndex, getStreamLength, getToken, getToken, getTokenAt, getTokenAtCharacter, getTokenLength, getTokens, getTokenText, makeAdjunct, makeToken, mapKind, orderedTerminalSymbols, peek, remapTerminalSymbols, reportError, reportError, reportError, reset, reset, resetTokenStream, setSize, setStreamIndex, setStreamLength, setStreamLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOCLParser

public AbstractOCLParser(BasicEnvironment environment)

AbstractOCLParser

public AbstractOCLParser(AbstractLexer lexStream)
Method Detail

createPackageDeclarationCS

protected PackageDeclarationCS createPackageDeclarationCS(PathNameCS pathNameCS,
                                                          EList<ContextDeclCS> contextDecls)

createPropertyContextCS

protected PropertyContextCS createPropertyContextCS(PathNameCS pathNameCS,
                                                    SimpleNameCS simpleNameCS,
                                                    TypeCS typeCS,
                                                    InitOrDerValueCS initOrDerValueCS)

createDerValueCS

protected DerValueCS createDerValueCS(InitOrDerValueCS initOrDerValueCS,
                                      OCLExpressionCS oclExpressionCS)

createInitValueCS

protected InitValueCS createInitValueCS(InitOrDerValueCS initOrDerValueCS,
                                        OCLExpressionCS oclExpressionCS)

createClassifierContextDeclCS

@Deprecated
protected ClassifierContextDeclCS createClassifierContextDeclCS(PathNameCS pathNameCS,
                                                                           InvOrDefCS invOrDefCS)
Deprecated. As of 1.3, the createClassifierContextDeclCS(PathNameCS, EList) method should be used, instead.


createClassifierContextDeclCS

protected ClassifierContextDeclCS createClassifierContextDeclCS(PathNameCS pathNameCS,
                                                                EList<InvOrDefCS> constraints)
Creates a classifier context declaration.

Parameters:
pathNameCS - the concrete syntax of the classifier's qualified name
constraints - the concrete syntax of the invariant and/or definition constraints in the classifier context
Returns:
the classifier context declaration
Since:
1.3

createInvCS

@Deprecated
protected InvCS createInvCS(InvOrDefCS invOrDefCS,
                                       SimpleNameCS simpleNameCS,
                                       OCLExpressionCS oclExpressionCS)
Deprecated. As of 1.3, the createInvCS(SimpleNameCS, OCLExpressionCS) method should be used, instead.


createInvCS

protected InvCS createInvCS(SimpleNameCS simpleNameCS,
                            OCLExpressionCS oclExpressionCS)
Creates an invariant constraint.

Parameters:
simpleNameCS - the concrete syntax of the constraint name, or null if none
oclExpressionCS - the concrete syntax of the constraint expression
Returns:
the concrete syntax of the invariant constraint
Since:
1.3

createDefCS

@Deprecated
protected DefCS createDefCS(InvOrDefCS invOrDefCS,
                                       SimpleNameCS simpleNameCS,
                                       DefExpressionCS defExpressionCS)
Deprecated. As of 1.3, the #createDefCS(SimpleNameCS, OCLExpressionCS) method should be used, instead.


createDefCS

protected DefCS createDefCS(SimpleNameCS simpleNameCS,
                            DefExpressionCS defExpressionCS)
Creates a definition constraint.

Parameters:
simpleNameCS - the concrete syntax of the constraint name
oclExpressionCS - the concrete syntax of the constraint expression
Returns:
the concrete syntax of the definition constraint
Since:
1.3

createDefExpressionCS

protected DefExpressionCS createDefExpressionCS(VariableCS variableCS,
                                                OperationCS operationCS,
                                                OCLExpressionCS oclExpressionCS)

createOperationContextDeclCS

protected OperationContextDeclCS createOperationContextDeclCS(OperationCS operationCS,
                                                              EList<PrePostOrBodyDeclCS> prePostOrBodyDecls)

createPrePostOrBodyDeclCS

protected PrePostOrBodyDeclCS createPrePostOrBodyDeclCS(PrePostOrBodyEnum kind,
                                                        SimpleNameCS simpleNameCS,
                                                        OCLExpressionCS oclExpressionCS)

createOperationCS

protected OperationCS createOperationCS(PathNameCS pathNameCS,
                                        SimpleNameCS simpleNameCS,
                                        EList<VariableCS> list,
                                        TypeCS typeCS)

createOperationCS

protected OperationCS createOperationCS(String simpleName,
                                        EList<VariableCS> list,
                                        TypeCS typeCS)

createOperationCallExpCS

protected OperationCallExpCS createOperationCallExpCS(OCLExpressionCS oclExpressionCS,
                                                      SimpleNameCS simpleNameCS,
                                                      IsMarkedPreCS isMarkedPreCS,
                                                      EList<OCLExpressionCS> arguments)

isAtPre

protected boolean isAtPre(IsMarkedPreCS atPreCS)
Queries whether the specified @pre construct was actually present in the text. This method is safe with null inputs.

Parameters:
atPreCS - an "at pre" construct or null
Returns:
true if the atPreCS is present; false, otherwise
Since:
1.3

createOperationCallExpCS

protected OperationCallExpCS createOperationCallExpCS(OCLExpressionCS oclExpressionCS,
                                                      SimpleNameCS simpleNameCS,
                                                      EList<OCLExpressionCS> arguments)

createOperationCallExpCS

protected OperationCallExpCS createOperationCallExpCS(SimpleNameCS simpleNameCS,
                                                      IsMarkedPreCS isMarkedPreCS,
                                                      EList<OCLExpressionCS> arguments)

createOperationCallExpCS

protected OperationCallExpCS createOperationCallExpCS(SimpleNameCS simpleNameCS,
                                                      IsMarkedPreCS isMarkedPreCS,
                                                      StateExpCS stateExpCS)

createStateExpCS

protected StateExpCS createStateExpCS(PathNameCS pathName)

createVariableExpCS

protected VariableExpCS createVariableExpCS(SimpleNameCS simpleNameCS,
                                            EList<OCLExpressionCS> arguments,
                                            IsMarkedPreCS isMarkedPreCS)

createSimpleNameCS

protected SimpleNameCS createSimpleNameCS(SimpleTypeEnum type,
                                          String value)

createPrimitiveTypeCS

protected PrimitiveTypeCS createPrimitiveTypeCS(SimpleTypeEnum type,
                                                String value)

createPathNameCS

protected PathNameCS createPathNameCS(String pathName)

extendPathNameCS

protected PathNameCS extendPathNameCS(PathNameCS path,
                                      String name)

createPathNameCS

protected PathNameCS createPathNameCS()

createEnumLiteralExpCS

protected EnumLiteralExpCS createEnumLiteralExpCS(PathNameCS pathNameCS,
                                                  SimpleNameCS simpleNameCS)

createEnumLiteralExpCS

@Deprecated
protected EnumLiteralExpCS createEnumLiteralExpCS(PathNameCS pathNameCS,
                                                             String simpleName)
Deprecated. Use createEnumLiteralExpCS(PathNameCS, SimpleNameCS) , instead.


createCollectionLiteralExpCS

protected CollectionLiteralExpCS createCollectionLiteralExpCS(CollectionTypeIdentifierEnum type,
                                                              EList<CollectionLiteralPartCS> collectionLiteralParts)

createCollectionLiteralPartCS

protected CollectionLiteralPartCS createCollectionLiteralPartCS(OCLExpressionCS oclExpressionCS)

createCollectionRangeCS

protected CollectionRangeCS createCollectionRangeCS(OCLExpressionCS oclExpressionCS,
                                                    OCLExpressionCS lastOCLExpressionCS)

createRangeStart

protected IntegerLiteralExpCS createRangeStart(String integerDotDot,
                                               boolean isNegative)

createTupleLiteralExpCS

protected TupleLiteralExpCS createTupleLiteralExpCS(EList<VariableCS> variables)

createIntegerLiteralExpCS

protected IntegerLiteralExpCS createIntegerLiteralExpCS(String string)

createUnlimitedNaturalLiteralExpCS

protected UnlimitedNaturalLiteralExpCS createUnlimitedNaturalLiteralExpCS(String string)

createRealLiteralExpCS

protected RealLiteralExpCS createRealLiteralExpCS(String string)

createStringLiteralExpCS

protected StringLiteralExpCS createStringLiteralExpCS(String string)

createBooleanLiteralExpCS

protected BooleanLiteralExpCS createBooleanLiteralExpCS(String string)

createNullLiteralExpCS

protected NullLiteralExpCS createNullLiteralExpCS(String string)

createInvalidLiteralExpCS

protected InvalidLiteralExpCS createInvalidLiteralExpCS(String string)

createIteratorExpCS

protected IteratorExpCS createIteratorExpCS(SimpleNameCS simpleNameCS,
                                            VariableCS variable1,
                                            VariableCS variable2,
                                            OCLExpressionCS oclExpressionCS)

createIterateExpCS

protected IterateExpCS createIterateExpCS(SimpleNameCS simpleNameCS,
                                          VariableCS variable1,
                                          VariableCS variable2,
                                          OCLExpressionCS oclExpressionCS)

createVariableCS

protected VariableCS createVariableCS(String varName,
                                      TypeCS typeCS,
                                      OCLExpressionCS oclExpressionCS)

createCollectionTypeCS

protected CollectionTypeCS createCollectionTypeCS(CollectionTypeIdentifierEnum collectionType,
                                                  TypeCS typeCS)

createTupleTypeCS

protected TupleTypeCS createTupleTypeCS(EList<VariableCS> variables)

createFeatureCallExpCS

protected FeatureCallExpCS createFeatureCallExpCS(SimpleNameCS simpleNameCS,
                                                  EList<OCLExpressionCS> arguments,
                                                  IsMarkedPreCS isMarkedPreCS)

createIsMarkedPreCS

protected IsMarkedPreCS createIsMarkedPreCS(boolean isMarkedPre)

createLetExpCS

protected LetExpCS createLetExpCS(EList<VariableCS> variables,
                                  OCLExpressionCS oclExpressionCS)

createIfExpCS

protected IfExpCS createIfExpCS(OCLExpressionCS condition,
                                OCLExpressionCS thenExpression,
                                OCLExpressionCS elseExpression)

createMessageExpCS

protected MessageExpCS createMessageExpCS(boolean hasSent,
                                          SimpleNameCS simpleNameCS,
                                          EList<OCLMessageArgCS> oclMessageArgs)

createOCLMessageArgCS

protected OCLMessageArgCS createOCLMessageArgCS(TypeCS typeCS,
                                                OCLExpressionCS oclExpressionCS)

createOCLDocumentCS

protected OCLDocumentCS createOCLDocumentCS(PackageDeclarationCS packageDecl)
Creates an OCL document CS from a chain of package context declarations.

Parameters:
packageDecl - a chain of package context declarations
Returns:
the document CS
Since:
1.3

unescape

protected String unescape(lpg.lpgjavaruntime.IToken stringLiteral)

Escaping support based on the QVT specification (8.4.3).

All the usual escape characters using backslash can be used including the '\n' new-line character. The list of available escape characters are those defined for the Java language.

EscapeSequence:

\b : backspace BS
\t : horizontal tab HT
\n : line feed LF
\f : form feed FF
\r : carriage return CR
\" ": double quote "
\' ': single quote '
\\ \: backslash \
OctalEscape to ΓΏ: from octal value
\ ZeroToThree OctalDigit OctalDigit
OctalDigit 0 1 2 3 4 5 6 7
ZeroToThree 0 1 2 3

Parameters:
stringLiteral - a string literal token with escape notation
Returns:
the unescaped string
Since:
1.3

isNonStdSQSupported

protected boolean isNonStdSQSupported()
To be overridden in parsers which prohibit non-std SQL-like single quote escaping (" '' ").

Returns:
true if such escaping is supported, false otherwise
Since:
1.3

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.