public boolean Procs_exec(int key, Scrib_proc_args args, Scrib_proc_rslt rslt) {
   switch (key) {
     case Proc_expr:
       return Expr(args, rslt);
     default:
       throw Err_.new_unhandled(key);
   }
 }
 public static Xoa_app_mode parse(String s) {
   Object o = type_hash.Get_by(Bry_.new_u8(s));
   if (o == null)
     return Itm_cmd; // default to cmd as per early behaviour; handles mistaken "--app_mode wrong"
   int tid = ((Int_obj_val) o).Val();
   switch (tid) {
     case Tid_cmd:
       return Itm_cmd;
     case Tid_gui:
       return Itm_gui;
     case Tid_http:
       return Itm_http;
     case Tid_tcp:
       return Itm_tcp;
     case Tid_file:
       return Itm_file;
     default:
       throw Err_.new_unhandled(tid);
   }
 }
Exemple #3
0
  public static Xot_defn Get_prototype(int id) {
    switch (id) {
      case Xol_kwd_grp_.Id_utc_year:
      case Xol_kwd_grp_.Id_utc_month_int_len2:
      case Xol_kwd_grp_.Id_utc_month_int:
      case Xol_kwd_grp_.Id_utc_day_int_len2:
      case Xol_kwd_grp_.Id_utc_day_int:
      case Xol_kwd_grp_.Id_utc_hour:
      case Xol_kwd_grp_.Id_utc_time:
      case Xol_kwd_grp_.Id_utc_timestamp:
      case Xol_kwd_grp_.Id_utc_week:
      case Xol_kwd_grp_.Id_utc_dow:
        return Pft_func_date_int.Utc;
      case Xol_kwd_grp_.Id_utc_month_abrv:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_utc,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_abrv_jan - Int_.Base1);
      case Xol_kwd_grp_.Id_utc_month_name:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_utc,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_name_january - Int_.Base1);
      case Xol_kwd_grp_.Id_utc_month_gen:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_utc,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_gen_january - Int_.Base1);
      case Xol_kwd_grp_.Id_utc_day_name:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_utc,
            DateAdp_.SegIdx_dayOfWeek,
            Xol_msg_itm_.Id_dte_dow_name_sunday);

      case Xol_kwd_grp_.Id_lcl_year:
      case Xol_kwd_grp_.Id_lcl_month_int_len2:
      case Xol_kwd_grp_.Id_lcl_month_int:
      case Xol_kwd_grp_.Id_lcl_day_int_len2:
      case Xol_kwd_grp_.Id_lcl_day_int:
      case Xol_kwd_grp_.Id_lcl_hour:
      case Xol_kwd_grp_.Id_lcl_time:
      case Xol_kwd_grp_.Id_lcl_timestamp:
      case Xol_kwd_grp_.Id_lcl_week:
      case Xol_kwd_grp_.Id_lcl_dow:
        return Pft_func_date_int.Lcl;
      case Xol_kwd_grp_.Id_lcl_month_abrv:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_lcl,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_abrv_jan - Int_.Base1);
      case Xol_kwd_grp_.Id_lcl_month_name:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_lcl,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_name_january - Int_.Base1);
      case Xol_kwd_grp_.Id_lcl_month_gen:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_lcl,
            DateAdp_.SegIdx_month,
            Xol_msg_itm_.Id_dte_month_gen_january - Int_.Base1);
      case Xol_kwd_grp_.Id_lcl_day_name:
        return new Pft_func_date_name(
            -1,
            Pft_func_date_int.Date_tid_lcl,
            DateAdp_.SegIdx_dayOfWeek,
            Xol_msg_itm_.Id_dte_dow_name_sunday);

      case Xol_kwd_grp_.Id_rev_year:
      case Xol_kwd_grp_.Id_rev_month_int_len2:
      case Xol_kwd_grp_.Id_rev_month_int:
      case Xol_kwd_grp_.Id_rev_day_int_len2:
      case Xol_kwd_grp_.Id_rev_day_int:
      case Xol_kwd_grp_.Id_rev_timestamp:
        return Pft_func_date_int.Rev;

      case Xol_kwd_grp_.Id_ns_num:
      case Xol_kwd_grp_.Id_ns_txt:
      case Xol_kwd_grp_.Id_ns_url:
      case Xol_kwd_grp_.Id_ns_subj_txt:
      case Xol_kwd_grp_.Id_ns_subj_url:
      case Xol_kwd_grp_.Id_ns_talk_txt:
      case Xol_kwd_grp_.Id_ns_talk_url:
      case Xol_kwd_grp_.Id_ttl_full_txt:
      case Xol_kwd_grp_.Id_ttl_full_url:
      case Xol_kwd_grp_.Id_ttl_page_txt:
      case Xol_kwd_grp_.Id_ttl_base_txt:
      case Xol_kwd_grp_.Id_ttl_page_url:
      case Xol_kwd_grp_.Id_ttl_base_url:
      case Xol_kwd_grp_.Id_ttl_leaf_txt:
      case Xol_kwd_grp_.Id_ttl_leaf_url:
      case Xol_kwd_grp_.Id_ttl_subj_txt:
      case Xol_kwd_grp_.Id_ttl_subj_url:
      case Xol_kwd_grp_.Id_ttl_talk_txt:
      case Xol_kwd_grp_.Id_ttl_talk_url:
        return Pfunc_ttl.Instance;

      case Xol_kwd_grp_.Id_site_sitename:
      case Xol_kwd_grp_.Id_site_servername:
      case Xol_kwd_grp_.Id_site_server:
      case Xol_kwd_grp_.Id_site_articlepath:
      case Xol_kwd_grp_.Id_site_scriptpath:
      case Xol_kwd_grp_.Id_site_stylepath:
      case Xol_kwd_grp_.Id_site_contentlanguage:
      case Xol_kwd_grp_.Id_site_directionmark:
      case Xol_kwd_grp_.Id_site_currentversion:
        return Pfunc_wiki_props.Instance;

      case Xol_kwd_grp_.Id_num_pages:
      case Xol_kwd_grp_.Id_num_articles:
      case Xol_kwd_grp_.Id_num_files:
      case Xol_kwd_grp_.Id_num_edits:
      case Xol_kwd_grp_.Id_num_views:
      case Xol_kwd_grp_.Id_num_users:
      case Xol_kwd_grp_.Id_num_users_active:
      case Xol_kwd_grp_.Id_num_admins:
        return Pfunc_wiki_stats.Instance;

      case Xol_kwd_grp_.Id_page_id:
      case Xol_kwd_grp_.Id_rev_id:
      case Xol_kwd_grp_.Id_rev_pagesize:
      case Xol_kwd_grp_.Id_rev_revisionsize:
      case Xol_kwd_grp_.Id_rev_user:
      case Xol_kwd_grp_.Id_rev_protectionexpiry:
      case Xol_kwd_grp_.Id_rev_protectionlevel:
        return Pfunc_rev_props.Instance;
      case Xol_kwd_grp_.Id_page_displaytitle:
        return Pfunc_displaytitle.Instance;
      case Xol_kwd_grp_.Id_page_defaultsort:
        return Pfunc_defaultsort.Instance;
      case Xol_kwd_grp_.Id_noeditsection:
        return Pfunc_noeditsection.Instance;
      case Xol_kwd_grp_.Id_site_pagesincategory:
        return Pfunc_pagesincategory.Instance;

      case Xol_kwd_grp_.Id_url_ns:
        return new Pfunc_ns(false);
      case Xol_kwd_grp_.Id_url_nse:
        return new Pfunc_ns(true);
      case Xol_kwd_grp_.Id_url_urlencode:
        return new Pfunc_urlencode();
      case Xol_kwd_grp_.Id_str_lc:
        return new Pfunc_case(Xol_lang_itm.Tid_lower, false);
      case Xol_kwd_grp_.Id_str_lcfirst:
        return new Pfunc_case(Xol_lang_itm.Tid_lower, true);
      case Xol_kwd_grp_.Id_str_uc:
        return new Pfunc_case(Xol_lang_itm.Tid_upper, false);
      case Xol_kwd_grp_.Id_str_ucfirst:
        return new Pfunc_case(Xol_lang_itm.Tid_upper, true);
      case Xol_kwd_grp_.Id_str_padleft:
        return new Pfunc_pad(Xol_kwd_grp_.Id_str_padleft, false);
      case Xol_kwd_grp_.Id_str_padright:
        return new Pfunc_pad(Xol_kwd_grp_.Id_str_padright, true);
      case Xol_kwd_grp_.Id_str_formatnum:
        return new Pf_formatnum();
      case Xol_kwd_grp_.Id_str_formatdate:
        return new Pft_func_formatdate();
      case Xol_kwd_grp_.Id_url_localurl:
        return new Pfunc_urlfunc(Xol_kwd_grp_.Id_url_localurl, Pfunc_urlfunc.Tid_local, false);
      case Xol_kwd_grp_.Id_url_localurle:
        return new Pfunc_urlfunc(Xol_kwd_grp_.Id_url_localurle, Pfunc_urlfunc.Tid_local, true);
      case Xol_kwd_grp_.Id_url_fullurl:
        return new Pfunc_urlfunc(Xol_kwd_grp_.Id_url_fullurl, Pfunc_urlfunc.Tid_full, false);
      case Xol_kwd_grp_.Id_url_fullurle:
        return new Pfunc_urlfunc(Xol_kwd_grp_.Id_url_fullurle, Pfunc_urlfunc.Tid_full, true);
      case Xol_kwd_grp_.Id_url_canonicalurl:
        return new Pfunc_urlfunc(
            Xol_kwd_grp_.Id_url_canonicalurl, Pfunc_urlfunc.Tid_canonical, false);
      case Xol_kwd_grp_.Id_url_canonicalurle:
        return new Pfunc_urlfunc(
            Xol_kwd_grp_.Id_url_canonicalurle, Pfunc_urlfunc.Tid_canonical, false);
      case Xol_kwd_grp_.Id_url_filepath:
        return new Pfunc_filepath();
      case Xol_kwd_grp_.Id_url_anchorencode:
        return new Pfunc_anchorencode();
      case Xol_kwd_grp_.Id_strx_len:
        return new Pfunc_len();
      case Xol_kwd_grp_.Id_strx_pos:
        return new Pfunc_pos();
      case Xol_kwd_grp_.Id_strx_rpos:
        return new Pfunc_rpos();
      case Xol_kwd_grp_.Id_strx_sub:
        return new Pfunc_sub();
      case Xol_kwd_grp_.Id_strx_count:
        return new Pfunc_count();
      case Xol_kwd_grp_.Id_strx_replace:
        return new Pfunc_replace();
      case Xol_kwd_grp_.Id_strx_explode:
        return new Pfunc_explode();
      case Xol_kwd_grp_.Id_strx_urldecode:
        return new Pfunc_urldecode();

      case Xol_kwd_grp_.Id_i18n_plural:
        return new Pfunc_plural();
      case Xol_kwd_grp_.Id_i18n_language:
        return new Pfunc_language();
      case Xol_kwd_grp_.Id_i18n_int:
        return new Pfunc_int();
      case Xol_kwd_grp_.Id_i18n_grammar:
        return new Pfunc_grammar();
      case Xol_kwd_grp_.Id_i18n_gender:
        return new Pfunc_gender();
      case Xol_kwd_grp_.Id_misc_tag:
        return new Pfunc_tag();

      case Xol_kwd_grp_.Id_xtn_expr:
        return new gplx.xowa.xtns.pfuncs.exprs.Pfunc_expr();
      case Xol_kwd_grp_.Id_xtn_if:
        return new Pfunc_if();
      case Xol_kwd_grp_.Id_xtn_ifeq:
        return new Pfunc_ifeq();
      case Xol_kwd_grp_.Id_xtn_iferror:
        return new Pfunc_iferror();
      case Xol_kwd_grp_.Id_xtn_ifexpr:
        return new Pfunc_ifexpr();
      case Xol_kwd_grp_.Id_xtn_ifexist:
        return new Pfunc_ifexist();
      case Xol_kwd_grp_.Id_xtn_rel2abs:
        return new Pfunc_rel2abs();
      case Xol_kwd_grp_.Id_xtn_switch:
        return new Pfunc_switch();
      case Xol_kwd_grp_.Id_xtn_time:
        return Pft_func_time._Utc;
      case Xol_kwd_grp_.Id_xtn_timel:
        return Pft_func_time._Lcl;
      case Xol_kwd_grp_.Id_xtn_titleparts:
        return new Pfunc_titleparts();

      case Xol_kwd_grp_.Id_subst:
      case Xol_kwd_grp_.Id_safesubst:
      case Xol_kwd_grp_.Id_msg:
      case Xol_kwd_grp_.Id_msgnw:
      case Xol_kwd_grp_.Id_raw:
        return new Xot_defn_subst((byte) id, Bry_.Empty);

      case Xol_kwd_grp_.Id_xowa_dbg:
        return new Xop_xowa_dbg();
      case Xol_kwd_grp_.Id_xowa:
        return new gplx.xowa.xtns.xowa_cmds.Xop_xowa_func();
      case Xol_kwd_grp_.Id_xtn_geodata_coordinates:
        return gplx.xowa.xtns.geodata.Geo_coordinates_func.Instance;

      case Xol_kwd_grp_.Id_lst:
        return gplx.xowa.xtns.lst.Lst_pfunc_lst.Prime;
      case Xol_kwd_grp_.Id_lstx:
        return gplx.xowa.xtns.lst.Lst_pfunc_lstx.Prime;
      case Xol_kwd_grp_.Id_lsth:
        return gplx.xowa.xtns.lst.Lst_pfunc_lsth.Prime;

      case Xol_kwd_grp_.Id_invoke:
        return new gplx.xowa.xtns.scribunto.Scrib_invoke_func();
      case Xol_kwd_grp_.Id_pagebanner:
        return new gplx.xowa.xtns.pagebanners.Pgbnr_func();
      case Xol_kwd_grp_.Id_new_window_link:
        return new gplx.xowa.xtns.new_window_links.New_window_link_func();

      case Xol_kwd_grp_.Id_property:
        return new gplx.xowa.xtns.wbases.pfuncs.Wdata_pf_property();
      case Xol_kwd_grp_.Id_noexternallanglinks:
        return new gplx.xowa.xtns.wbases.pfuncs.Wdata_pf_noExternalLangLinks();
      case Xol_kwd_grp_.Id_wbreponame:
        return new gplx.xowa.xtns.wbases.pfuncs.Wdata_pf_wbreponame();

      case Xol_kwd_grp_.Id_mapSources_deg2dd:
        return gplx.xowa.xtns.mapSources.Map_deg2dd_func.Instance;
      case Xol_kwd_grp_.Id_mapSources_dd2dms:
        return gplx.xowa.xtns.mapSources.Map_dd2dms_func.Instance;
      case Xol_kwd_grp_.Id_mapSources_geoLink:
        return gplx.xowa.xtns.mapSources.Map_geolink_func.Instance;

      case Xol_kwd_grp_.Id_geoCrumbs_isin:
        return gplx.xowa.xtns.geoCrumbs.Geoc_isin_func.Instance;

      case Xol_kwd_grp_.Id_relatedArticles:
        return gplx.xowa.xtns.relatedArticles.Articles_func.Instance;
      case Xol_kwd_grp_.Id_insider:
        return gplx.xowa.xtns.insiders.Insider_func.Instance;

      case Xol_kwd_grp_.Id_massMessage_target:
        return gplx.xowa.xtns.massMessage.Message_target_func.Instance;
      case Xol_kwd_grp_.Id_categorytree:
        return gplx.xowa.xtns.categorytrees.Categorytree_func.Instance;

      case Xol_kwd_grp_.Id_pendingChangeLevel:
        return gplx.xowa.xtns.flaggedRevs.Pending_change_level_func.Instance;
      case Xol_kwd_grp_.Id_pagesUsingPendingChanges:
        return gplx.xowa.xtns.flaggedRevs.Pages_using_pending_changes_func.Instance;

      case Xol_kwd_grp_.Id_cascadingSources:
        return new Pf_func_noop(id);
      case Xol_kwd_grp_.Id_bang:
        return Pf_func_bang.Instance;
      default:
        throw Err_.new_unhandled(id);
    }
  }