summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eshtrans/backend/codegen.esh41
1 files changed, 30 insertions, 11 deletions
diff --git a/eshtrans/backend/codegen.esh b/eshtrans/backend/codegen.esh
index 9e95956..ddd466b 100644
--- a/eshtrans/backend/codegen.esh
+++ b/eshtrans/backend/codegen.esh
@@ -23,6 +23,7 @@ sbufc=
sc=
tu_id=
static_fn_n=
+pragma_nostack=false
sgetc()
{
@@ -50,12 +51,14 @@ codegen_sub()
shift 1
local print_spc=
local ionum=
+ local pragma=
local fname=
local static=
local static_fname=
print_spc=false
ionum=false
+ pragma=false
fname=''
static=false
static_fname=false
@@ -83,19 +86,25 @@ codegen_sub()
ionum=false
fi
- # Function names
- case "${t%${US}*}" in T_FNAME)
- fname="${t}"
- ;;
- esac
-
- # State machine for static variables and functions
case "${t%${US}*}" in
+ T_USE)
+ pragma=true
+ continue
+ ;;
+ T_FNAME)
+ fname="${t}"
+ ;;
T_STATIC)
static=true
continue
;;
esac
+ if ${pragma}; then
+ pragma=false
+ eval "pragma_${t#*${US}}=true"
+ continue
+ fi
+ # State machine for static variables and functions
if ${static}; then
static=false
case "${t%${US}*}" in
@@ -125,14 +134,24 @@ codegen_sub()
# Function start/end tokens
case "${t%${US}*}" in
T_FN_START)
- printf '__fn_start %s %s;' \
- "${tu_id}" "${fname#*${US}}"
+ if ! ${pragma_nostack}; then
+ printf '__fn_start %s %s;' \
+ "${tu_id}" "${fname#*${US}}"
+ else
+ printf ':;'
+ fi
;;
T_FN_END)
- printf '__fn_end;'
+ if ! ${pragma_nostack}; then
+ printf '__fn_end;'
+ else
+ printf ':;'
+ fi
;;
T_RETURN)
- printf '__fn_end; '
+ if ! ${pragma_nostack}; then
+ printf '__fn_end; '
+ fi
;;
esac