org.eclipse.gmt.umlx.ocl.cst.parser
Class AbstractOCLParser<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

java.lang.Object
  extended by org.eclipse.gmt.umlx.cst.parser.AbstractParser
      extended by org.eclipse.gmt.umlx.ocl.cst.parser.AbstractOCLParser<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
All Implemented Interfaces:
org.eclipse.gmt.umlx.cst.parser.LexerErrorHandler, org.eclipse.gmt.umlx.cst.parser.ParserErrorHandler
Direct Known Subclasses:
AbstractQVTcParserUtils, AbstractQVTrParserUtils, OCLParser

public abstract class AbstractOCLParser<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
extends org.eclipse.gmt.umlx.cst.parser.AbstractParser

The OCLLpgParser parses an OCL expression into a CST. Once the CST is created, the OCLParser walks the CST and creates the OCL AST. It is necessary that this be done in two steps because LPG is a bottom up parser and cannot provide enough contextual information to create the AST on the first pass.

Author:
Christian Vogt (cvogt)

Field Summary
static java.lang.String[] errorMessages
           
 
Constructor Summary
AbstractOCLParser(org.eclipse.ocl.Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)
           
 
Method Summary
static boolean equalName(java.lang.String name, java.lang.String elementName)
          Checks whether the names are equal, accounting for possibility of underscore-escaped names.
static boolean isEscaped(java.lang.String name)
          Queries whether the specified name is escaped with an initial underscore ('_') character.
static boolean isIdentifierOrKeyword(int tokenKind)
          Returns true if the token kind is an identifier or keyword, othewise false.
static java.lang.String unescape(java.lang.String name)
          Obtains the unescaped name (assuming that it is escaped) for another attempt to look it up.
 
Methods inherited from class org.eclipse.gmt.umlx.cst.parser.AbstractParser
computeInputString, computeInputString, dumpTokens, ERROR, flushErrors, formatClass, formatEClassName, formatName, formatPath, formatPath, formatString, formatType, getCharOffset, getErrorHandler, getInputChars, getLexStream, getMonitor, getPrsStream, getTraceFlag, isCancelled, lexerError, parserError, setCharacterOffset, setErrorHandler, setFileName, setInputChars, setInputReader, setMonitor, setTab, setTraceFlag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorMessages

public static final java.lang.String[] errorMessages
Constructor Detail

AbstractOCLParser

public AbstractOCLParser(org.eclipse.ocl.Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)
Method Detail

isIdentifierOrKeyword

public static boolean isIdentifierOrKeyword(int tokenKind)
Returns true if the token kind is an identifier or keyword, othewise false.

Parameters:
tokenKind - the token kind to compare
Returns:
true if the token kind is an identifier or keyword, otherwise false

isEscaped

public static boolean isEscaped(java.lang.String name)
Queries whether the specified name is escaped with an initial underscore ('_') character.

Parameters:
name - a name
Returns:
whether it begins with the underscore escape prefix

unescape

public static java.lang.String unescape(java.lang.String name)
Obtains the unescaped name (assuming that it is escaped) for another attempt to look it up.

Parameters:
name - an OCL-escaped name
Returns:
the unescaped name

equalName

public static boolean equalName(java.lang.String name,
                                java.lang.String elementName)
Checks whether the names are equal, accounting for possibility of underscore-escaped names.

Parameters:
name - a possibly underscore-escaped name
elementName - name of an element in the model
Returns:
whether the element name is equivalent to this name