diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-25 21:44:10 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-25 21:44:10 +0100 |
commit | 0b0e8d0509bdd45aa600d3ea2bf9043630809cd2 (patch) | |
tree | ddf18f4181e26cbf6973024b0c108fab89bba31a | |
parent | 3f8752c33f29d4cb4cc18fbff1f0da555f04c3ce (diff) | |
download | busybox-w32-0b0e8d0509bdd45aa600d3ea2bf9043630809cd2.tar.gz busybox-w32-0b0e8d0509bdd45aa600d3ea2bf9043630809cd2.tar.bz2 busybox-w32-0b0e8d0509bdd45aa600d3ea2bf9043630809cd2.zip |
bc: rename some members and macros, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 8fa312a2b..7a6278cfc 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -518,31 +518,31 @@ typedef enum BcLexType { | |||
518 | struct BcLexKeyword { | 518 | struct BcLexKeyword { |
519 | char name8[8]; | 519 | char name8[8]; |
520 | }; | 520 | }; |
521 | #define BC_LEX_KW_ENTRY(a, b) \ | 521 | #define LEX_KW_ENTRY(a, b) \ |
522 | { .name8 = a /*, .posix = b */ } | 522 | { .name8 = a /*, .posix = b */ } |
523 | static const struct BcLexKeyword bc_lex_kws[20] = { | 523 | static const struct BcLexKeyword bc_lex_kws[20] = { |
524 | BC_LEX_KW_ENTRY("auto" , 1), // 0 | 524 | LEX_KW_ENTRY("auto" , 1), // 0 |
525 | BC_LEX_KW_ENTRY("break" , 1), // 1 | 525 | LEX_KW_ENTRY("break" , 1), // 1 |
526 | BC_LEX_KW_ENTRY("continue", 0), // 2 note: this one has no terminating NUL | 526 | LEX_KW_ENTRY("continue", 0), // 2 note: this one has no terminating NUL |
527 | BC_LEX_KW_ENTRY("define" , 1), // 3 | 527 | LEX_KW_ENTRY("define" , 1), // 3 |
528 | BC_LEX_KW_ENTRY("else" , 0), // 4 | 528 | LEX_KW_ENTRY("else" , 0), // 4 |
529 | BC_LEX_KW_ENTRY("for" , 1), // 5 | 529 | LEX_KW_ENTRY("for" , 1), // 5 |
530 | BC_LEX_KW_ENTRY("halt" , 0), // 6 | 530 | LEX_KW_ENTRY("halt" , 0), // 6 |
531 | BC_LEX_KW_ENTRY("ibase" , 1), // 7 | 531 | LEX_KW_ENTRY("ibase" , 1), // 7 |
532 | BC_LEX_KW_ENTRY("obase" , 1), // 8 | 532 | LEX_KW_ENTRY("obase" , 1), // 8 |
533 | BC_LEX_KW_ENTRY("if" , 1), // 9 | 533 | LEX_KW_ENTRY("if" , 1), // 9 |
534 | BC_LEX_KW_ENTRY("last" , 0), // 10 | 534 | LEX_KW_ENTRY("last" , 0), // 10 |
535 | BC_LEX_KW_ENTRY("length" , 1), // 11 | 535 | LEX_KW_ENTRY("length" , 1), // 11 |
536 | BC_LEX_KW_ENTRY("limits" , 0), // 12 | 536 | LEX_KW_ENTRY("limits" , 0), // 12 |
537 | BC_LEX_KW_ENTRY("print" , 0), // 13 | 537 | LEX_KW_ENTRY("print" , 0), // 13 |
538 | BC_LEX_KW_ENTRY("quit" , 1), // 14 | 538 | LEX_KW_ENTRY("quit" , 1), // 14 |
539 | BC_LEX_KW_ENTRY("read" , 0), // 15 | 539 | LEX_KW_ENTRY("read" , 0), // 15 |
540 | BC_LEX_KW_ENTRY("return" , 1), // 16 | 540 | LEX_KW_ENTRY("return" , 1), // 16 |
541 | BC_LEX_KW_ENTRY("scale" , 1), // 17 | 541 | LEX_KW_ENTRY("scale" , 1), // 17 |
542 | BC_LEX_KW_ENTRY("sqrt" , 1), // 18 | 542 | LEX_KW_ENTRY("sqrt" , 1), // 18 |
543 | BC_LEX_KW_ENTRY("while" , 1), // 19 | 543 | LEX_KW_ENTRY("while" , 1), // 19 |
544 | }; | 544 | }; |
545 | #undef BC_LEX_KW_ENTRY | 545 | #undef LEX_KW_ENTRY |
546 | #define STRING_else (bc_lex_kws[4].name8) | 546 | #define STRING_else (bc_lex_kws[4].name8) |
547 | #define STRING_for (bc_lex_kws[5].name8) | 547 | #define STRING_for (bc_lex_kws[5].name8) |
548 | #define STRING_if (bc_lex_kws[9].name8) | 548 | #define STRING_if (bc_lex_kws[9].name8) |
@@ -570,7 +570,7 @@ enum { | |||
570 | | (1 << 18) // 18 | 570 | | (1 << 18) // 18 |
571 | | (1 << 19) // 19 | 571 | | (1 << 19) // 19 |
572 | }; | 572 | }; |
573 | #define bc_lex_kws_POSIX(i) ((1 << (i)) & POSIX_KWORD_MASK) | 573 | #define keyword_is_POSIX(i) ((1 << (i)) & POSIX_KWORD_MASK) |
574 | 574 | ||
575 | // This is a bit array that corresponds to token types. An entry is | 575 | // This is a bit array that corresponds to token types. An entry is |
576 | // true if the token is valid in an expression, false otherwise. | 576 | // true if the token is valid in an expression, false otherwise. |
@@ -711,15 +711,15 @@ dc_LEX_to_INST[] = { // starts at XC_LEX_OP_POWER // corresponding XC/DC_L | |||
711 | #endif // ENABLE_DC | 711 | #endif // ENABLE_DC |
712 | 712 | ||
713 | typedef struct BcLex { | 713 | typedef struct BcLex { |
714 | const char *buf; | 714 | const char *lex_inbuf; |
715 | const char *lex_next_at; // last lex_next() was called at this string | 715 | const char *lex_next_at; // last lex_next() was called at this string |
716 | size_t i; | 716 | size_t lex_i; |
717 | size_t line; | 717 | size_t lex_line; |
718 | size_t len; | 718 | size_t lex_len; |
719 | bool newline; | 719 | bool lex_newline; |
720 | smallint lex; // was BcLexType | 720 | smallint lex; // was BcLexType |
721 | smallint lex_last; // was BcLexType | 721 | smallint lex_last; // was BcLexType |
722 | BcVec lex_buf; | 722 | BcVec lex_strnumbuf; |
723 | } BcLex; | 723 | } BcLex; |
724 | 724 | ||
725 | #define BC_PARSE_STREND (0xff) | 725 | #define BC_PARSE_STREND (0xff) |
@@ -2755,10 +2755,10 @@ static void bc_lex_lineComment(void) | |||
2755 | // Try: echo -n '#foo' | bc | 2755 | // Try: echo -n '#foo' | bc |
2756 | size_t i; | 2756 | size_t i; |
2757 | l->lex = XC_LEX_WHITESPACE; | 2757 | l->lex = XC_LEX_WHITESPACE; |
2758 | i = l->i; | 2758 | i = l->lex_i; |
2759 | while (i < l->len && l->buf[i] != '\n') | 2759 | while (i < l->lex_len && l->lex_inbuf[i] != '\n') |
2760 | i++; | 2760 | i++; |
2761 | l->i = i; | 2761 | l->lex_i = i; |
2762 | } | 2762 | } |
2763 | 2763 | ||
2764 | static void bc_lex_whitespace(void) | 2764 | static void bc_lex_whitespace(void) |
@@ -2766,19 +2766,19 @@ static void bc_lex_whitespace(void) | |||
2766 | BcLex *l = &G.prs.l; | 2766 | BcLex *l = &G.prs.l; |
2767 | l->lex = XC_LEX_WHITESPACE; | 2767 | l->lex = XC_LEX_WHITESPACE; |
2768 | for (;;) { | 2768 | for (;;) { |
2769 | char c = l->buf[l->i]; | 2769 | char c = l->lex_inbuf[l->lex_i]; |
2770 | if (c == '\n') // this is XC_LEX_NLINE, not XC_LEX_WHITESPACE | 2770 | if (c == '\n') // this is XC_LEX_NLINE, not XC_LEX_WHITESPACE |
2771 | break; | 2771 | break; |
2772 | if (!isspace(c)) | 2772 | if (!isspace(c)) |
2773 | break; | 2773 | break; |
2774 | l->i++; | 2774 | l->lex_i++; |
2775 | } | 2775 | } |
2776 | } | 2776 | } |
2777 | 2777 | ||
2778 | static BC_STATUS zbc_lex_number(char start) | 2778 | static BC_STATUS zbc_lex_number(char start) |
2779 | { | 2779 | { |
2780 | BcLex *l = &G.prs.l; | 2780 | BcLex *l = &G.prs.l; |
2781 | const char *buf = l->buf + l->i; | 2781 | const char *buf = l->lex_inbuf + l->lex_i; |
2782 | size_t len, i, ccnt; | 2782 | size_t len, i, ccnt; |
2783 | bool pt; | 2783 | bool pt; |
2784 | 2784 | ||
@@ -2808,7 +2808,7 @@ static BC_STATUS zbc_lex_number(char start) | |||
2808 | //ccnt is the number of chars in the number string, excluding possible | 2808 | //ccnt is the number of chars in the number string, excluding possible |
2809 | //trailing "[\<newline>].[\<newline>]" (with any number of \<NL> repetitions). | 2809 | //trailing "[\<newline>].[\<newline>]" (with any number of \<NL> repetitions). |
2810 | //i is buf[i] index of the first not-yet-parsed char after that. | 2810 | //i is buf[i] index of the first not-yet-parsed char after that. |
2811 | l->i += i; | 2811 | l->lex_i += i; |
2812 | 2812 | ||
2813 | // This might overestimate the size, if there are "\<NL>"'s | 2813 | // This might overestimate the size, if there are "\<NL>"'s |
2814 | // in the number. Subtracting number_of_backslashes*2 correctly | 2814 | // in the number. Subtracting number_of_backslashes*2 correctly |
@@ -2823,9 +2823,9 @@ static BC_STATUS zbc_lex_number(char start) | |||
2823 | RETURN_STATUS(bc_error("number too long: must be [1,"BC_MAX_NUM_STR"]")); | 2823 | RETURN_STATUS(bc_error("number too long: must be [1,"BC_MAX_NUM_STR"]")); |
2824 | } | 2824 | } |
2825 | 2825 | ||
2826 | bc_vec_pop_all(&l->lex_buf); | 2826 | bc_vec_pop_all(&l->lex_strnumbuf); |
2827 | bc_vec_expand(&l->lex_buf, 1 + len); | 2827 | bc_vec_expand(&l->lex_strnumbuf, 1 + len); |
2828 | bc_vec_push(&l->lex_buf, &start); | 2828 | bc_vec_push(&l->lex_strnumbuf, &start); |
2829 | 2829 | ||
2830 | while (ccnt != 0) { | 2830 | while (ccnt != 0) { |
2831 | // If we have hit a backslash, skip it. We don't have | 2831 | // If we have hit a backslash, skip it. We don't have |
@@ -2835,12 +2835,12 @@ static BC_STATUS zbc_lex_number(char start) | |||
2835 | ccnt -= 2; | 2835 | ccnt -= 2; |
2836 | continue; | 2836 | continue; |
2837 | } | 2837 | } |
2838 | bc_vec_push(&l->lex_buf, buf); | 2838 | bc_vec_push(&l->lex_strnumbuf, buf); |
2839 | buf++; | 2839 | buf++; |
2840 | ccnt--; | 2840 | ccnt--; |
2841 | } | 2841 | } |
2842 | 2842 | ||
2843 | bc_vec_pushZeroByte(&l->lex_buf); | 2843 | bc_vec_pushZeroByte(&l->lex_strnumbuf); |
2844 | 2844 | ||
2845 | RETURN_STATUS(BC_STATUS_SUCCESS); | 2845 | RETURN_STATUS(BC_STATUS_SUCCESS); |
2846 | } | 2846 | } |
@@ -2855,7 +2855,7 @@ static void bc_lex_name(void) | |||
2855 | l->lex = XC_LEX_NAME; | 2855 | l->lex = XC_LEX_NAME; |
2856 | 2856 | ||
2857 | i = 0; | 2857 | i = 0; |
2858 | buf = l->buf + l->i - 1; | 2858 | buf = l->lex_inbuf + l->lex_i - 1; |
2859 | for (;;) { | 2859 | for (;;) { |
2860 | char c = buf[i]; | 2860 | char c = buf[i]; |
2861 | if ((c < 'a' || c > 'z') && !isdigit(c) && c != '_') break; | 2861 | if ((c < 'a' || c > 'z') && !isdigit(c) && c != '_') break; |
@@ -2869,28 +2869,28 @@ static void bc_lex_name(void) | |||
2869 | return bc_error("name too long: must be [1,"BC_MAX_STRING_STR"]"); | 2869 | return bc_error("name too long: must be [1,"BC_MAX_STRING_STR"]"); |
2870 | } | 2870 | } |
2871 | #endif | 2871 | #endif |
2872 | bc_vec_string(&l->lex_buf, i, buf); | 2872 | bc_vec_string(&l->lex_strnumbuf, i, buf); |
2873 | 2873 | ||
2874 | // Increment the index. We minus 1 because it has already been incremented. | 2874 | // Increment the index. We minus 1 because it has already been incremented. |
2875 | l->i += i - 1; | 2875 | l->lex_i += i - 1; |
2876 | 2876 | ||
2877 | //return BC_STATUS_SUCCESS; | 2877 | //return BC_STATUS_SUCCESS; |
2878 | } | 2878 | } |
2879 | 2879 | ||
2880 | static void bc_lex_init(void) | 2880 | static void bc_lex_init(void) |
2881 | { | 2881 | { |
2882 | bc_char_vec_init(&G.prs.l.lex_buf); | 2882 | bc_char_vec_init(&G.prs.l.lex_strnumbuf); |
2883 | } | 2883 | } |
2884 | 2884 | ||
2885 | static void bc_lex_free(void) | 2885 | static void bc_lex_free(void) |
2886 | { | 2886 | { |
2887 | bc_vec_free(&G.prs.l.lex_buf); | 2887 | bc_vec_free(&G.prs.l.lex_strnumbuf); |
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | static void bc_lex_file(void) | 2890 | static void bc_lex_file(void) |
2891 | { | 2891 | { |
2892 | G.err_line = G.prs.l.line = 1; | 2892 | G.err_line = G.prs.l.lex_line = 1; |
2893 | G.prs.l.newline = false; | 2893 | G.prs.l.lex_newline = false; |
2894 | } | 2894 | } |
2895 | 2895 | ||
2896 | static bool bc_lex_more_input(void) | 2896 | static bool bc_lex_more_input(void) |
@@ -2958,12 +2958,12 @@ static bool bc_lex_more_input(void) | |||
2958 | break; | 2958 | break; |
2959 | } | 2959 | } |
2960 | 2960 | ||
2961 | l->buf = G.input_buffer.v; | 2961 | l->lex_inbuf = G.input_buffer.v; |
2962 | l->i = 0; | 2962 | l->lex_i = 0; |
2963 | // bb_error_msg("G.input_buffer.len:%d '%s'", G.input_buffer.len, G.input_buffer.v); | 2963 | // bb_error_msg("G.input_buffer.len:%d '%s'", G.input_buffer.len, G.input_buffer.v); |
2964 | l->len = G.input_buffer.len - 1; // do not include NUL | 2964 | l->lex_len = G.input_buffer.len - 1; // do not include NUL |
2965 | 2965 | ||
2966 | return l->len != 0; | 2966 | return l->lex_len != 0; |
2967 | } | 2967 | } |
2968 | 2968 | ||
2969 | IF_BC(static BC_STATUS zbc_lex_token(void);) | 2969 | IF_BC(static BC_STATUS zbc_lex_token(void);) |
@@ -2979,16 +2979,16 @@ static BC_STATUS zbc_lex_next(void) | |||
2979 | l->lex_last = l->lex; | 2979 | l->lex_last = l->lex; |
2980 | if (l->lex_last == XC_LEX_EOF) RETURN_STATUS(bc_error("end of file")); | 2980 | if (l->lex_last == XC_LEX_EOF) RETURN_STATUS(bc_error("end of file")); |
2981 | 2981 | ||
2982 | l->line += l->newline; | 2982 | l->lex_line += l->lex_newline; |
2983 | G.err_line = l->line; | 2983 | G.err_line = l->lex_line; |
2984 | l->newline = false; | 2984 | l->lex_newline = false; |
2985 | 2985 | ||
2986 | // Loop until failure or we don't have whitespace. This | 2986 | // Loop until failure or we don't have whitespace. This |
2987 | // is so the parser doesn't get inundated with whitespace. | 2987 | // is so the parser doesn't get inundated with whitespace. |
2988 | // Comments are also XC_LEX_WHITESPACE tokens and eaten here. | 2988 | // Comments are also XC_LEX_WHITESPACE tokens and eaten here. |
2989 | s = BC_STATUS_SUCCESS; | 2989 | s = BC_STATUS_SUCCESS; |
2990 | do { | 2990 | do { |
2991 | if (l->i == l->len) { | 2991 | if (l->lex_i == l->lex_len) { |
2992 | l->lex = XC_LEX_EOF; | 2992 | l->lex = XC_LEX_EOF; |
2993 | if (!G.prs.input_fp) | 2993 | if (!G.prs.input_fp) |
2994 | RETURN_STATUS(BC_STATUS_SUCCESS); | 2994 | RETURN_STATUS(BC_STATUS_SUCCESS); |
@@ -2996,9 +2996,9 @@ static BC_STATUS zbc_lex_next(void) | |||
2996 | G.prs.input_fp = NULL; | 2996 | G.prs.input_fp = NULL; |
2997 | RETURN_STATUS(BC_STATUS_SUCCESS); | 2997 | RETURN_STATUS(BC_STATUS_SUCCESS); |
2998 | } | 2998 | } |
2999 | // here it's guaranteed that l->i is below l->len | 2999 | // here it's guaranteed that l->lex_i is below l->lex_len |
3000 | } | 3000 | } |
3001 | l->lex_next_at = l->buf + l->i; | 3001 | l->lex_next_at = l->lex_inbuf + l->lex_i; |
3002 | dbg_lex("next string to parse:'%.*s'", | 3002 | dbg_lex("next string to parse:'%.*s'", |
3003 | (int)(strchrnul(l->lex_next_at, '\n') - l->lex_next_at), | 3003 | (int)(strchrnul(l->lex_next_at, '\n') - l->lex_next_at), |
3004 | l->lex_next_at | 3004 | l->lex_next_at |
@@ -3038,9 +3038,9 @@ static BC_STATUS zbc_lex_next_and_skip_NLINE(void) | |||
3038 | 3038 | ||
3039 | static BC_STATUS zbc_lex_text_init(const char *text) | 3039 | static BC_STATUS zbc_lex_text_init(const char *text) |
3040 | { | 3040 | { |
3041 | G.prs.l.buf = text; | 3041 | G.prs.l.lex_inbuf = text; |
3042 | G.prs.l.i = 0; | 3042 | G.prs.l.lex_i = 0; |
3043 | G.prs.l.len = strlen(text); | 3043 | G.prs.l.lex_len = strlen(text); |
3044 | G.prs.l.lex = G.prs.l.lex_last = XC_LEX_INVALID; | 3044 | G.prs.l.lex = G.prs.l.lex_last = XC_LEX_INVALID; |
3045 | RETURN_STATUS(zbc_lex_next()); | 3045 | RETURN_STATUS(zbc_lex_next()); |
3046 | } | 3046 | } |
@@ -3052,7 +3052,7 @@ static BC_STATUS zbc_lex_identifier(void) | |||
3052 | BcLex *l = &G.prs.l; | 3052 | BcLex *l = &G.prs.l; |
3053 | BcStatus s; | 3053 | BcStatus s; |
3054 | unsigned i; | 3054 | unsigned i; |
3055 | const char *buf = l->buf + l->i - 1; | 3055 | const char *buf = l->lex_inbuf + l->lex_i - 1; |
3056 | 3056 | ||
3057 | for (i = 0; i < ARRAY_SIZE(bc_lex_kws); ++i) { | 3057 | for (i = 0; i < ARRAY_SIZE(bc_lex_kws); ++i) { |
3058 | const char *keyword8 = bc_lex_kws[i].name8; | 3058 | const char *keyword8 = bc_lex_kws[i].name8; |
@@ -3068,20 +3068,20 @@ static BC_STATUS zbc_lex_identifier(void) | |||
3068 | if (isalnum(buf[j]) || buf[j]=='_') | 3068 | if (isalnum(buf[j]) || buf[j]=='_') |
3069 | continue; // "ifz" does not match "if" keyword, "if." does | 3069 | continue; // "ifz" does not match "if" keyword, "if." does |
3070 | l->lex = BC_LEX_KEY_1st_keyword + i; | 3070 | l->lex = BC_LEX_KEY_1st_keyword + i; |
3071 | if (!bc_lex_kws_POSIX(i)) { | 3071 | if (!keyword_is_POSIX(i)) { |
3072 | s = zbc_posix_error_fmt("%sthe '%.8s' keyword", "POSIX does not allow ", bc_lex_kws[i].name8); | 3072 | s = zbc_posix_error_fmt("%sthe '%.8s' keyword", "POSIX does not allow ", bc_lex_kws[i].name8); |
3073 | if (s) RETURN_STATUS(s); | 3073 | if (s) RETURN_STATUS(s); |
3074 | } | 3074 | } |
3075 | 3075 | ||
3076 | // We minus 1 because the index has already been incremented. | 3076 | // We minus 1 because the index has already been incremented. |
3077 | l->i += j - 1; | 3077 | l->lex_i += j - 1; |
3078 | RETURN_STATUS(BC_STATUS_SUCCESS); | 3078 | RETURN_STATUS(BC_STATUS_SUCCESS); |
3079 | } | 3079 | } |
3080 | 3080 | ||
3081 | bc_lex_name(); | 3081 | bc_lex_name(); |
3082 | s = BC_STATUS_SUCCESS; | 3082 | s = BC_STATUS_SUCCESS; |
3083 | 3083 | ||
3084 | if (l->lex_buf.len > 2) { | 3084 | if (l->lex_strnumbuf.len > 2) { |
3085 | // Prevent this: | 3085 | // Prevent this: |
3086 | // >>> qwe=1 | 3086 | // >>> qwe=1 |
3087 | // bc: POSIX only allows one character names; this is bad: 'qwe=1 | 3087 | // bc: POSIX only allows one character names; this is bad: 'qwe=1 |
@@ -3102,11 +3102,11 @@ static BC_STATUS zbc_lex_string(void) | |||
3102 | l->lex = XC_LEX_STR; | 3102 | l->lex = XC_LEX_STR; |
3103 | 3103 | ||
3104 | nls = 0; | 3104 | nls = 0; |
3105 | i = l->i; | 3105 | i = l->lex_i; |
3106 | for (;;) { | 3106 | for (;;) { |
3107 | char c = l->buf[i]; | 3107 | char c = l->lex_inbuf[i]; |
3108 | if (c == '\0') { | 3108 | if (c == '\0') { |
3109 | l->i = i; | 3109 | l->lex_i = i; |
3110 | RETURN_STATUS(bc_error("unterminated string")); | 3110 | RETURN_STATUS(bc_error("unterminated string")); |
3111 | } | 3111 | } |
3112 | if (c == '"') | 3112 | if (c == '"') |
@@ -3115,17 +3115,17 @@ static BC_STATUS zbc_lex_string(void) | |||
3115 | i++; | 3115 | i++; |
3116 | } | 3116 | } |
3117 | 3117 | ||
3118 | len = i - l->i; | 3118 | len = i - l->lex_i; |
3119 | // This check makes sense only if size_t is (much) larger than BC_MAX_STRING. | 3119 | // This check makes sense only if size_t is (much) larger than BC_MAX_STRING. |
3120 | if (SIZE_MAX > (BC_MAX_STRING | 0xff)) { | 3120 | if (SIZE_MAX > (BC_MAX_STRING | 0xff)) { |
3121 | if (len > BC_MAX_STRING) | 3121 | if (len > BC_MAX_STRING) |
3122 | RETURN_STATUS(bc_error("string too long: must be [1,"BC_MAX_STRING_STR"]")); | 3122 | RETURN_STATUS(bc_error("string too long: must be [1,"BC_MAX_STRING_STR"]")); |
3123 | } | 3123 | } |
3124 | bc_vec_string(&l->lex_buf, len, l->buf + l->i); | 3124 | bc_vec_string(&l->lex_strnumbuf, len, l->lex_inbuf + l->lex_i); |
3125 | 3125 | ||
3126 | l->i = i + 1; | 3126 | l->lex_i = i + 1; |
3127 | l->line += nls; | 3127 | l->lex_line += nls; |
3128 | G.err_line = l->line; | 3128 | G.err_line = l->lex_line; |
3129 | 3129 | ||
3130 | RETURN_STATUS(BC_STATUS_SUCCESS); | 3130 | RETURN_STATUS(BC_STATUS_SUCCESS); |
3131 | } | 3131 | } |
@@ -3134,8 +3134,8 @@ static BC_STATUS zbc_lex_string(void) | |||
3134 | static void bc_lex_assign(unsigned with_and_without) | 3134 | static void bc_lex_assign(unsigned with_and_without) |
3135 | { | 3135 | { |
3136 | BcLex *l = &G.prs.l; | 3136 | BcLex *l = &G.prs.l; |
3137 | if (l->buf[l->i] == '=') { | 3137 | if (l->lex_inbuf[l->lex_i] == '=') { |
3138 | ++l->i; | 3138 | l->lex_i++; |
3139 | with_and_without >>= 8; // store "with" value | 3139 | with_and_without >>= 8; // store "with" value |
3140 | } // else store "without" value | 3140 | } // else store "without" value |
3141 | l->lex = (with_and_without & 0xff); | 3141 | l->lex = (with_and_without & 0xff); |
@@ -3147,10 +3147,10 @@ static BC_STATUS zbc_lex_comment(void) | |||
3147 | { | 3147 | { |
3148 | BcLex *l = &G.prs.l; | 3148 | BcLex *l = &G.prs.l; |
3149 | size_t i, nls = 0; | 3149 | size_t i, nls = 0; |
3150 | const char *buf = l->buf; | 3150 | const char *buf = l->lex_inbuf; |
3151 | 3151 | ||
3152 | l->lex = XC_LEX_WHITESPACE; | 3152 | l->lex = XC_LEX_WHITESPACE; |
3153 | i = l->i; /* here buf[l->i] is the '*' of opening comment delimiter */ | 3153 | i = l->lex_i; /* here buf[l->lex_i] is the '*' of opening comment delimiter */ |
3154 | for (;;) { | 3154 | for (;;) { |
3155 | char c = buf[++i]; | 3155 | char c = buf[++i]; |
3156 | check_star: | 3156 | check_star: |
@@ -3161,15 +3161,15 @@ static BC_STATUS zbc_lex_comment(void) | |||
3161 | goto check_star; | 3161 | goto check_star; |
3162 | } | 3162 | } |
3163 | if (c == '\0') { | 3163 | if (c == '\0') { |
3164 | l->i = i; | 3164 | l->lex_i = i; |
3165 | RETURN_STATUS(bc_error("unterminated comment")); | 3165 | RETURN_STATUS(bc_error("unterminated comment")); |
3166 | } | 3166 | } |
3167 | nls += (c == '\n'); | 3167 | nls += (c == '\n'); |
3168 | } | 3168 | } |
3169 | 3169 | ||
3170 | l->i = i + 1; | 3170 | l->lex_i = i + 1; |
3171 | l->line += nls; | 3171 | l->lex_line += nls; |
3172 | G.err_line = l->line; | 3172 | G.err_line = l->lex_line; |
3173 | 3173 | ||
3174 | RETURN_STATUS(BC_STATUS_SUCCESS); | 3174 | RETURN_STATUS(BC_STATUS_SUCCESS); |
3175 | } | 3175 | } |
@@ -3180,18 +3180,18 @@ static BC_STATUS zbc_lex_token(void) | |||
3180 | { | 3180 | { |
3181 | BcLex *l = &G.prs.l; | 3181 | BcLex *l = &G.prs.l; |
3182 | BcStatus s = BC_STATUS_SUCCESS; | 3182 | BcStatus s = BC_STATUS_SUCCESS; |
3183 | char c = l->buf[l->i++], c2; | 3183 | char c = l->lex_inbuf[l->lex_i++], c2; |
3184 | 3184 | ||
3185 | // This is the workhorse of the lexer. | 3185 | // This is the workhorse of the lexer. |
3186 | switch (c) { | 3186 | switch (c) { |
3187 | // case '\0': // probably never reached | 3187 | // case '\0': // probably never reached |
3188 | // l->i--; | 3188 | // l->lex_i--; |
3189 | // l->lex = XC_LEX_EOF; | 3189 | // l->lex = XC_LEX_EOF; |
3190 | // l->newline = true; | 3190 | // l->lex_newline = true; |
3191 | // break; | 3191 | // break; |
3192 | case '\n': | 3192 | case '\n': |
3193 | l->lex = XC_LEX_NLINE; | 3193 | l->lex = XC_LEX_NLINE; |
3194 | l->newline = true; | 3194 | l->lex_newline = true; |
3195 | break; | 3195 | break; |
3196 | case '\t': | 3196 | case '\t': |
3197 | case '\v': | 3197 | case '\v': |
@@ -3219,11 +3219,11 @@ static BC_STATUS zbc_lex_token(void) | |||
3219 | bc_lex_assign(BC_LEX_OP_ASSIGN_MODULUS, XC_LEX_OP_MODULUS); | 3219 | bc_lex_assign(BC_LEX_OP_ASSIGN_MODULUS, XC_LEX_OP_MODULUS); |
3220 | break; | 3220 | break; |
3221 | case '&': | 3221 | case '&': |
3222 | c2 = l->buf[l->i]; | 3222 | c2 = l->lex_inbuf[l->lex_i]; |
3223 | if (c2 == '&') { | 3223 | if (c2 == '&') { |
3224 | s = zbc_POSIX_does_not_allow_bool_ops_this_is_bad("&&"); | 3224 | s = zbc_POSIX_does_not_allow_bool_ops_this_is_bad("&&"); |
3225 | if (s) RETURN_STATUS(s); | 3225 | if (s) RETURN_STATUS(s); |
3226 | ++l->i; | 3226 | l->lex_i++; |
3227 | l->lex = BC_LEX_OP_BOOL_AND; | 3227 | l->lex = BC_LEX_OP_BOOL_AND; |
3228 | } else { | 3228 | } else { |
3229 | l->lex = XC_LEX_INVALID; | 3229 | l->lex = XC_LEX_INVALID; |
@@ -3238,9 +3238,9 @@ static BC_STATUS zbc_lex_token(void) | |||
3238 | bc_lex_assign(BC_LEX_OP_ASSIGN_MULTIPLY, XC_LEX_OP_MULTIPLY); | 3238 | bc_lex_assign(BC_LEX_OP_ASSIGN_MULTIPLY, XC_LEX_OP_MULTIPLY); |
3239 | break; | 3239 | break; |
3240 | case '+': | 3240 | case '+': |
3241 | c2 = l->buf[l->i]; | 3241 | c2 = l->lex_inbuf[l->lex_i]; |
3242 | if (c2 == '+') { | 3242 | if (c2 == '+') { |
3243 | ++l->i; | 3243 | l->lex_i++; |
3244 | l->lex = BC_LEX_OP_INC; | 3244 | l->lex = BC_LEX_OP_INC; |
3245 | } else | 3245 | } else |
3246 | bc_lex_assign(BC_LEX_OP_ASSIGN_PLUS, XC_LEX_OP_PLUS); | 3246 | bc_lex_assign(BC_LEX_OP_ASSIGN_PLUS, XC_LEX_OP_PLUS); |
@@ -3249,15 +3249,15 @@ static BC_STATUS zbc_lex_token(void) | |||
3249 | l->lex = BC_LEX_COMMA; | 3249 | l->lex = BC_LEX_COMMA; |
3250 | break; | 3250 | break; |
3251 | case '-': | 3251 | case '-': |
3252 | c2 = l->buf[l->i]; | 3252 | c2 = l->lex_inbuf[l->lex_i]; |
3253 | if (c2 == '-') { | 3253 | if (c2 == '-') { |
3254 | ++l->i; | 3254 | l->lex_i++; |
3255 | l->lex = BC_LEX_OP_DEC; | 3255 | l->lex = BC_LEX_OP_DEC; |
3256 | } else | 3256 | } else |
3257 | bc_lex_assign(BC_LEX_OP_ASSIGN_MINUS, XC_LEX_OP_MINUS); | 3257 | bc_lex_assign(BC_LEX_OP_ASSIGN_MINUS, XC_LEX_OP_MINUS); |
3258 | break; | 3258 | break; |
3259 | case '.': | 3259 | case '.': |
3260 | if (isdigit(l->buf[l->i])) | 3260 | if (isdigit(l->lex_inbuf[l->lex_i])) |
3261 | s = zbc_lex_number(c); | 3261 | s = zbc_lex_number(c); |
3262 | else { | 3262 | else { |
3263 | l->lex = BC_LEX_KEY_LAST; | 3263 | l->lex = BC_LEX_KEY_LAST; |
@@ -3265,7 +3265,7 @@ static BC_STATUS zbc_lex_token(void) | |||
3265 | } | 3265 | } |
3266 | break; | 3266 | break; |
3267 | case '/': | 3267 | case '/': |
3268 | c2 = l->buf[l->i]; | 3268 | c2 = l->lex_inbuf[l->lex_i]; |
3269 | if (c2 == '*') | 3269 | if (c2 == '*') |
3270 | s = zbc_lex_comment(); | 3270 | s = zbc_lex_comment(); |
3271 | else | 3271 | else |
@@ -3306,9 +3306,9 @@ static BC_STATUS zbc_lex_token(void) | |||
3306 | l->lex = (BcLexType)(c - '[' + BC_LEX_LBRACKET); | 3306 | l->lex = (BcLexType)(c - '[' + BC_LEX_LBRACKET); |
3307 | break; | 3307 | break; |
3308 | case '\\': | 3308 | case '\\': |
3309 | if (l->buf[l->i] == '\n') { | 3309 | if (l->lex_inbuf[l->lex_i] == '\n') { |
3310 | l->lex = XC_LEX_WHITESPACE; | 3310 | l->lex = XC_LEX_WHITESPACE; |
3311 | ++l->i; | 3311 | l->lex_i++; |
3312 | } else | 3312 | } else |
3313 | s = bc_error_bad_character(c); | 3313 | s = bc_error_bad_character(c); |
3314 | break; | 3314 | break; |
@@ -3348,11 +3348,11 @@ static BC_STATUS zbc_lex_token(void) | |||
3348 | l->lex = (BcLexType)(c - '{' + BC_LEX_LBRACE); | 3348 | l->lex = (BcLexType)(c - '{' + BC_LEX_LBRACE); |
3349 | break; | 3349 | break; |
3350 | case '|': | 3350 | case '|': |
3351 | c2 = l->buf[l->i]; | 3351 | c2 = l->lex_inbuf[l->lex_i]; |
3352 | if (c2 == '|') { | 3352 | if (c2 == '|') { |
3353 | s = zbc_POSIX_does_not_allow_bool_ops_this_is_bad("||"); | 3353 | s = zbc_POSIX_does_not_allow_bool_ops_this_is_bad("||"); |
3354 | if (s) RETURN_STATUS(s); | 3354 | if (s) RETURN_STATUS(s); |
3355 | ++l->i; | 3355 | l->lex_i++; |
3356 | l->lex = BC_LEX_OP_BOOL_OR; | 3356 | l->lex = BC_LEX_OP_BOOL_OR; |
3357 | } else { | 3357 | } else { |
3358 | l->lex = XC_LEX_INVALID; | 3358 | l->lex = XC_LEX_INVALID; |
@@ -3374,14 +3374,14 @@ static BC_STATUS zbc_lex_token(void) | |||
3374 | static BC_STATUS zdc_lex_register(void) | 3374 | static BC_STATUS zdc_lex_register(void) |
3375 | { | 3375 | { |
3376 | BcLex *l = &G.prs.l; | 3376 | BcLex *l = &G.prs.l; |
3377 | if (G_exreg && isspace(l->buf[l->i])) { | 3377 | if (G_exreg && isspace(l->lex_inbuf[l->lex_i])) { |
3378 | bc_lex_whitespace(); // eats whitespace (but not newline) | 3378 | bc_lex_whitespace(); // eats whitespace (but not newline) |
3379 | l->i++; // bc_lex_name() expects this | 3379 | l->lex_i++; // bc_lex_name() expects this |
3380 | bc_lex_name(); | 3380 | bc_lex_name(); |
3381 | } else { | 3381 | } else { |
3382 | bc_vec_pop_all(&l->lex_buf); | 3382 | bc_vec_pop_all(&l->lex_strnumbuf); |
3383 | bc_vec_push(&l->lex_buf, &l->buf[l->i++]); | 3383 | bc_vec_push(&l->lex_strnumbuf, &l->lex_inbuf[l->lex_i++]); |
3384 | bc_vec_pushZeroByte(&l->lex_buf); | 3384 | bc_vec_pushZeroByte(&l->lex_strnumbuf); |
3385 | l->lex = XC_LEX_NAME; | 3385 | l->lex = XC_LEX_NAME; |
3386 | } | 3386 | } |
3387 | 3387 | ||
@@ -3395,39 +3395,39 @@ static BC_STATUS zdc_lex_string(void) | |||
3395 | size_t depth, nls, i; | 3395 | size_t depth, nls, i; |
3396 | 3396 | ||
3397 | l->lex = XC_LEX_STR; | 3397 | l->lex = XC_LEX_STR; |
3398 | bc_vec_pop_all(&l->lex_buf); | 3398 | bc_vec_pop_all(&l->lex_strnumbuf); |
3399 | 3399 | ||
3400 | nls = 0; | 3400 | nls = 0; |
3401 | depth = 1; | 3401 | depth = 1; |
3402 | i = l->i; | 3402 | i = l->lex_i; |
3403 | for (;;) { | 3403 | for (;;) { |
3404 | char c = l->buf[i]; | 3404 | char c = l->lex_inbuf[i]; |
3405 | if (c == '\0') { | 3405 | if (c == '\0') { |
3406 | l->i = i; | 3406 | l->lex_i = i; |
3407 | RETURN_STATUS(bc_error("string end could not be found")); | 3407 | RETURN_STATUS(bc_error("string end could not be found")); |
3408 | } | 3408 | } |
3409 | nls += (c == '\n'); | 3409 | nls += (c == '\n'); |
3410 | if (i == l->i || l->buf[i - 1] != '\\') { | 3410 | if (i == l->lex_i || l->lex_inbuf[i - 1] != '\\') { |
3411 | if (c == '[') depth++; | 3411 | if (c == '[') depth++; |
3412 | if (c == ']') | 3412 | if (c == ']') |
3413 | if (--depth == 0) | 3413 | if (--depth == 0) |
3414 | break; | 3414 | break; |
3415 | } | 3415 | } |
3416 | bc_vec_push(&l->lex_buf, &l->buf[i]); | 3416 | bc_vec_push(&l->lex_strnumbuf, &l->lex_inbuf[i]); |
3417 | i++; | 3417 | i++; |
3418 | } | 3418 | } |
3419 | i++; | 3419 | i++; |
3420 | 3420 | ||
3421 | bc_vec_pushZeroByte(&l->lex_buf); | 3421 | bc_vec_pushZeroByte(&l->lex_strnumbuf); |
3422 | // This check makes sense only if size_t is (much) larger than BC_MAX_STRING. | 3422 | // This check makes sense only if size_t is (much) larger than BC_MAX_STRING. |
3423 | if (SIZE_MAX > (BC_MAX_STRING | 0xff)) { | 3423 | if (SIZE_MAX > (BC_MAX_STRING | 0xff)) { |
3424 | if (i - l->i > BC_MAX_STRING) | 3424 | if (i - l->lex_i > BC_MAX_STRING) |
3425 | RETURN_STATUS(bc_error("string too long: must be [1,"BC_MAX_STRING_STR"]")); | 3425 | RETURN_STATUS(bc_error("string too long: must be [1,"BC_MAX_STRING_STR"]")); |
3426 | } | 3426 | } |
3427 | 3427 | ||
3428 | l->i = i; | 3428 | l->lex_i = i; |
3429 | l->line += nls; | 3429 | l->lex_line += nls; |
3430 | G.err_line = l->line; | 3430 | G.err_line = l->lex_line; |
3431 | 3431 | ||
3432 | RETURN_STATUS(BC_STATUS_SUCCESS); | 3432 | RETURN_STATUS(BC_STATUS_SUCCESS); |
3433 | } | 3433 | } |
@@ -3456,7 +3456,7 @@ static BC_STATUS zdc_lex_token(void) | |||
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | s = BC_STATUS_SUCCESS; | 3458 | s = BC_STATUS_SUCCESS; |
3459 | c = l->buf[l->i++]; | 3459 | c = l->lex_inbuf[l->lex_i++]; |
3460 | if (c >= '%' && c <= '~' | 3460 | if (c >= '%' && c <= '~' |
3461 | && (l->lex = dc_char_to_LEX[c - '%']) != XC_LEX_INVALID | 3461 | && (l->lex = dc_char_to_LEX[c - '%']) != XC_LEX_INVALID |
3462 | ) { | 3462 | ) { |
@@ -3478,18 +3478,18 @@ static BC_STATUS zdc_lex_token(void) | |||
3478 | // IOW: typing "1p<enter>" should print "1" _at once_, | 3478 | // IOW: typing "1p<enter>" should print "1" _at once_, |
3479 | // not after some more input. | 3479 | // not after some more input. |
3480 | l->lex = XC_LEX_NLINE; | 3480 | l->lex = XC_LEX_NLINE; |
3481 | l->newline = true; | 3481 | l->lex_newline = true; |
3482 | break; | 3482 | break; |
3483 | case '\t': | 3483 | case '\t': |
3484 | case '\v': | 3484 | case '\v': |
3485 | case '\f': | 3485 | case '\f': |
3486 | case '\r': | 3486 | case '\r': |
3487 | case ' ': | 3487 | case ' ': |
3488 | l->newline = 0; // was (c == '\n') | 3488 | l->lex_newline = 0; // was (c == '\n') |
3489 | bc_lex_whitespace(); | 3489 | bc_lex_whitespace(); |
3490 | break; | 3490 | break; |
3491 | case '!': | 3491 | case '!': |
3492 | c2 = l->buf[l->i]; | 3492 | c2 = l->lex_inbuf[l->lex_i]; |
3493 | if (c2 == '=') | 3493 | if (c2 == '=') |
3494 | l->lex = XC_LEX_OP_REL_NE; | 3494 | l->lex = XC_LEX_OP_REL_NE; |
3495 | else if (c2 == '<') | 3495 | else if (c2 == '<') |
@@ -3498,13 +3498,13 @@ static BC_STATUS zdc_lex_token(void) | |||
3498 | l->lex = XC_LEX_OP_REL_GE; | 3498 | l->lex = XC_LEX_OP_REL_GE; |
3499 | else | 3499 | else |
3500 | RETURN_STATUS(bc_error_bad_character(c)); | 3500 | RETURN_STATUS(bc_error_bad_character(c)); |
3501 | ++l->i; | 3501 | l->lex_i++; |
3502 | break; | 3502 | break; |
3503 | case '#': | 3503 | case '#': |
3504 | bc_lex_lineComment(); | 3504 | bc_lex_lineComment(); |
3505 | break; | 3505 | break; |
3506 | case '.': | 3506 | case '.': |
3507 | if (isdigit(l->buf[l->i])) | 3507 | if (isdigit(l->lex_inbuf[l->lex_i])) |
3508 | s = zbc_lex_number(c); | 3508 | s = zbc_lex_number(c); |
3509 | else | 3509 | else |
3510 | s = bc_error_bad_character(c); | 3510 | s = bc_error_bad_character(c); |
@@ -3593,7 +3593,7 @@ static void bc_parse_pushJUMP_ZERO(size_t idx) | |||
3593 | static BC_STATUS zbc_parse_pushSTR(void) | 3593 | static BC_STATUS zbc_parse_pushSTR(void) |
3594 | { | 3594 | { |
3595 | BcParse *p = &G.prs; | 3595 | BcParse *p = &G.prs; |
3596 | char *str = xstrdup(p->l.lex_buf.v); | 3596 | char *str = xstrdup(p->l.lex_strnumbuf.v); |
3597 | 3597 | ||
3598 | bc_parse_push(XC_INST_STR); | 3598 | bc_parse_push(XC_INST_STR); |
3599 | bc_parse_pushIndex(p->func->strs.len); | 3599 | bc_parse_pushIndex(p->func->strs.len); |
@@ -3607,7 +3607,7 @@ static BC_STATUS zbc_parse_pushSTR(void) | |||
3607 | static void bc_parse_pushNUM(void) | 3607 | static void bc_parse_pushNUM(void) |
3608 | { | 3608 | { |
3609 | BcParse *p = &G.prs; | 3609 | BcParse *p = &G.prs; |
3610 | char *num = xstrdup(p->l.lex_buf.v); | 3610 | char *num = xstrdup(p->l.lex_strnumbuf.v); |
3611 | #if ENABLE_BC && ENABLE_DC | 3611 | #if ENABLE_BC && ENABLE_DC |
3612 | size_t idx = bc_vec_push(IS_BC ? &p->func->consts : &G.prog.consts, &num); | 3612 | size_t idx = bc_vec_push(IS_BC ? &p->func->consts : &G.prog.consts, &num); |
3613 | #elif ENABLE_BC | 3613 | #elif ENABLE_BC |
@@ -3656,7 +3656,7 @@ static void bc_parse_reset(void) | |||
3656 | p->func = bc_program_func_BC_PROG_MAIN(); | 3656 | p->func = bc_program_func_BC_PROG_MAIN(); |
3657 | } | 3657 | } |
3658 | 3658 | ||
3659 | p->l.i = p->l.len; | 3659 | p->l.lex_i = p->l.lex_len; |
3660 | p->l.lex = XC_LEX_EOF; | 3660 | p->l.lex = XC_LEX_EOF; |
3661 | 3661 | ||
3662 | IF_BC(bc_vec_pop_all(&p->exits);) | 3662 | IF_BC(bc_vec_pop_all(&p->exits);) |
@@ -3897,7 +3897,7 @@ static BC_STATUS zbc_parse_name(BcInst *type, uint8_t flags) | |||
3897 | BcStatus s; | 3897 | BcStatus s; |
3898 | char *name; | 3898 | char *name; |
3899 | 3899 | ||
3900 | name = xstrdup(p->l.lex_buf.v); | 3900 | name = xstrdup(p->l.lex_strnumbuf.v); |
3901 | s = zbc_lex_next(); | 3901 | s = zbc_lex_next(); |
3902 | if (s) goto err; | 3902 | if (s) goto err; |
3903 | 3903 | ||
@@ -4317,7 +4317,7 @@ static BC_STATUS zbc_parse_for(void) | |||
4317 | // Set this for the next call to bc_parse_pushNUM(). | 4317 | // Set this for the next call to bc_parse_pushNUM(). |
4318 | // This is safe to set because the current token is a semicolon, | 4318 | // This is safe to set because the current token is a semicolon, |
4319 | // which has no string requirement. | 4319 | // which has no string requirement. |
4320 | bc_vec_string(&p->l.lex_buf, 1, "1"); | 4320 | bc_vec_string(&p->l.lex_strnumbuf, 1, "1"); |
4321 | bc_parse_pushNUM(); | 4321 | bc_parse_pushNUM(); |
4322 | s = zbc_POSIX_does_not_allow_empty_X_expression_in_for("condition"); | 4322 | s = zbc_POSIX_does_not_allow_empty_X_expression_in_for("condition"); |
4323 | } | 4323 | } |
@@ -4418,7 +4418,7 @@ static BC_STATUS zbc_parse_funcdef(void) | |||
4418 | if (p->l.lex != XC_LEX_NAME) | 4418 | if (p->l.lex != XC_LEX_NAME) |
4419 | RETURN_STATUS(bc_error("bad function definition")); | 4419 | RETURN_STATUS(bc_error("bad function definition")); |
4420 | 4420 | ||
4421 | name = xstrdup(p->l.lex_buf.v); | 4421 | name = xstrdup(p->l.lex_strnumbuf.v); |
4422 | p->fidx = bc_program_addFunc(name); | 4422 | p->fidx = bc_program_addFunc(name); |
4423 | p->func = bc_program_func(p->fidx); | 4423 | p->func = bc_program_func(p->fidx); |
4424 | 4424 | ||
@@ -4435,7 +4435,7 @@ static BC_STATUS zbc_parse_funcdef(void) | |||
4435 | 4435 | ||
4436 | ++p->func->nparams; | 4436 | ++p->func->nparams; |
4437 | 4437 | ||
4438 | name = xstrdup(p->l.lex_buf.v); | 4438 | name = xstrdup(p->l.lex_strnumbuf.v); |
4439 | s = zbc_lex_next(); | 4439 | s = zbc_lex_next(); |
4440 | if (s) goto err; | 4440 | if (s) goto err; |
4441 | 4441 | ||
@@ -4517,7 +4517,7 @@ static BC_STATUS zbc_parse_auto(void) | |||
4517 | if (p->l.lex != XC_LEX_NAME) | 4517 | if (p->l.lex != XC_LEX_NAME) |
4518 | RETURN_STATUS(bc_error("bad 'auto' syntax")); | 4518 | RETURN_STATUS(bc_error("bad 'auto' syntax")); |
4519 | 4519 | ||
4520 | name = xstrdup(p->l.lex_buf.v); | 4520 | name = xstrdup(p->l.lex_strnumbuf.v); |
4521 | s = zbc_lex_next(); | 4521 | s = zbc_lex_next(); |
4522 | if (s) goto err; | 4522 | if (s) goto err; |
4523 | 4523 | ||
@@ -4925,7 +4925,7 @@ static BC_STATUS zdc_parse_register(void) | |||
4925 | if (s) RETURN_STATUS(s); | 4925 | if (s) RETURN_STATUS(s); |
4926 | if (p->l.lex != XC_LEX_NAME) RETURN_STATUS(bc_error_bad_token()); | 4926 | if (p->l.lex != XC_LEX_NAME) RETURN_STATUS(bc_error_bad_token()); |
4927 | 4927 | ||
4928 | bc_parse_pushName(p->l.lex_buf.v); | 4928 | bc_parse_pushName(p->l.lex_strnumbuf.v); |
4929 | 4929 | ||
4930 | RETURN_STATUS(s); | 4930 | RETURN_STATUS(s); |
4931 | } | 4931 | } |
@@ -4939,7 +4939,7 @@ static void dc_parse_string(void) | |||
4939 | 4939 | ||
4940 | dbg_lex_enter("%s:%d entered", __func__, __LINE__); | 4940 | dbg_lex_enter("%s:%d entered", __func__, __LINE__); |
4941 | 4941 | ||
4942 | str = xstrdup(p->l.lex_buf.v); | 4942 | str = xstrdup(p->l.lex_strnumbuf.v); |
4943 | bc_parse_push(XC_INST_STR); | 4943 | bc_parse_push(XC_INST_STR); |
4944 | bc_parse_pushIndex(len); | 4944 | bc_parse_pushIndex(len); |
4945 | bc_vec_push(&G.prog.strs, &str); | 4945 | bc_vec_push(&G.prog.strs, &str); |