public abstract class AbstractAnalyzer extends Object
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.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAnalyzer(AbstractParser parser) |
| Modifier and Type | Method and Description |
|---|---|
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)
Deprecated.
clients should invoke
reset(char[], String) |
void |
initialize(Reader reader)
Deprecated.
clients should invoke
reset(Reader, String) |
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(<any> namelist)
Creates a string by joining the given string list elements with ::.
|
protected String |
makeString(<any> namelist)
Creates a string by joining the given string list elements with spaces.
|
void |
reset(char[] buffer,
String fileName)
Define the input text as a given array of characters.
|
void |
reset(Reader reader,
String fileName)
Define the input text by reading from a reader.
|
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,
<any> namelist) |
protected AbstractAnalyzer(AbstractParser parser)
public String computeInputString(CSTNode node)
node was
parsed.node - a concrete syntax nodepublic void dumpTokens()
public String formatEClassName(EObject 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(<any> namelist)
namelist - list of names to make string out ofprotected String makeString(<any> namelist)
namelist - list of names to make string out ofpublic void setCharacterOffset(int offset)
offset - public void setFileName(String filename)
@Deprecated public void initialize(char[] buffer)
reset(char[], String)buffer - the characters@Deprecated public void initialize(Reader reader) throws IOException
reset(Reader, String)reader - providing the source textIOException - if reading failspublic void reset(char[] buffer,
String fileName)
buffer - the charactersfileName - the associated finleName of the input, or null if none.public void reset(Reader reader, String fileName) throws IOException
reader - providing the source textfileName - the associated finleName of the input, or null if none.IOException - if reading failspublic void setTab(int tab)
public void setTraceFlag(boolean flag)
public void ERROR(String problemMessage)
Copyright © 2015 Open eHealth Foundation. All rights reserved.