[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » General category » General forum » string expression with recursive descent (str variable recursive descent)
string expression with recursive descent
ZlatkoDate: Monday, 2020-05-11, 1:31 PM | Message # 1
Lieutenant
Group: Administrators
Messages: 62
Reputation: 0
Status: Offline
' execute string expression---------------------------------------------
Sub exec_strExpr() as string
gettok()'start
string res 
res = strExpr()
MsgBox "STR_RESULT=" + res , "EXEC_STR_EXPR:"
TextOn (win,30,60, res)
Return res
End sub

'----------------------------------------------------------------------
Sub strExpr() as string
string vs

if token <> "+"
vs = strFactor()
end if

while token = "+"
if token = "+": gettok() : vs = vs + strFactor(): end if
wend

return vs
End Sub

'---------------------------------------------------------------------
Sub strFactor() as string
string vs : int vID, vTyp

if tkTyp = tkIDENT
print "IDENT-STR:" + token
vID = varList  [tc]: vTyp = varType [vID]: print "token->"+ token +" var_ID:" + str(vID) + "_varType: " + str(vTyp)
IF vTyp = tkSTRING : vs = varStr [vID]: end if
 gettok()
end if

if tkTyp = tkQSTRING
print "STR-FACTOR:" + token
vs = token :  gettok()
end if

return vs
End Sub
 
Forum » General category » General forum » string expression with recursive descent (str variable recursive descent)
  • Page 1 of 1
  • 1
Search: