|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lpg.lpgjavaruntime.PrsStream org.eclipse.ocl.lpg.AbstractParser
public abstract class AbstractParser
The AbstractParser
supports syntactic analysis of a tokens produced by
an AbstractLexer
to create a corresponding CST, that may in turn be
exploited by an AbstractAnalyzer
to create an AST.
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.
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 | |
---|---|
AbstractParser(AbstractLexer lexer)
|
|
AbstractParser(BasicEnvironment environment)
|
Method Summary | |
---|---|
String |
computeInputString(int left,
int right)
Returns a single line string representation of the input chars for the given range. |
BasicEnvironment |
getEnvironment()
|
AbstractLexer |
getLexer()
|
CSTNode |
parseTokensToCST()
|
abstract CSTNode |
parseTokensToCST(lpg.lpgjavaruntime.Monitor monitor,
int error_repair_count)
|
void |
reportError(int errorCode,
String locationInfo,
int leftToken,
int rightToken,
String tokenText)
|
void |
resetLexStream(lpg.lpgjavaruntime.LexStream lexStream)
|
void |
setLexStream(AbstractLexer lexStream)
|
protected void |
setOffsets(CSTNode cstNode,
CSTNode startEnd)
Sets the start and end offsets of the given CSTNode
to the start and end offsets of the 2nd given CSTNode |
protected void |
setOffsets(CSTNode cstNode,
CSTNode start,
CSTNode end)
Sets the start and end offsets of the given CSTNode
to the start offset of the 2nd given CSTNode and the
end offset of the 3rd given CSTNode |
protected void |
setOffsets(CSTNode cstNode,
CSTNode start,
lpg.lpgjavaruntime.IToken end)
Sets the start and end offsets of the given CSTNode
to the start offset of the 2nd given CSTNode and the
end offset of the given IToken |
protected void |
setOffsets(CSTNode cstNode,
lpg.lpgjavaruntime.IToken startEnd)
Sets the start and end offsets of the given CSTNode
to the start and end offsets of the given IToken |
protected void |
setOffsets(CSTNode cstNode,
lpg.lpgjavaruntime.IToken start,
CSTNode end)
Sets the start and end offsets of the given CSTNode
to the start offset of the given IToken and the
end offset of the 2nd given CSTNode |
protected void |
setOffsets(CSTNode cstNode,
lpg.lpgjavaruntime.IToken start,
lpg.lpgjavaruntime.IToken end)
Sets the start and end offsets of the given CSTNode
to the start offset of the 1std given IToken and the
end offset of the 2nd given IToken |
protected String |
unquote(String quoted)
Removes the "s surrounding a quoted string, if any. |
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, getTokenIndexAtCharacter, getTokenLength, getTokens, getTokenText, makeAdjunct, makeErrorToken, 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 |
---|
public AbstractParser(BasicEnvironment environment)
public AbstractParser(AbstractLexer lexer)
Method Detail |
---|
public String computeInputString(int left, int right)
left
- left most char indexright
- right most char index
public BasicEnvironment getEnvironment()
public AbstractLexer getLexer()
public CSTNode parseTokensToCST()
public abstract CSTNode parseTokensToCST(lpg.lpgjavaruntime.Monitor monitor, int error_repair_count)
public void reportError(int errorCode, String locationInfo, int leftToken, int rightToken, String tokenText)
reportError
in interface lpg.lpgjavaruntime.TokenStream
reportError
in class lpg.lpgjavaruntime.PrsStream
public void resetLexStream(lpg.lpgjavaruntime.LexStream lexStream)
resetLexStream
in class lpg.lpgjavaruntime.PrsStream
public void setLexStream(AbstractLexer lexStream)
protected void setOffsets(CSTNode cstNode, lpg.lpgjavaruntime.IToken startEnd)
CSTNode
to the start and end offsets of the given IToken
cstNode
- CSTNode
to set offsetsstartEnd
- IToken
to retrieve offsets fromprotected void setOffsets(CSTNode cstNode, CSTNode startEnd)
CSTNode
to the start and end offsets of the 2nd given CSTNode
cstNode
- CSTNode
to set offsetsstartEnd
- CSTNode
to retrieve offsets fromprotected void setOffsets(CSTNode cstNode, CSTNode start, CSTNode end)
CSTNode
to the start offset of the 2nd given CSTNode
and the
end offset of the 3rd given CSTNode
cstNode
- CSTNode
to set offsetsstart
- CSTNode
to retrieve start offset fromend
- CSTNode
to retrieve end offset fromprotected void setOffsets(CSTNode cstNode, CSTNode start, lpg.lpgjavaruntime.IToken end)
CSTNode
to the start offset of the 2nd given CSTNode
and the
end offset of the given IToken
cstNode
- CSTNode
to set offsetsstart
- CSTNode
to retrieve start offset fromend
- IToken
to retrieve end offset fromprotected void setOffsets(CSTNode cstNode, lpg.lpgjavaruntime.IToken start, CSTNode end)
CSTNode
to the start offset of the given IToken
and the
end offset of the 2nd given CSTNode
cstNode
- CSTNode
to set offsetsstart
- IToken
to retrieve start offset fromend
- CSTNode
to retrieve end offset fromprotected void setOffsets(CSTNode cstNode, lpg.lpgjavaruntime.IToken start, lpg.lpgjavaruntime.IToken end)
CSTNode
to the start offset of the 1std given IToken
and the
end offset of the 2nd given IToken
cstNode
- CSTNode
to set offsetsstart
- IToken
to retrieve start offset fromend
- IToken
to retrieve end offset fromprotected String unquote(String quoted)
quoted
- a possibly quoted string
quoted
without the surrounding quotes, or just
quoted
verbatim if there were none
|
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 |