void open_parser(lua_State * L) { open_local_scope(L); lua_newtable(L); SET_FUN(parse_expr, "parse_expr"); SET_FUN(parse_level, "parse_level"); SET_FUN(parse_led, "parse_led"); SET_FUN(parse_binders, "parse_binders"); SET_FUN(parse_binder, "parse_binder"); SET_FUN(parse_scoped_expr, "parse_scoped_expr"); SET_FUN(lambda_abstract, "lambda_abstract"); SET_FUN(lambda_abstract, "abstract"); SET_FUN(next, "next"); SET_FUN(curr, "curr"); SET_FUN(curr_is_token, "curr_is_token"); SET_FUN(curr_is_token_or_id, "curr_is_token_or_id"); SET_FUN(curr_is_identifier, "curr_is_identifier"); SET_FUN(curr_is_numeral, "curr_is_numeral"); SET_FUN(curr_is_string, "curr_is_string"); SET_FUN(curr_is_keyword, "curr_is_keyword"); SET_FUN(curr_is_command, "curr_is_command"); SET_FUN(curr_is_quoted_symbol, "curr_is_quoted_symbol"); SET_FUN(check_token_next, "check_token_next"); SET_FUN(check_id_next, "check_id_next"); SET_FUN(pos, "pos"); SET_FUN(save_pos, "save_pos"); SET_FUN(pos_of, "pos_of"); SET_FUN(env, "env"); SET_FUN(ios, "ios"); lua_setglobal(L, "parser"); lua_newtable(L); SET_ENUM("Keyword", scanner::token_kind::Keyword); SET_ENUM("CommandKeyword", scanner::token_kind::CommandKeyword); SET_ENUM("ScriptBlock", scanner::token_kind::ScriptBlock); SET_ENUM("Identifier", scanner::token_kind::Identifier); SET_ENUM("Numeral", scanner::token_kind::Numeral); SET_ENUM("Decimal", scanner::token_kind::Decimal); SET_ENUM("String", scanner::token_kind::String); SET_ENUM("QuotedSymbol", scanner::token_kind::QuotedSymbol); lua_setglobal(L, "token_kind"); }
typeID typeof_designator (typeID t, Token d[]) { exprret E; Token x = internal_identifier1 (); Token expr [100]; sintprintf (expr, x, ISTR (d), -1); expr [intlen (expr) - 1] = -1; open_local_scope (); enter_local_obj (x, t); parse_expression_string (intdup (expr), &E); close_local_scope (); if (!E.ok) return typeID_void; if (E.newExpr [0] == x) intcpy (d, E.newExpr + 1), intcatc (d, '='); free (E.newExpr); return E.type; }