aboutsummaryrefslogtreecommitdiff
path: root/src/lj_cparse.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_cparse.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_cparse.c b/src/lj_cparse.c
index b8c95bd3..484a2c15 100644
--- a/src/lj_cparse.c
+++ b/src/lj_cparse.c
@@ -17,6 +17,7 @@
17#include "lj_vm.h" 17#include "lj_vm.h"
18#include "lj_char.h" 18#include "lj_char.h"
19#include "lj_strscan.h" 19#include "lj_strscan.h"
20#include "lj_strfmt.h"
20 21
21/* 22/*
22** Important note: this is NOT a validating C parser! This is a minimal 23** Important note: this is NOT a validating C parser! This is a minimal
@@ -47,9 +48,9 @@ static const char *cp_tok2str(CPState *cp, CPToken tok)
47 if (tok > CTOK_OFS) 48 if (tok > CTOK_OFS)
48 return ctoknames[tok-CTOK_OFS-1]; 49 return ctoknames[tok-CTOK_OFS-1];
49 else if (!lj_char_iscntrl(tok)) 50 else if (!lj_char_iscntrl(tok))
50 return lj_str_pushf(cp->L, "%c", tok); 51 return lj_strfmt_pushf(cp->L, "%c", tok);
51 else 52 else
52 return lj_str_pushf(cp->L, "char(%d)", tok); 53 return lj_strfmt_pushf(cp->L, "char(%d)", tok);
53} 54}
54 55
55/* End-of-line? */ 56/* End-of-line? */
@@ -117,12 +118,12 @@ LJ_NORET static void cp_errmsg(CPState *cp, CPToken tok, ErrMsg em, ...)
117 } 118 }
118 L = cp->L; 119 L = cp->L;
119 va_start(argp, em); 120 va_start(argp, em);
120 msg = lj_str_pushvf(L, err2msg(em), argp); 121 msg = lj_strfmt_pushvf(L, err2msg(em), argp);
121 va_end(argp); 122 va_end(argp);
122 if (tokstr) 123 if (tokstr)
123 msg = lj_str_pushf(L, err2msg(LJ_ERR_XNEAR), msg, tokstr); 124 msg = lj_strfmt_pushf(L, err2msg(LJ_ERR_XNEAR), msg, tokstr);
124 if (cp->linenumber > 1) 125 if (cp->linenumber > 1)
125 msg = lj_str_pushf(L, "%s at line %d", msg, cp->linenumber); 126 msg = lj_strfmt_pushf(L, "%s at line %d", msg, cp->linenumber);
126 lj_err_callermsg(L, msg); 127 lj_err_callermsg(L, msg);
127} 128}
128 129
@@ -998,7 +999,7 @@ static void cp_decl_asm(CPState *cp, CPDecl *decl)
998 if (cp->tok == CTOK_STRING) { 999 if (cp->tok == CTOK_STRING) {
999 GCstr *str = cp->str; 1000 GCstr *str = cp->str;
1000 while (cp_next(cp) == CTOK_STRING) { 1001 while (cp_next(cp) == CTOK_STRING) {
1001 lj_str_pushf(cp->L, "%s%s", strdata(str), strdata(cp->str)); 1002 lj_strfmt_pushf(cp->L, "%s%s", strdata(str), strdata(cp->str));
1002 cp->L->top--; 1003 cp->L->top--;
1003 str = strV(cp->L->top); 1004 str = strV(cp->L->top);
1004 } 1005 }