<commit_before>/*************************************************************
*
* BikeDemo - exercise bike demonstration
* scenery
*
* "xpth.h" - data types and function proto-
* types related to the W3C's XML Path Lan-
* guage (X-PATH) 3.0, a mechanis by which
* an XML node may be located via a "path
* expression" selative to another node
*
* Copyright (C) 2007-2013, <NAME>,
* All rights reserved
*
**************************************************************/

#ifndef __BD_XPATH
#define __BD_XPATH

#ifdef __cplusplus
extern "C" {
#endif

#include <bikedemo/allocs.h>
#include <bikedemo/log.h>
#include <bikedemo/xml.h>

/* "bdxp_op_precs" enumeration -
 * the possible operator precede-
 * nces that mapy bre found in an
 * X-PATH expression */
enum bdxp_op_precs {

    bdxp_op_prec_cma,     /* "," */
    bdxp_op_prec_for,     /* "for","let",
                           * "some", "every",
                           * "if" */
    bdxp_op_prec_lor,     /* "logical or" */
    bdxp_op_prec_to,      /* "to" */
    bdxp_op_prec_rel,     /* "ne", "lt, "le",
                           * "gt" ge", "=",
                           * "!=", "<", "<=",
                           * ">" ">=", "is",
                           * "<<", ">>" */
    bdxp_op_prec_lor,     /* "||" */
    bdxp_op_prec_to,      /* "to" */
    bdxp_op_prec_add,     /* "+", "=" (binary) */
    bdxp_op_prec_div,     /* "div", "idiv",
                           * "mod" */
    bdxp_op_prec_unn,     /* "union", "|" */
    bdxp_op_prec_isct,    /* "intersect",
                           * "except" */
    bdxp_op_prec_isct,    /* "intersect" */
    bdxp_op_prec_instnce, /* "instance of" */
    bdxp_op_prec_trt,     /* "treat as" */
    bdxp_op_prec_cstble,  /* "castable as" */
    bdxp_op_prec_cst,     /* "cast as" */
    bdxp_op_prec_pos,     /* "+" (unary) */
    bdxp_op_prec_map,     /* "!" (map) */
    bdxp_op_prec_pth,     /* "/", "//" */
    bdxp_op_prec_arry     /* "[]" */
};

/* "bdxp_ops" enumeration - the pos-
 *sible operators that mapy be found
 * in an X-PATH expression */
enum bdxp_ops {

    bdxp_op_cma,
    bdxp_op_for,
    bdxp_op_let,
    bdxp_op_some,
    bdxp_op_every,
    bdxp_op_if,
    bdxp_op_or,
    bdxp_op_and,
    bdxp_op_seq,
    bdxp_op_sne,
    bdxp_op_slt,
    bdxp_op_sle,
    bdxp_op_sgt,
    bdxp_op_sge,
    bdxp_op_is,
    bdxp_op_lsh,
    bdxp_op_rsh,
    bdxp_op_lor,
    bdxp_op_to,
    bdxp_op_add,
    bdxp_op_mul,
    bdxp_op_div,
    bdxp_op_idiv,
    bdxp_op_mod,
    bdxp_op_unn,
    bdxp_op_sunn,
    bdxp_op_isct,
    bdxp_op_excpt,
    bdxp_op_instnce,
    bdxp_op_trt,
    bdxp_op_cstble,
    bdxp_op_cst,
    bdxp_op_pos,
    bdxp_op_mp,
    bdxp_op_pth,
    bdxp_op_arry
};

/* bdxp_nts" the non-terminals
 * of the X-PATH fgrammar */
enum bdxp_nts {

    bdxp_nt_xpth,
    bdxp_nt_expr,
    bdxp_nt_expr_list,
    bdxp_nt_for_expr,
    bdxp_nt_var_nme,
    bdxp_nt_qntfd_expr,
    bdxp_nt_let_expr,
    bdxp_nt_smple_for_clse,
    bdxp_nt_smple_for_bndng,
    bdxp_nt_smple_let_clse,
    bdxp_nt_smple_let_bndng,
    bdxp_nt_if_expr,
    bdxp_nt_or_expr,
    bdxp_nt_and_expr,
    bdxp_nt_expr_sngle,
    bdxp_nt_prm,
    bdxp_nt_cma_prm,
    bdxp_nt_cma_prm_list,
    bdxp_nt_gnrl_comp,
    bdxp_nt_val_comp,
    bdxp_nt_nde_comp,
    bdxp_nt_smple_map_expr,
    bdxp_nt_pth_expr,
    bdxp_nt_rel_pth_expr,
    bdxp_nt_step_expr,
    bdxp_nt_rel_step_expr,
    bdxp_nt_axis_step,
    bdxp_nt_fwd_axis,
    bdxp_nt_fwd_step,
    bdxp_nt_abbrv_fwd_step,
    bdxp_nt_rvse_step,
    bdxp_nt_rvse_axis,
    bdxp_nt_abbrv_rvse_step,
    bdxp_nt_nde_tst,
    bdxp_nt_nme_tst,
    bdxp_nt_wldcrd,
    bdxp_nt_arg,
    bdxp_nt_arg_list,
    bdxp_nt_arg_plcehldr,
    bdxp_nt_pred,
    bdxp_nt_pred_list,
    bdxp_nt_lit,
    bdxp_nt_nmrc_lit,
    bdxp_nt_vr_nme,
    bdxp_nt_vr_rf,
    bdxp_nt_fn_itm_expr,
    bdxp_nt_fn_rf,
    bdxp_nt_inln_fn_expr,
    bdxp_nt_sngle_type,
    bdxp_nt_type_dcl,
    bdxp_nt_seq_type,
    bdxp_nt_ocrrnce_indctr,
    bdxp_nt_itm_type,
    bdxp_nt_atmc_or_unn_type,
    bdxp_nt_knd_tst,
    bdxp_nt_any_knd_tst,
    bdxp_nt_doc_tst,
    bdxp_nt_elem_tst,
    bdxp_nt_txt_tst,
    bdxp_nt_cmmt_tst,
    bdxp_nt_ns_tst,
    bdxp_nt_pi_tst,
    bdxp_nt_attr_tst,
    bdxp_nt_attr_nme_or_wc,
    bdxp_nt_schma_attr_tst,
    bdxp_nt_elem_dcl,
    bdxp_nt_elem_nme,
    bdxp_nt_attr_nme,
    bdxp_nt_smple_type_nme,
    bdxp_nt_type_nme,
    bdxp_nt_fn_tst,
    bdxp_nt_any_fn_tst,
    bdxp_nt_typd_fn_tst,
    bdxp_nt_prn_itm_type
};

/* "bdxp_toks" - the tokens ret-
 * urned from the XPATH lexical
 * analyser */
 enum bdxp_toks {

    bdxp_tok_id,                         /* identifier "$id" */
    bdxp_tok_str,                        /* string "'abc'" */
    bdxp_tok_num,                        /* number "[0-9]+" */
    bdxp_tok_dble,                       /* floating point
                                          * number "[0-9]+[eE].
	                                      * [0-9]+[0-9]+" */
    bdxp_tok_fsl,                        /* forward slash "/" */
    bdxp_tok_dfsl,                       /* double
                                          * forward slash "//" */
    bdxp_tok_prnt,                       /* parent ".." */
    bdxp_tok_ctx,                        /* context node "." */
    bdxp_tok_ast,                        /* asterisk "*" */
    bdxp_tok_cln,                        /* colon ":" */
    bdxp_tok_qstn,                       /* question mark "?" */
    bdxp_tok_not,                        /* not "!" */
    bdxp_tok_hsh,                        /* hash "#" */
    bdxp_tok_eq,                         /* equal to "=" */
    bdxp_tok_ne,                         /* not equal to "!=" */
    bdxp_tok_lt,                         /* less than "<" */
    bdxp_tok_le,                         /* less than or
                                          * equal to "<=" */
    bdxp_tok_gt,                         /* greater than "<" */
    bdxp_tok_ge,                         /* greater than
                                          * or equal to "<=" */
    bdxp_tok_axis,                       /* axis "::" */
    bdxp_tok_lsh,                        /* left shift "<<" */
    bdxp_tok_rsh,                        /* right shift ">>" */
    bdxp_tok_cma,                        /* comma "," */
    bdxp_tok_add,                        /* add "+" */
    bdxp_tok_sub,                        /* subtract "-" */
    bdxp_tok_scat,                       /* string
                                          * concatenate "||" */<commit_msg>Update xpth.h<commit_after>/*************************************************************
*
* BikeDemo - exercise bike demonstration
* scenery
*
* "xpth.h" - data types and function proto-
* types related to the W3C's XML Path Lan-
* guage (X-PATH) 3.0, a mechanis by which
* an XML node may be located via a "path
* expression" selative to another node
*
* Copyright (C) 2007-2013, <NAME>,
* All rights reserved
*
**************************************************************/

#ifndef __BD_XPATH
#define __BD_XPATH

#ifdef __cplusplus
extern "C" {
#endif

#include <bikedemo/allocs.h>
#include <bikedemo/log.h>
#include <bikedemo/xml.h>

/* "bdxp_op_precs" enumeration -
 * the possible operator precede-
 * nces that mapy bre found in an
 * X-PATH expression */
enum bdxp_op_precs {

    bdxp_op_prec_cma,     /* "," */
    bdxp_op_prec_for,     /* "for","let",
                           * "some", "every",
                           * "if" */
    bdxp_op_prec_lor,     /* "logical or" */
    bdxp_op_prec_to,      /* "to" */
    bdxp_op_prec_rel,     /* "ne", "lt, "le",
                           * "gt" ge", "=",
                           * "!=", "<", "<=",
                           * ">" ">=", "is",
                           * "<<", ">>" */
    bdxp_op_prec_lor,     /* "||" */
    bdxp_op_prec_to,      /* "to" */
    bdxp_op_prec_add,     /* "+", "=" (binary) */
    bdxp_op_prec_div,     /* "div", "idiv",
                           * "mod" */
    bdxp_op_prec_unn,     /* "union", "|" */
    bdxp_op_prec_isct,    /* "intersect",
                           * "except" */
    bdxp_op_prec_isct,    /* "intersect" */
    bdxp_op_prec_instnce, /* "instance of" */
    bdxp_op_prec_trt,     /* "treat as" */
    bdxp_op_prec_cstble,  /* "castable as" */
    bdxp_op_prec_cst,     /* "cast as" */
    bdxp_op_prec_pos,     /* "+" (unary) */
    bdxp_op_prec_map,     /* "!" (map) */
    bdxp_op_prec_pth,     /* "/", "//" */
    bdxp_op_prec_arry     /* "[]" */
};

/* "bdxp_ops" enumeration - the pos-
 *sible operators that mapy be found
 * in an X-PATH expression */
enum bdxp_ops {

    bdxp_op_cma,
    bdxp_op_for,
    bdxp_op_let,
    bdxp_op_some,
    bdxp_op_every,
    bdxp_op_if,
    bdxp_op_or,
    bdxp_op_and,
    bdxp_op_seq,
    bdxp_op_sne,
    bdxp_op_slt,
    bdxp_op_sle,
    bdxp_op_sgt,
    bdxp_op_sge,
    bdxp_op_is,
    bdxp_op_lsh,
    bdxp_op_rsh,
    bdxp_op_lor,
    bdxp_op_to,
    bdxp_op_add,
    bdxp_op_mul,
    bdxp_op_div,
    bdxp_op_idiv,
    bdxp_op_mod,
    bdxp_op_unn,
    bdxp_op_sunn,
    bdxp_op_isct,
    bdxp_op_excpt,
    bdxp_op_instnce,
    bdxp_op_trt,
    bdxp_op_cstble,
    bdxp_op_cst,
    bdxp_op_pos,
    bdxp_op_mp,
    bdxp_op_rpth,
    bdxp_op_ipth,
    bdxp_op_arry
};

/* bdxp_nts" the non-terminals
 * of the X-PATH grammar */
enum bdxp_nts {

    bdxp_nt_xpth,
    bdxp_nt_expr,
    bdxp_nt_expr_list,
    bdxp_nt_for_expr,
    bdxp_nt_var_nme,
    bdxp_nt_qntfd_expr,
    bdxp_nt_let_expr,
    bdxp_nt_smple_for_clse,
    bdxp_nt_smple_for_bndng,
    bdxp_nt_smple_let_clse,
    bdxp_nt_smple_let_bndng,
    bdxp_nt_if_expr,
    bdxp_nt_or_expr,
    bdxp_nt_and_expr,
    bdxp_nt_expr_sngle,
    bdxp_nt_prm,
    bdxp_nt_gnrl_comp,
    bdxp_nt_val_comp,
    bdxp_nt_nde_comp,
    bdxp_nt_smple_map_expr,
    bdxp_nt_pth_expr,
    bdxp_nt_rel_pth_expr,
    bdxp_nt_step_expr,
    bdxp_nt_rel_step_expr,
    bdxp_nt_axis_step,
    bdxp_nt_fwd_axis,
    bdxp_nt_fwd_step,
    bdxp_nt_abbrv_fwd_step,
    bdxp_nt_rvse_step,
    bdxp_nt_rvse_axis,
    bdxp_nt_abbrv_rvse_step,
    bdxp_nt_nde_tst,
    bdxp_nt_nme_tst,
    bdxp_nt_wldcrd,
    bdxp_nt_arg,
    bdxp_nt_arg_list,
    bdxp_nt_arg_plcehldr,
    bdxp_nt_pred,
    bdxp_nt_pred_list,
    bdxp_nt_lit,
    bdxp_nt_nmrc_lit,
    bdxp_nt_vr_nme,
    bdxp_nt_vr_rf,
    bdxp_nt_fn_itm_expr,
    bdxp_nt_fn_rf,
    bdxp_nt_inln_fn_expr,
    bdxp_nt_sngle_type,
    bdxp_nt_type_dcl,
    bdxp_nt_seq_type,
    bdxp_nt_ocrrnce_indctr,
    bdxp_nt_itm_type,
    bdxp_nt_atmc_or_unn_type,
    bdxp_nt_knd_tst,
    bdxp_nt_any_knd_tst,
    bdxp_nt_doc_tst,
    bdxp_nt_elem_tst,
    bdxp_nt_txt_tst,
    bdxp_nt_cmmt_tst,
    bdxp_nt_ns_tst,
    bdxp_nt_pi_tst,
    bdxp_nt_attr_tst,
    bdxp_nt_attr_nme_or_wc,
    bdxp_nt_schma_attr_tst,
    bdxp_nt_elem_dcl,
    bdxp_nt_elem_nme,
    bdxp_nt_attr_nme,
    bdxp_nt_smple_type_nme,
    bdxp_nt_type_nme,
    bdxp_nt_fn_tst,
    bdxp_nt_any_fn_tst,
    bdxp_nt_typd_fn_tst,
    bdxp_nt_prn_itm_type
};

/* "bdxp_toks" - the tokens ret-
 * urned from the XPATH lexical
 * analyser */
 enum bdxp_toks {

    bdxp_tok_id,                         /* identifier "$id" */
    bdxp_tok_str,                        /* string "'abc'" */
    bdxp_tok_int,                        /* integer "[0-9]+" */
    bdxp_tok_dec,                        /* decimal
                                          * number "[0-9]+" */
    bdxp_tok_dble,                       /* floating point
                                          * number "[0-9]+[eE].
                                          * [0-9]+[0-9]+" */
    bdxp_tok_uri,                        /* URI
                                          * "http://abc.com" */
    bdxp_tok_brced,                      /* braced URI
                                          * "Q{uri}" */
    bdxp_tok_fsl,                        /* forward slash "/" */
    bdxp_tok_dfsl,                       /* double
                                          * forward slash "//" */
    bdxp_tok_prnt,                       /* parent ".." */
    bdxp_tok_ctx,                        /* context node "." */
    bdxp_tok_ast,                        /* asterisk "*" */
    bdxp_tok_cln,                        /* colon ":" */
    bdxp_tok_qstn,                       /* question mark "?" */
    bdxp_tok_not,                        /* not "!" */
    bdxp_tok_hsh,                        /* hash "#" */
    bdxp_tok_eq,                         /* equal to "=" */
    bdxp_tok_ne,                         /* not equal to "!=" */
    bdxp_tok_lt,                         /* less than "<" */
    bdxp_tok_le,                         /* less than or
                                          * equal to "<=" */
    bdxp_tok_gt,                         /* greater than "<" */
    bdxp_tok_ge,                         /* greater than
                                          * or equal to "<=" */
    bdxp_tok_axis,                       /* axis "::" */
    bdxp_tok_lsh,                        /* left shift "<<" */
    bdxp_tok_rsh,                        /* right shift ">>" */
    bdxp_tok_cma,                        /* comma "," */
    bdxp_tok_add,                        /* add "+" */
    bdxp_tok_sub,                        /* subtract "-" */
    bdxp_tok_scat,                       /* string
                                          * concatenate "||" */
{'fraction_non_alphanumeric': 0.12644794858381286, 'fraction_numerical': 0.0029893132052910844, 'mean_word_length': 1.5873936581593193, 'pattern_counts': {'":': 4, '<': 31, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6924053', 'n_tokens_mistral': 5627, 'n_tokens_neox': 5500, 'n_words': 729}