You can now return a constant string

Rather than having to store it as a variable
This commit is contained in:
Johan B.W. de Vries 2025-02-09 15:03:11 +01:00
parent 5fa042c5cd
commit a184d4c5e3
4 changed files with 33 additions and 3 deletions

View File

@ -162,6 +162,9 @@ def parsestatreturn(indent):
emit('return ') emit('return ')
if ' ' == peek(): if ' ' == peek():
skip() skip()
if quote == peek():
parseconststring()
else:
parseexprvarref() parseexprvarref()
emit(eol) emit(eol)
skipchar(eol) skipchar(eol)

View File

@ -151,8 +151,16 @@ parsestatreturn indent:
calc isspace eq char " " calc isspace eq char " "
if isspace if isspace
skip skip
calc char peek
calc isquote eq char quote
calc isnotquote not isquote
if isquote
parseconststring
/
if isnotquote
parseexprvarref parseexprvarref
/ /
/
emit eol emit eol
skipchar eol skipchar eol
/ /

View File

@ -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,8 +205,16 @@ parsestatreturn indent:
calc isnotspace not isspace calc isnotspace not isspace
if isspace if isspace
skip skip
calc char peek
calc isquote eq char quote
calc isnotquote not isquote
if isquote
parseconststring
/
if isnotquote
parseexprvarref parseexprvarref
/ /
/
if isnotspace if isnotspace
emit "0" emit "0"
/ /

View File

@ -0,0 +1,9 @@
func:
return "Success"
/
main:
declare result
calc result func
emit result
/