rm tokenizer/parser/mcode generators from C

This commit is contained in:
2026-02-09 20:05:50 -06:00
parent 27e852af5b
commit 3e42c57479
16 changed files with 198175 additions and 5998 deletions

View File

@@ -1707,45 +1707,6 @@ typedef struct PPretext {
int cap;
} PPretext;
/* === AST Parse State (shared by tokenize.c and parse.c) === */
typedef struct ASTParseState {
const char *filename;
const uint8_t *buf_start;
const uint8_t *buf_ptr;
const uint8_t *buf_end;
const uint8_t *token_ptr;
int token_val;
BOOL got_lf;
int function_nr;
cJSON *errors; /* array of error objects */
int has_error;
int error_count;
int in_disruption;
char *decoded_str; /* allocated buffer for decoded string escapes */
GetLineColCache lc_cache;
union {
struct {
const char *str;
size_t len;
} str;
struct {
double val;
} num;
struct {
const char *str;
size_t len;
BOOL has_escape;
BOOL is_reserved;
} ident;
struct {
const char *body;
size_t body_len;
const char *flags;
size_t flags_len;
} regexp;
} token_u;
} ASTParseState;
#define JS_CALL_FLAG_COPY_ARGV (1 << 1)
extern JSClassID js_class_id_alloc;
@@ -1935,25 +1896,5 @@ int reg_vm_check_interrupt(JSContext *ctx);
/* mcode.c exports */
JSValue mcode_exec(JSContext *ctx, JSMCode *code, JSValue this_obj, int argc, JSValue *argv, JSValue outer_frame);
/* tokenize.c exports (called by parse.c) */
void cjson_add_strn (cJSON *obj, const char *key, const char *str, size_t len);
cJSON *ast_node (ASTParseState *s, const char *kind, const uint8_t *start_ptr);
void ast_node_end (ASTParseState *s, cJSON *node, const uint8_t *end_ptr);
int ast_next_token (ASTParseState *s);
void ast_free_token (ASTParseState *s);
void ast_get_line_col (ASTParseState *s, const uint8_t *ptr, int *line, int *col);
BOOL tok_eq (const char *str, size_t len, const char *lit);
BOOL ast_is_arrow_function (ASTParseState *s);
int tokenize_next (ASTParseState *s);
void ast_error (ASTParseState *s, const uint8_t *ptr, const char *fmt, ...);
/* parse.c forward declarations */
cJSON *ast_parse_expr (ASTParseState *s);
cJSON *ast_parse_assign_expr (ASTParseState *s);
cJSON *ast_parse_statement (ASTParseState *s);
void ast_sync_to_statement (ASTParseState *s);
cJSON *ast_parse_block_statements (ASTParseState *s);
cJSON *ast_parse_function_inner (ASTParseState *s, BOOL is_expr);
cJSON *ast_parse_arrow_function (ASTParseState *s);
#endif /* QUICKJS_INTERNAL_H */