Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=MaxNameLength), | intent(in) | :: | lineOfCompute | |||
integer, | intent(in) | :: | fromTariff |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE parseComputeLine(lineOfCompute,fromTariff)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer of GARD Analytics, Inc.
! DATE WRITTEN June 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Converts a single line in the ECONOMICS:COMPUTE
! command into tokens for computation
! METHODOLOGY EMPLOYED:
! Scan the line from the end of the line to the front of the
! line and search for operators and variables. All items
! are put into the step array.
! REFERENCES:
! na
! USE STATEMENTS:
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=MaxNameLength), INTENT(IN) :: lineOfCompute
INTEGER, INTENT(IN) :: fromTariff
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=MaxNameLength) :: word
INTEGER :: endOfWord
INTEGER :: token
endOfWord = LEN_TRIM(lineOfCompute)
DO WHILE (endOfWord .GT. 0)
! get a single word (text string delimited by spaces)
CALL GetLastWord(lineOfCompute,endOfWord,word)
! first see if word is an operator
token = lookupOperator(word)
! if not an operator then look for
IF (token .EQ. 0) THEN
! see if argument or assignment (assignment will be first string on line)
IF (endOfWord .GT. 0) THEN
token = AssignVariablePt(word,.TRUE.,varIsArgument,varNotYetDefined,kindUnknown,0,fromTariff)
ELSE
token = AssignVariablePt(word,.TRUE.,varIsAssigned,varNotYetDefined,kindAssignCompute,0,fromTariff)
ENDIF
END IF
! if a token is found then put it into step array
IF (token .EQ. 0) THEN
CALL ShowWarningError('In UtilityCost:Computation line: ' // TRIM(lineOfCompute))
CALL ShowContinueError(' Do not recognize: ' // TRIM(word) // ' Will skip.')
ELSE
CALL incrementSteps
steps(numSteps) = token
END IF
END DO
CALL incrementSteps
steps(numSteps) = 0 !at the end of the line show a zero to clear the stack
END SUBROUTINE parseComputeLine