Package com.uppaal.engine
Class Parser
java.lang.Object
com.uppaal.engine.LexicalAnalyser
com.uppaal.engine.Parser
public class Parser extends LexicalAnalyser
Simple recursive decent parser for the communication protocol. Used by the
EngineStub.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Parser(InputStream in)
Constructor -
Method Summary
Modifier and Type Method Description String
getErrorContext(String errorLocation, int errorStartLine, int errorEndLine)
Get the location string from the declaration text where the error happenedvoid
parseAcknowledgement()
Parses the prolog and the end of the charactersBigDecimal
parseBigDecimal()
Parse the float of the next tokenString
parseBlock()
Read the context of the blockConcreteState
parseConcreteInitial(UppaalSystem system)
Parses the concrete initial state in the systemConcreteState
parseConcreteState(UppaalSystem system)
Create the concrete state in the system: - Get the list of locations in the system - Get the list of variables of the system - Get the invariant value <l-len> <location>* <v-len> ( <value> <rate> )* <limit> <strict>ConcreteSuccessor
parseConcreteSuccessor(UppaalSystem system)
To create the concrete successor: - parses the concrete state - get the list of the concrete transitionSystemEdge[]
parseEdges(UppaalSystem system)
Get the list of the system edgesSystemEdgeSelect[]
parseEdgesWS(UppaalSystem system)
Parses the selected edge of the system.ArrayList<ConcreteTransition>
parseEnabledConcreteTransitions(UppaalSystem system)
Parses the limit of the concrete transition and collect the enabled concrete transition into the listArrayList<SymbolicTransition>
parseEnabledTransitions(UppaalSystem system)
Parses the transitions that are transit enabledvoid
parseEnd()
Parses the end of the characters.GanttChart
parseGanttChart(UppaalSystem system, BigDecimal globalTime)
Parses a Gantt chart.void
parseGanttHeader(UppaalSystem system)
Parses the header of the ganttchardString
parseId()
Parses and gets the string.int
parseInteger()
Parses and get the integer valueLimit
parseLimit()
Parses the limit : limit consists of a value and information about whether the limit is strict or not.long
parseLong()
Parses the response string in 'long'LscProcess
parseLscProcess(Document document)
Parse LSC processvoid
parsePartialEnd()
Parses the partial end of the charactersArrayList<Problem>
parseProblems()
Parses problems in the systemvoid
parseProblems(ArrayList<Problem> problems)
Parses problems in the systemvoid
parseProlog()
Parses the prologchar
parseQueryResult()
Parses query and get the query resultSymbolicState
parseSymbolicInitial(UppaalSystem system)
Parses the symbolic initial state in the systemSymbolicState
parseSymbolicState(UppaalSystem system)
Parses the symbolic state in the systemUppaalSystem
parseSystem(Document document)
Parses the uppaal system: - get the list of variables - get the list of clocks - add the processes into the system - add Gantt Chart parsingSymbolicTrace
parseXTRTrace(UppaalSystem system)
Parses the TraceProblem
problem()
Create the problemboolean
skipProblems()
To skip problemsMethods inherited from class com.uppaal.engine.LexicalAnalyser
getException, getFloat, getIntValue, getLookahead, getValue, getWord, nextToken, read, readBlock
-
Constructor Details
-
Parser
Constructor- Parameters:
in
- - The input stream
-
-
Method Details
-
parseProlog
Parses the prolog- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseId
Parses and gets the string.- Returns:
- The response string
- Throws:
ProtocolException
- broken engine communication protocolIOException
- engine crash or problem in communication.
-
parseInteger
Parses and get the integer value- Returns:
- The integer value of characters
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.ServerException
- engine returned an error
-
parseLong
Parses the response string in 'long'- Returns:
- The value in 'long' of the string
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.ServerException
- engine returned an error
-
parseBigDecimal
Parse the float of the next token- Returns:
- The float value
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.
-
parseLimit
Parses the limit : limit consists of a value and information about whether the limit is strict or not.- Returns:
- The limit object
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.ServerException
- engine returned an error
-
parseEnd
Parses the end of the characters.- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.
-
parsePartialEnd
Parses the partial end of the characters- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.
-
parseSymbolicState
public SymbolicState parseSymbolicState(UppaalSystem system) throws ProtocolException, IOException, ServerExceptionParses the symbolic state in the system- Parameters:
system
- - The uppaal system- Returns:
- The new symbolic state in the system
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.ServerException
- engine returned an error
-
parseEdges
public SystemEdge[] parseEdges(UppaalSystem system) throws ProtocolException, IOException, ServerExceptionGet the list of the system edges- Parameters:
system
- - The uppaal system- Returns:
- l - The list of the edges
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.ServerException
- engine returned an error
-
parseEnabledTransitions
public ArrayList<SymbolicTransition> parseEnabledTransitions(UppaalSystem system) throws EngineException, IOException, CannotEvaluateExceptionParses the transitions that are transit enabled- Parameters:
system
- - The uppaal system- Returns:
- succs - The list of symbolic transitions
- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.EngineException
- engine returned an errorCannotEvaluateException
- an expression could not be evaluated
-
getErrorContext
Get the location string from the declaration text where the error happened- Parameters:
errorLocation
- - The all error location texterrorStartLine
- - The start line number where the error string starts fromerrorEndLine
- - The end line number where the error string ends to- Returns:
- location - The error location
-
parseAcknowledgement
Parses the prolog and the end of the characters- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseBlock
Read the context of the block- Returns:
- The string
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseGanttHeader
public void parseGanttHeader(UppaalSystem system) throws ProtocolException, EngineException, IOExceptionParses the header of the ganttchard- Parameters:
system
- - The uppaal system- Throws:
ProtocolException
- broken engine communication protocol.IOException
- engine crash or problem in communication.EngineException
- engine returned an error
-
parseSymbolicInitial
public SymbolicState parseSymbolicInitial(UppaalSystem system) throws EngineException, IOException, CannotEvaluateExceptionParses the symbolic initial state in the system- Parameters:
system
- - The uppaal system- Returns:
- state - The symbolic state
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.CannotEvaluateException
- in the Uppaal engine.
-
parseConcreteInitial
public ConcreteState parseConcreteInitial(UppaalSystem system) throws EngineException, IOException, ServerException, CannotEvaluateExceptionParses the concrete initial state in the system- Parameters:
system
- - The uppaal system- Returns:
- state - The concrete state
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.ServerException
- engine returned an error.CannotEvaluateException
- in the uppaal engine
-
parseSystem
Parses the uppaal system: - get the list of variables - get the list of clocks - add the processes into the system - add Gantt Chart parsing- Parameters:
document
- - The document- Returns:
- system - The uppaal system
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseLscProcess
Parse LSC process- Parameters:
document
- - The model document- Returns:
- null
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseProblems
Parses problems in the system- Returns:
- The list of the problems
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseProblems
Parses problems in the system- Parameters:
problems
- - Problems of the system- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
skipProblems
To skip problems- Returns:
- True - Do it
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
problem
Create the problem- Returns:
- The new problem
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseQueryResult
Parses query and get the query result- Returns:
- The query ID
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.
-
parseXTRTrace
Parses the Trace- Parameters:
system
- - The uppaal system- Returns:
- trace - The list of the symbolic transition.
- Throws:
IOException
- engine crash or problem in communication.ProtocolException
- broken engine communication protocol.
-
parseConcreteState
public ConcreteState parseConcreteState(UppaalSystem system) throws IOException, ProtocolException, ServerExceptionCreate the concrete state in the system: - Get the list of locations in the system - Get the list of variables of the system - Get the invariant value <l-len> <location>* <v-len> ( <value> <rate> )* <limit> <strict>- Parameters:
system
- - The uppaal system- Returns:
- The concrete state in the system
- Throws:
IOException
- engine crash or problem in communication.ProtocolException
- broken engine communication protocol.ServerException
- engine returned an error.
-
parseEdgesWS
public SystemEdgeSelect[] parseEdgesWS(UppaalSystem system) throws ProtocolException, IOException, ServerExceptionParses the selected edge of the system.- Parameters:
system
- - The uppaal system- Returns:
- listEdge - The list of the selected edges
- Throws:
IOException
- engine crash or problem in communication.ProtocolException
- broken engine communication protocol.ServerException
- engine returned an error.
-
parseEnabledConcreteTransitions
public ArrayList<ConcreteTransition> parseEnabledConcreteTransitions(UppaalSystem system) throws EngineException, IOException, CannotEvaluateExceptionParses the limit of the concrete transition and collect the enabled concrete transition into the list- Parameters:
system
- - The uppaal system- Returns:
- succs - The enabled transition
- Throws:
IOException
- I/O communication error.EngineException
- error in the server protocol.CannotEvaluateException
- some expression could not be evaluated.
-
parseConcreteSuccessor
public ConcreteSuccessor parseConcreteSuccessor(UppaalSystem system) throws IOException, EngineException, ServerException, CannotEvaluateExceptionTo create the concrete successor: - parses the concrete state - get the list of the concrete transition- Parameters:
system
- - The uppaal system- Returns:
- The concrete successor
- Throws:
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.ServerException
- engine returned an error.CannotEvaluateException
- some expression could not be evaluated.
-
parseGanttChart
public GanttChart parseGanttChart(UppaalSystem system, BigDecimal globalTime) throws ProtocolException, ServerException, IOExceptionParses a Gantt chart. <num> (<identifier> <value> <value> <strict> <value> <strict>)* <num> a positive integer: Number of messages in the following <identifier> the row number/id <value> the value of the bar to be displayed. This number can be positive, 0 or negative. <value> a positive number: interval start time <strict> start of interval open or closed? <value> a positive number: interval stop time <strict> end of interval open or closed?- Parameters:
system
- - The uppaal systemglobalTime
- - The global time- Returns:
- The ganttChart
- Throws:
IOException
- engine crash or problem in communication.ProtocolException
- broken engine communication protocol.ServerException
- engine returned an error.
-