|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.ocl.lpg.AbstractAnalyzer
public abstract class AbstractAnalyzer
The AbstractAnalyzer
supports semantic analysis of a CST
produced by an AbstractParser
to create a corresponding AST. It
is necessary that syntactic parsing and semantic analysis are performed in
two steps because LPG is a bottom up parser and cannot provide enough
contextual information to create the AST on the first pass.
Derived classes should extend the abstract support for AST from CST from
tokens from text parsing and analysis to support the AST and CST classes
appropriate to a particular language.
Constructor Summary | |
---|---|
protected |
AbstractAnalyzer(AbstractParser parser)
|
Method Summary | |
---|---|
String |
computeInputString(CSTNode node)
Obtains the text from which the specified CST node was
parsed. |
void |
dumpTokens()
|
void |
ERROR(List<?> problemObjects,
String rule,
String problemMessage)
|
void |
ERROR(Object problemObject,
String rule,
String problemMessage)
|
void |
ERROR(String problemMessage)
|
String |
formatClass(Object object)
|
String |
formatEClassName(EObject object)
|
String |
formatName(Object object)
|
String |
formatPath(List<String> pathName)
|
String |
formatPath(List<String> pathName,
String name)
|
String |
formatQualifiedName(Object object)
|
String |
formatString(String string)
|
String |
formatType(Object object)
|
AbstractParser |
getAbstractParser()
Obtains the parser that I use to transform the OCL text into the Concrete Syntax Model. |
int |
getCharOffset()
|
BasicEnvironment |
getEnvironment()
|
FormattingHelper |
getFormatter()
Get the message formatting assistant, returning the value set by setFormatter, if non-null, else that provided by the environment, if non-null, else AbstractFormattingHelper.INSTANCE. |
AbstractLexer |
getLexer()
|
AbstractParser |
getParser()
Deprecated. Since 1.3, use the getAbstractParser() method,
instead. |
boolean |
getTraceFlag()
|
void |
initialize(char[] buffer)
Define the input text as a given array of characters. |
void |
initialize(Reader reader)
Define the input text by reading from a reader. |
protected void |
initPropertyPositions(CallingASTNode callingASTNode,
CSTNode cstNode)
Initializes the start and end positions of the property name in the specified calling AST node. |
protected void |
initStartEndPositions(ASTNode astNode,
CSTNode cstNode)
Initializes the start and end positions of the specified AST node from the given CST node |
protected void |
initTypePositions(TypedASTNode typedASTNode,
CSTNode cstNode)
Initializes the type start and end positions of the specified typed AST node from the given CST node |
protected String |
makeName(EList<String> namelist)
Creates a string by joining the given string list elements with ::. |
protected String |
makeString(EList<String> namelist)
Creates a string by joining the given string list elements with spaces. |
void |
setCharacterOffset(int offset)
Sets the character index offset of the input. |
void |
setFileName(String filename)
|
void |
setTab(int tab)
|
void |
setTraceFlag(boolean flag)
|
protected void |
TRACE(String rule,
String message)
|
protected void |
TRACE(String rule,
String message,
EList<String> namelist)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractAnalyzer(AbstractParser parser)
Method Detail |
---|
public String computeInputString(CSTNode node)
node
was
parsed.
node
- a concrete syntax node
public void dumpTokens()
public String formatClass(Object object)
public String formatEClassName(EObject object)
public String formatName(Object object)
public String formatQualifiedName(Object object)
public String formatPath(List<String> pathName)
public String formatPath(List<String> pathName, String name)
public String formatString(String string)
public String formatType(Object object)
public AbstractParser getAbstractParser()
public int getCharOffset()
public BasicEnvironment getEnvironment()
public FormattingHelper getFormatter()
public AbstractLexer getLexer()
@Deprecated public AbstractParser getParser()
getAbstractParser()
method,
instead.
public boolean getTraceFlag()
protected void initPropertyPositions(CallingASTNode callingASTNode, CSTNode cstNode)
callingASTNode
- a calling AST nodecstNode
- a CST nodeprotected void initStartEndPositions(ASTNode astNode, CSTNode cstNode)
astNode
- an AST nodecstNode
- a CST nodeprotected void initTypePositions(TypedASTNode typedASTNode, CSTNode cstNode)
typedASTNode
- a typed AST nodecstNode
- a CST nodeprotected String makeName(EList<String> namelist)
namelist
- list of names to make string out of
protected String makeString(EList<String> namelist)
namelist
- list of names to make string out of
public void setCharacterOffset(int offset)
offset
- public void setFileName(String filename)
public void initialize(char[] buffer)
buffer
- the characterspublic void initialize(Reader reader) throws IOException
reader
- providing the source text
IOException
- if reading failspublic void setTab(int tab)
public void setTraceFlag(boolean flag)
public void ERROR(String problemMessage)
public void ERROR(Object problemObject, String rule, String problemMessage)
public void ERROR(List<?> problemObjects, String rule, String problemMessage)
protected void TRACE(String rule, String message)
protected void TRACE(String rule, String message, EList<String> namelist)
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |