You can now return a constant string
Rather than having to store it as a variable
This commit is contained in:
parent
5fa042c5cd
commit
a184d4c5e3
@ -162,7 +162,10 @@ def parsestatreturn(indent):
|
|||||||
emit('return ')
|
emit('return ')
|
||||||
if ' ' == peek():
|
if ' ' == peek():
|
||||||
skip()
|
skip()
|
||||||
parseexprvarref()
|
if quote == peek():
|
||||||
|
parseconststring()
|
||||||
|
else:
|
||||||
|
parseexprvarref()
|
||||||
emit(eol)
|
emit(eol)
|
||||||
skipchar(eol)
|
skipchar(eol)
|
||||||
|
|
||||||
|
|||||||
@ -151,7 +151,15 @@ parsestatreturn indent:
|
|||||||
calc isspace eq char " "
|
calc isspace eq char " "
|
||||||
if isspace
|
if isspace
|
||||||
skip
|
skip
|
||||||
parseexprvarref
|
calc char peek
|
||||||
|
calc isquote eq char quote
|
||||||
|
calc isnotquote not isquote
|
||||||
|
if isquote
|
||||||
|
parseconststring
|
||||||
|
/
|
||||||
|
if isnotquote
|
||||||
|
parseexprvarref
|
||||||
|
/
|
||||||
/
|
/
|
||||||
emit eol
|
emit eol
|
||||||
skipchar eol
|
skipchar eol
|
||||||
|
|||||||
@ -195,6 +195,8 @@ parsestatbreak indent:
|
|||||||
parsestatreturn indent:
|
parsestatreturn indent:
|
||||||
declare char
|
declare char
|
||||||
declare isspace
|
declare isspace
|
||||||
|
declare isnotquote
|
||||||
|
declare isquote
|
||||||
declare isnotspace
|
declare isnotspace
|
||||||
emit indent
|
emit indent
|
||||||
emit "return "
|
emit "return "
|
||||||
@ -203,7 +205,15 @@ parsestatreturn indent:
|
|||||||
calc isnotspace not isspace
|
calc isnotspace not isspace
|
||||||
if isspace
|
if isspace
|
||||||
skip
|
skip
|
||||||
parseexprvarref
|
calc char peek
|
||||||
|
calc isquote eq char quote
|
||||||
|
calc isnotquote not isquote
|
||||||
|
if isquote
|
||||||
|
parseconststring
|
||||||
|
/
|
||||||
|
if isnotquote
|
||||||
|
parseexprvarref
|
||||||
|
/
|
||||||
/
|
/
|
||||||
if isnotspace
|
if isnotspace
|
||||||
emit "0"
|
emit "0"
|
||||||
|
|||||||
9
tests/flowreturnvalueconstant.lang0
Normal file
9
tests/flowreturnvalueconstant.lang0
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
func:
|
||||||
|
return "Success"
|
||||||
|
/
|
||||||
|
|
||||||
|
main:
|
||||||
|
declare result
|
||||||
|
calc result func
|
||||||
|
emit result
|
||||||
|
/
|
||||||
Loading…
x
Reference in New Issue
Block a user