lassy-xpath
Advanced tools
Comparing version 0.2.3 to 0.3.0
export declare const DefaultMacros = "## macro's for PaQu\n## mostly by Gertjan van Noord\n## comments welcome at g.j.m.van.noord@rug.nl\n##\n## any macro definition that is a conjunction or disjunction\n## should be placed in () brackets in order to avoid counter-intuitive\n## results\n##\n## any macro definition that starts with //node should not\n## have outer () brackets\n\nPQ_b = \"\"\" number(@begin) \"\"\"\nPQ_e = \"\"\" number(@end) \"\"\"\nPQ_i = \"\"\" number(@index) \"\"\"\n\nPQ_headrel = \"\"\"\n ( @rel=\"hd\"\n or\n @rel=\"cmp\"\n or\n @rel=\"mwp\"\n or\n @rel=\"crd\"\n or\n @rel=\"rhd\"\n or\n @rel=\"whd\"\n or\n @rel=\"nucl\"\n or\n @rel=\"dp\"\n ) \"\"\"\n\nPQ_begin_of_head = \"\"\" node[%PQ_headrel%]/%PQ_b% \"\"\"\nPQ_end_of_head = \"\"\" node[%PQ_headrel%]/%PQ_e% \"\"\"\n\nPQ_begin_of_hd = \"\"\" node[@rel=\"hd\"]/%PQ_b% \"\"\"\nPQ_end_of_hd = \"\"\" node[@rel=\"hd\"]/%PQ_e% \"\"\"\n\nPQ_precedes_head_of_smain = \"\"\"\n ( ancestor::node[@cat=\"smain\"]/node[@rel=\"hd\"]/%PQ_b% > %PQ_begin_of_head%\n or\n ( ancestor::node[@cat=\"smain\"]/node[@rel=\"hd\"]/%PQ_b% > %PQ_b%\n and\n not(node[%PQ_headrel%])\n )\n ) \"\"\"\n\nPQ_vorfeld = \"\"\"\n ( %PQ_precedes_head_of_smain%\n and\n not(parent::node[%PQ_precedes_head_of_smain%])\n ) \"\"\"\n\nPQ_single_name = \"\"\"\n ( @ntype = 'eigen'\n or\n @postag='SPEC(deeleigen)'\n ) \"\"\"\n\nPQ_multi_name = \"\"\"\n ( @cat='mwu'\n and\n node[@rel='mwp'\n and\n %PQ_single_name%\n ]\n ) \"\"\"\n\nPQ_name = \"\"\"\n ( %PQ_single_name%\n or\n %PQ_multi_name%\n ) \"\"\"\n\nPQ_name_phrase= \"\"\"\n ( %PQ_name%\n or\n node[@rel=\"hd\"\n and\n %PQ_name%\n ]\n ) \"\"\"\n\nPQ_vp = \"\"\"\n ( @cat=\"inf\"\n or\n @cat=\"ti\"\n or\n @cat=\"ssub\"\n or\n @cat=\"oti\"\n or\n @cat=\"ppart\"\n ) \"\"\"\n\nPQ_s = \"\"\"\n ( %PQ_vp%\n or\n @cat=\"smain\"\n or\n @cat=\"sv1\"\n ) \"\"\"\n\nPQ_follows_head_of_vp = \"\"\"\n ( not(@cat=\"inf\" or @cat=\"ppart\" or @rel=\"hd\" or @rel=\"svp\")\n and\n ( ancestor::node[%PQ_vp%]/node[@rel=\"hd\"]/%PQ_b% < %PQ_begin_of_head%\n or\n ancestor::node[%PQ_vp%]/node[@rel=\"hd\"]/%PQ_b% < %PQ_b% and not(node[%PQ_headrel%])\n )\n ) \"\"\"\n\nPQ_nachfeld = \"\"\"\n ( %PQ_follows_head_of_vp%\n and\n not(parent::node[%PQ_follows_head_of_vp%])\n ) \"\"\"\n\nPQ_nachfeld_node = \"\"\" //node[%PQ_nachfeld%] \"\"\"\n\nPQ_dep_node_in_verbcluster = \"\"\"\n ( @rel=\"vc\"\n and\n ( @cat=\"ti\" or @cat=\"inf\" or @cat=\"ppart\" )\n and\n node/%PQ_b% < ../node[@rel=\"hd\"\n and\n @pt=\"ww\"\n and\n not(../@cat=\"smain\" or ../@cat=\"sv1\")\n ]/%PQ_b%\n ) \"\"\"\n\nPQ_dep_verb_in_verbcluster = \"\"\"\n ( ( @rel=\"hd\"\n and\n @pt=\"ww\"\n and parent::node[%PQ_dep_node_in_verbcluster%]\n )\n or\n ( @rel=\"cmp\"\n and\n @lemma=\"te\"\n and\n parent::node[%PQ_dep_node_in_verbcluster%]\n )\n or\n ( @rel=\"hd\"\n and\n @pt=\"ww\"\n and parent::node[parent::node[%PQ_dep_node_in_verbcluster%]]\n )\n ) \"\"\"\n\nPQ_head_verb_in_verbcluster = \"\"\"\n ( not(../@cat=\"smain\"\n or\n ../@cat=\"sv1\"\n )\n and\n @rel=\"hd\"\n and\n ../node[%PQ_dep_node_in_verbcluster%]\n ) \"\"\"\n\nPQ_verb_in_verbcluster = \"\"\"\n //node[%PQ_dep_verb_in_verbcluster%\n or\n %PQ_head_verb_in_verbcluster%\n ] \"\"\"\n\n## omdat ik jou gezien heb\n##\n## this query is slightly too permissive in that it will\n## find topicalized participles as well\n## (cases such as \"Gestart zal worden met een introductie\")\nPQ_groen = \"\"\"\n //node[@rel=\"hd\"\n and\n @wvorm=\"vd\"\n and\n %PQ_b% < ../../node[@rel=\"hd\" and @pt=\"ww\"]/%PQ_b%\n and\n not( ../../@cat=\"smain\"\n or\n ../../@cat=\"sv1\"\n )\n ] \"\"\"\n\n## verwacht werd dat hij komt\nPQ_topicalized_participle = \"\"\"\n //node[@wvorm=\"vd\"\n and\n @rel=\"hd\"\n and\n ../@rel=\"vc\"\n and\n %PQ_b% = ancestor::node[@cat=\"smain\"]/%PQ_b%\n ] \"\"\"\n\n## omdat ik jou heb gezien\nPQ_rood = \"\"\"\n //node[@rel=\"hd\"\n and\n @wvorm=\"vd\"\n and\n %PQ_b% > ../../node[@rel=\"hd\" and @pt=\"ww\"]/%PQ_b%\n and\n not( ../../@cat=\"smain\"\n or\n ../../@cat=\"sv1\"\n )\n ] \"\"\"\n\n## this query depends on co-indexing and therefore\n## does not work for the CGN treebank\n##\n## \"dat hij hen hun eigen graf zag graven\"\nPQ_cross_serial_verbcluster = \"\"\"\n //node[%PQ_dep_node_in_verbcluster%\n and\n @cat=\"inf\"\n and\n ../node[@rel=\"obj1\"]/%PQ_i% = node[@rel=\"su\"]/%PQ_i%\n ] \"\"\"\n\n## only personal passives\n## this query depends on co-indexing and therefore\n## does not work for the CGN treebank\nPQ_passive = \"\"\"\n ( @rel=\"vc\"\n and\n ( @cat=\"ppart\"\n or\n @cat=\"ti\"\n )\n and\n node[@rel=\"obj1\"]/%PQ_i% = ../../node[@rel=\"su\"]/%PQ_i%\n ) \"\"\"\n\n## only impersonal passives\n## \"in Rotterdam wordt gefeest\"\n##\n## does not work for the CGN treebank\nPQ_impersonal_passive = \"\"\"\n ( ( %PQ_impersonal_passive_man%\n or\n %PQ_impersonal_passive_aut%\n )\n and\n parent::node[not(node[@rel=\"su\"])\n and\n ( @cat=\"smain\"\n or\n @cat=\"ssub\"\n or\n ( @cat=\"sv1\"\n and\n not(%PQ_imperatieven%)\n )\n )\n ]\n ) \"\"\"\n\nPQ_impersonal_passive_aut = \"\"\"\n ( @rel=\"vc\"\n and\n ../node[@rel=\"hd\"\n and\n ( @sc=\"passive\"\n or\n @sc=\"te_passive\"\n )\n ]\n ) \"\"\"\n\nPQ_impersonal_passive_man = \"\"\"\n ( @rel=\"vc\"\n and\n ../node[@rel=\"hd\"\n and\n @pt=\"ww\"\n ]\n and\n ( ( @cat=\"ppart\"\n and\n not(node[@rel=\"obj1\"])\n and\n not(node[@rel=\"su\"])\n and\n not(node[@rel=\"vc\"])\n )\n or\n ( @cat=\"ti\"\n and\n not(node[@rel=\"body\"]/node[@rel=\"obj1\"])\n and\n not(node[@rel=\"body\"]/node[@rel=\"su\"])\n and\n not(node[@rel=\"body\"]/node[@rel=\"vc\"])\n )\n )\n ) \"\"\"\n\nPQ_laag_ev = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @genus\n and\n string(@genus)\n =\n ../node[@rel=\"mod\"\n and\n @cat=\"pp\"]/node[@rel=\"obj1\"\n and\n @cat=\"np\"\n and\n node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ]/node[@rel=\"hd\"\n and\n @genus]/string(@genus)\n ) \"\"\"\n\nPQ_laag_mv = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @getal=\"mv\"\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"pp\"]/node[@rel=\"obj1\"\n and\n @cat=\"np\"\n and\n node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ]/node[@rel=\"hd\"\n and\n @getal=\"mv\"\n ]\n ) \"\"\"\n\n## relatieve bijzin die laag is aangehecht (dus er is een hogere\n## noun waar de bijzin eventueel ook bij had kunnen worden aangehect)\nPQ_laag = \"\"\" ( %PQ_laag_ev% or %PQ_laag_mv% ) \"\"\"\n\nPQ_hoog_ev = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @genus and\n string(@genus)\n =\n ../node[@cat=\"pp\"]/node[@cat=\"np\"]/node[@rel=\"hd\"\n and\n @genus]/string(@genus)\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ) \"\"\"\n\nPQ_hoog_mv = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @getal=\"mv\"\n and\n ../node[@cat=\"pp\"]/node[@cat=\"np\"]/node[@rel=\"hd\"\n and\n @getal=\"mv\"]\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ) \"\"\"\n\n## relatieve bijzin die hoog is aangehecht, maar waar er dus ook een\n## kandidaat is voor een eventuele lagere aanhechting\nPQ_hoog = \"\"\" ( %PQ_hoog_ev% or %PQ_hoog_mv% ) \"\"\"\n\nPQ_np_zonder_lidwoord = \"\"\"\n ( ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @pt=\"n\"\n and\n @ntype=\"soort\"\n ]\n and\n not(node[@rel=\"det\"])\n )\n or\n ( @pt=\"n\"\n and\n @ntype=\"soort\"\n and\n not(@rel=\"hd\"\n or\n @rel=\"mwp\")\n )\n ) \"\"\"\n\nPQ_onbepaald_lidwoord = \"\"\"\n ( @lemma=\"een\"\n or\n @lemma=\"geen\"\n or\n @lemma=\"veel\"\n or\n @lemma=\"sommig\"\n or\n @lemma=\"zo'n\"\n or\n @lemma=\"enkel\"\n ) \"\"\"\n\nPQ_np_onbepaald_lidwoord = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"det\"\n and\n %PQ_onbepaald_lidwoord%]\n ) \"\"\"\n\nPQ_onbepaalde_np = \"\"\"\n ( %PQ_np_zonder_lidwoord%\n or\n %PQ_np_onbepaald_lidwoord%\n ) \"\"\"\n\nPQ_bepaalde_np = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @ntype=\"soort\"\n ]\n and\n node[@rel=\"det\"\n and\n @lemma\n and\n not(%PQ_onbepaald_lidwoord%)\n ]\n ) \"\"\"\n\nPQ_mwdet_np = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @ntype=\"soort\"\n ]\n and\n node[@rel=\"det\"\n and\n @cat\n ]\n ) \"\"\"\n\nPQ_eigen = \"\"\"\n ( @cat=\"mwu\"\n or\n ( @pt=\"n\"\n and\n @ntype=\"eigen\"\n )\n or\n @pt=\"spec\"\n ) \"\"\"\n\nPQ_eigen_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_eigen%\n ]\n or\n %PQ_eigen%\n ) \"\"\"\n\nPQ_pron = \"\"\" @pt=\"vnw\" \"\"\"\n\nPQ_pron_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_pron%\n ]\n or\n %PQ_pron%\n ) \"\"\"\n\nPQ_adj = \"\"\" @pt=\"adj\" \"\"\"\n\nPQ_adj_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_adj%\n ]\n or\n %PQ_adj%\n ) \"\"\"\n\nPQ_ww = \"\"\" @pt=\"ww\" \"\"\"\n\nPQ_ww_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_ww%\n ]\n or\n %PQ_ww%\n ) \"\"\"\n\nPQ_tw = \"\"\" @pt=\"tw\" \"\"\"\n\nPQ_tw_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_tw%\n ]\n or\n %PQ_tw%\n ) \"\"\"\n\nPQ_negatielemma = \"\"\"\n ( @lemma=\"niet\"\n or\n @lemma=\"geen\"\n or\n @lemma=\"nooit\"\n or\n @lemma=\"nergens\"\n or\n @lemma=\"niemand\"\n ) \"\"\"\n\nPQ_s_met_negatie = \"\"\"\n ( %PQ_s%\n and\n ( node[%PQ_negatielemma%]\n or\n node/node[%PQ_negatielemma%]\n )\n ) \"\"\"\n\nPQ_pp_keten = \"\"\"\n ( @cat=\"pp\"\n and\n count(.//node[@cat=\"pp\"])>2\n ) \"\"\"\n\nPQ_max_pp_keten = \"\"\"\n //node[%PQ_pp_keten%\n and\n not(ancestor::node[%PQ_pp_keten%])\n ] \"\"\"\n\nPQ_su_op_zijn_lexical = \"\"\"\n ( @rel=\"su\"\n and\n @word\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ) \"\"\"\n\nPQ_su_op_zijn_non_lex = \"\"\"\n ( @rel=\"hd\"\n and\n @word\n and\n ../@rel=\"su\"\n and\n ../../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ) \"\"\"\n\nPQ_su_op_zijn_nloc_lex= \"\"\"\n ( @word\n and\n %PQ_i% = //node[@rel=\"su\"\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ]/%PQ_i%\n ) \"\"\"\n\nPQ_su_op_zijn_nloc_nlex= \"\"\"\n ( @rel=\"hd\"\n and\n @word\n and\n ../%PQ_i% = //node[@rel=\"su\"\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ]/%PQ_i%\n ) \"\"\"\n\nPQ_su_op_zijn = \"\"\"\n ( %PQ_su_op_zijn_lexical%\n or\n %PQ_su_op_zijn_non_lex%\n or\n %PQ_su_op_zijn_nloc_lex%\n or\n %PQ_su_op_zijn_nloc_nlex%\n ) \"\"\"\n\nPQ_vv_bigram = \"\"\"\n //node[@pt=\"ww\"\n and\n %PQ_e%=//node[@pt=\"ww\"]/%PQ_b%\n ] \"\"\"\n\nPQ_vv_trigram_ssub = \"\"\"\n //node[@cat=\"ssub\"\n and\n ( some $x in .//node[@pt=\"ww\"],\n $y in .//node[@pt=\"ww\"],\n $z in .//node[@pt=\"ww\"]\n\n satisfies\n ( $x/%PQ_e% = $y/%PQ_b%\n and\n $y/%PQ_e% = $z/%PQ_b%\n )\n )\n ] \"\"\"\n\nPQ_vv_fourgram_ssub = \"\"\"\n //node[@cat=\"ssub\"\n and\n ( some $x in .//node[@pt=\"ww\"],\n $y in .//node[@pt=\"ww\"],\n $z in .//node[@pt=\"ww\"],\n $w in .//node[@pt=\"ww\"]\n\n satisfies\n\n ( $x/%PQ_e% = $y/%PQ_b%\n and\n $y/%PQ_e% = $z/%PQ_b%\n and\n $z/%PQ_e% = $w/%PQ_b%\n )\n )\n ] \"\"\"\n\nPQ_lcatnp = \"\"\"\n ( @lcat=\"np\"\n and\n not(@rel=\"hd\")\n and\n not(@rel=\"mwp\")\n ) \"\"\"\n\nPQ_barenp = \"\"\"\n ( @pt=\"n\"\n and not (@rel=\"hd\")\n ) \"\"\"\n\nPQ_pronnp = \"\"\"\n ( @pt=\"vnw\"\n and\n @pdtype=\"pron\"\n and\n not(@rel=\"hd\")\n ) \"\"\"\n\nPQ_mwunp = \"\"\"\n ( @cat=\"mwu\"\n and\n not(@rel=\"hd\")\n and\n ( @rel=\"su\"\n or\n @rel=\"obj1\"\n or\n @rel=\"obj2\"\n or\n @rel=\"app\"\n )\n ) \"\"\"\n\nPQ_basenp = \"\"\"\n ( @cat=\"np\"\n or\n %PQ_lcatnp%\n or\n %PQ_barenp%\n or\n %PQ_pronnp%\n or\n %PQ_mwunp%\n ) \"\"\"\n\nPQ_np = \"\"\"\n ( %PQ_basenp%\n or\n ( @cat=\"conj\"\n and node[%PQ_basenp%]\n )\n ) \"\"\"\n\nPQ_npnode= \"\"\" //node[%PQ_np%] \"\"\"\n\nPQ_finiete_zin = \"\"\"\n ( @cat=\"smain\"\n or\n @cat=\"sv1\"\n or\n @cat=\"ssub\"\n or\n @cat=\"whq\"\n or\n @cat=\"whsub\"\n or\n @cat=\"rel\"\n ) \"\"\"\n\nPQ_finiete_inbedding0 = \"\"\"\n ( %PQ_finiete_zin%\n and\n not(.//node[ %PQ_finiete_zin%])\n and\n not(ancestor::node[%PQ_finiete_zin%])\n ) \"\"\"\n\nPQ_finiete_inbedding1 = \"\"\"\n ( %PQ_finiete_zin%\n and .//node[%PQ_finiete_zin%]\n ) \"\"\"\n\nPQ_finiete_inbedding2 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding1%]\n ) \"\"\"\n\nPQ_finiete_inbedding3 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding2%]\n ) \"\"\"\n\nPQ_finiete_inbedding4 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding3%]\n ) \"\"\"\n\nPQ_finiete_inbedding5 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding4%]\n ) \"\"\"\n\nPQ_finiete_inbedding6 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding5%]\n ) \"\"\"\n\nPQ_finiete_inbedding7 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding6%]\n ) \"\"\"\n\nPQ_finiete_inbedding8 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding7%]\n ) \"\"\"\n\nPQ_janee_vragen = \"\"\"\n //node[@cat='sv1'\n and\n not(@rel='body')\n and\n not(node[@rel=\"hd\"\n and\n @stype\n and\n not(@stype='ynquestion')\n ]\n )\n and\n number(@end) < //node[@word='?']/number(@end)\n ] \"\"\"\n\nPQ_imperatieven = \"\"\"\n //node[@cat='sv1'\n and\n not(node[@rel='su'])\n and\n not(node[@rel='hd'\n and\n @stype\n and\n not( @stype=\"imparative\" )\n ]\n )\n and\n not(node[@rel='hd'\n and\n ( @tense='past'\n or\n @pvagr='mv'\n or\n @pvagr='met-t'\n )\n ]\n )\n ] \"\"\"\n\nPQ_ssub = \"\"\"\n ( @cat=\"ssub\"\n or\n ( @cat=\"conj\"\n and\n node[@rel=\"cnj\"\n and\n @cat=\"ssub\"\n ]\n )\n or\n ( @cat=\"du\"\n and\n node[@cat=\"ssub\"]\n )\n ) \"\"\"\n\nPQ_relatieve_bijzinnen = \"\"\"\n //node[@cat='rel'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_free_relatives = \"\"\"\n //node[@cat='whrel'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_ingebedde_vraagzinnen = \"\"\"\n //node[@cat='whsub'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_vorfeld_np_subject = \"\"\"\n //node[ %PQ_vorfeld%\n and\n ( @rel=\"su\"\n or\n @rel=\"sup\"\n )\n and\n %PQ_np%\n ] \"\"\"\n\nPQ_vorfeld_np_no_subject = \"\"\"\n //node[ %PQ_vorfeld%\n and\n not(@rel=\"su\"\n or\n @rel=\"sup\"\n )\n and\n %PQ_np%\n ] \"\"\"\n\nPQ_non_local_coindex = \"\"\"\n ( %PQ_i% = ..//node[@cat=\"ssub\"]//node[@cat=\"ssub\"\n and\n not(../@rel=\"obcomp\")]//node/%PQ_i%\n ) \"\"\"\n\nPQ_non_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n %PQ_non_local_coindex%\n ] \"\"\"\n\nPQ_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n not(%PQ_non_local_coindex%)\n ] \"\"\"\n\nPQ_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n not(%PQ_non_local_coindex%)\n ] \"\"\"\n\nPQ_s_dominating_vorfeld = \"\"\"\n ( ( @cat=\"ssub\"\n or\n @cat=\"smain\"\n )\n and\n .//node[%PQ_vorfeld%]\n ) \"\"\"\n\nPQ_minimal_s_dominating_vorfeld = \"\"\"\n ( %PQ_s_dominating_vorfeld%\n and\n not(.//node[%PQ_s_dominating_vorfeld%])\n ) \"\"\"\n\nPQ_vorfeld_non_local = \"\"\"\n //node[ @cat=\"ssub\"\n and\n %PQ_minimal_s_dominating_vorfeld%\n ] \"\"\"\n"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DefaultMacros = "## macro's for PaQu\n## mostly by Gertjan van Noord\n## comments welcome at g.j.m.van.noord@rug.nl\n##\n## any macro definition that is a conjunction or disjunction\n## should be placed in () brackets in order to avoid counter-intuitive\n## results\n##\n## any macro definition that starts with //node should not\n## have outer () brackets\n\nPQ_b = \"\"\" number(@begin) \"\"\"\nPQ_e = \"\"\" number(@end) \"\"\"\nPQ_i = \"\"\" number(@index) \"\"\"\n\nPQ_headrel = \"\"\"\n ( @rel=\"hd\"\n or\n @rel=\"cmp\"\n or\n @rel=\"mwp\"\n or\n @rel=\"crd\"\n or\n @rel=\"rhd\"\n or\n @rel=\"whd\"\n or\n @rel=\"nucl\"\n or\n @rel=\"dp\"\n ) \"\"\"\n\nPQ_begin_of_head = \"\"\" node[%PQ_headrel%]/%PQ_b% \"\"\"\nPQ_end_of_head = \"\"\" node[%PQ_headrel%]/%PQ_e% \"\"\"\n\nPQ_begin_of_hd = \"\"\" node[@rel=\"hd\"]/%PQ_b% \"\"\"\nPQ_end_of_hd = \"\"\" node[@rel=\"hd\"]/%PQ_e% \"\"\"\n\nPQ_precedes_head_of_smain = \"\"\"\n ( ancestor::node[@cat=\"smain\"]/node[@rel=\"hd\"]/%PQ_b% > %PQ_begin_of_head%\n or\n ( ancestor::node[@cat=\"smain\"]/node[@rel=\"hd\"]/%PQ_b% > %PQ_b%\n and\n not(node[%PQ_headrel%])\n )\n ) \"\"\"\n\nPQ_vorfeld = \"\"\"\n ( %PQ_precedes_head_of_smain%\n and\n not(parent::node[%PQ_precedes_head_of_smain%])\n ) \"\"\"\n\nPQ_single_name = \"\"\"\n ( @ntype = 'eigen'\n or\n @postag='SPEC(deeleigen)'\n ) \"\"\"\n\nPQ_multi_name = \"\"\"\n ( @cat='mwu'\n and\n node[@rel='mwp'\n and\n %PQ_single_name%\n ]\n ) \"\"\"\n\nPQ_name = \"\"\"\n ( %PQ_single_name%\n or\n %PQ_multi_name%\n ) \"\"\"\n\nPQ_name_phrase= \"\"\"\n ( %PQ_name%\n or\n node[@rel=\"hd\"\n and\n %PQ_name%\n ]\n ) \"\"\"\n\nPQ_vp = \"\"\"\n ( @cat=\"inf\"\n or\n @cat=\"ti\"\n or\n @cat=\"ssub\"\n or\n @cat=\"oti\"\n or\n @cat=\"ppart\"\n ) \"\"\"\n\nPQ_s = \"\"\"\n ( %PQ_vp%\n or\n @cat=\"smain\"\n or\n @cat=\"sv1\"\n ) \"\"\"\n\nPQ_follows_head_of_vp = \"\"\"\n ( not(@cat=\"inf\" or @cat=\"ppart\" or @rel=\"hd\" or @rel=\"svp\")\n and\n ( ancestor::node[%PQ_vp%]/node[@rel=\"hd\"]/%PQ_b% < %PQ_begin_of_head%\n or\n ancestor::node[%PQ_vp%]/node[@rel=\"hd\"]/%PQ_b% < %PQ_b% and not(node[%PQ_headrel%])\n )\n ) \"\"\"\n\nPQ_nachfeld = \"\"\"\n ( %PQ_follows_head_of_vp%\n and\n not(parent::node[%PQ_follows_head_of_vp%])\n ) \"\"\"\n\nPQ_nachfeld_node = \"\"\" //node[%PQ_nachfeld%] \"\"\"\n\nPQ_dep_node_in_verbcluster = \"\"\"\n ( @rel=\"vc\"\n and\n ( @cat=\"ti\" or @cat=\"inf\" or @cat=\"ppart\" )\n and\n node/%PQ_b% < ../node[@rel=\"hd\"\n and\n @pt=\"ww\"\n and\n not(../@cat=\"smain\" or ../@cat=\"sv1\")\n ]/%PQ_b%\n ) \"\"\"\n\nPQ_dep_verb_in_verbcluster = \"\"\"\n ( ( @rel=\"hd\"\n and\n @pt=\"ww\"\n and parent::node[%PQ_dep_node_in_verbcluster%]\n )\n or\n ( @rel=\"cmp\"\n and\n @lemma=\"te\"\n and\n parent::node[%PQ_dep_node_in_verbcluster%]\n )\n or\n ( @rel=\"hd\"\n and\n @pt=\"ww\"\n and parent::node[parent::node[%PQ_dep_node_in_verbcluster%]]\n )\n ) \"\"\"\n\nPQ_head_verb_in_verbcluster = \"\"\"\n ( not(../@cat=\"smain\"\n or\n ../@cat=\"sv1\"\n )\n and\n @rel=\"hd\"\n and\n ../node[%PQ_dep_node_in_verbcluster%]\n ) \"\"\"\n\nPQ_verb_in_verbcluster = \"\"\"\n //node[%PQ_dep_verb_in_verbcluster%\n or\n %PQ_head_verb_in_verbcluster%\n ] \"\"\"\n\n## omdat ik jou gezien heb\n##\n## this query is slightly too permissive in that it will\n## find topicalized participles as well\n## (cases such as \"Gestart zal worden met een introductie\")\nPQ_groen = \"\"\"\n //node[@rel=\"hd\"\n and\n @wvorm=\"vd\"\n and\n %PQ_b% < ../../node[@rel=\"hd\" and @pt=\"ww\"]/%PQ_b%\n and\n not( ../../@cat=\"smain\"\n or\n ../../@cat=\"sv1\"\n )\n ] \"\"\"\n\n## verwacht werd dat hij komt\nPQ_topicalized_participle = \"\"\"\n //node[@wvorm=\"vd\"\n and\n @rel=\"hd\"\n and\n ../@rel=\"vc\"\n and\n %PQ_b% = ancestor::node[@cat=\"smain\"]/%PQ_b%\n ] \"\"\"\n\n## omdat ik jou heb gezien\nPQ_rood = \"\"\"\n //node[@rel=\"hd\"\n and\n @wvorm=\"vd\"\n and\n %PQ_b% > ../../node[@rel=\"hd\" and @pt=\"ww\"]/%PQ_b%\n and\n not( ../../@cat=\"smain\"\n or\n ../../@cat=\"sv1\"\n )\n ] \"\"\"\n\n## this query depends on co-indexing and therefore\n## does not work for the CGN treebank\n##\n## \"dat hij hen hun eigen graf zag graven\"\nPQ_cross_serial_verbcluster = \"\"\"\n //node[%PQ_dep_node_in_verbcluster%\n and\n @cat=\"inf\"\n and\n ../node[@rel=\"obj1\"]/%PQ_i% = node[@rel=\"su\"]/%PQ_i%\n ] \"\"\"\n\n## only personal passives\n## this query depends on co-indexing and therefore\n## does not work for the CGN treebank\nPQ_passive = \"\"\"\n ( @rel=\"vc\"\n and\n ( @cat=\"ppart\"\n or\n @cat=\"ti\"\n )\n and\n node[@rel=\"obj1\"]/%PQ_i% = ../../node[@rel=\"su\"]/%PQ_i%\n ) \"\"\"\n\n## only impersonal passives\n## \"in Rotterdam wordt gefeest\"\n##\n## does not work for the CGN treebank\nPQ_impersonal_passive = \"\"\"\n ( ( %PQ_impersonal_passive_man%\n or\n %PQ_impersonal_passive_aut%\n )\n and\n parent::node[not(node[@rel=\"su\"])\n and\n ( @cat=\"smain\"\n or\n @cat=\"ssub\"\n or\n ( @cat=\"sv1\"\n and\n not(%PQ_imperatieven%)\n )\n )\n ]\n ) \"\"\"\n\nPQ_impersonal_passive_aut = \"\"\"\n ( @rel=\"vc\"\n and\n ../node[@rel=\"hd\"\n and\n ( @sc=\"passive\"\n or\n @sc=\"te_passive\"\n )\n ]\n ) \"\"\"\n\nPQ_impersonal_passive_man = \"\"\"\n ( @rel=\"vc\"\n and\n ../node[@rel=\"hd\"\n and\n @pt=\"ww\"\n ]\n and\n ( ( @cat=\"ppart\"\n and\n not(node[@rel=\"obj1\"])\n and\n not(node[@rel=\"su\"])\n and\n not(node[@rel=\"vc\"])\n )\n or\n ( @cat=\"ti\"\n and\n not(node[@rel=\"body\"]/node[@rel=\"obj1\"])\n and\n not(node[@rel=\"body\"]/node[@rel=\"su\"])\n and\n not(node[@rel=\"body\"]/node[@rel=\"vc\"])\n )\n )\n ) \"\"\"\n\nPQ_laag_ev = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @genus\n and\n string(@genus)\n =\n ../node[@rel=\"mod\"\n and\n @cat=\"pp\"]/node[@rel=\"obj1\"\n and\n @cat=\"np\"\n and\n node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ]/node[@rel=\"hd\"\n and\n @genus]/string(@genus)\n ) \"\"\"\n\nPQ_laag_mv = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @getal=\"mv\"\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"pp\"]/node[@rel=\"obj1\"\n and\n @cat=\"np\"\n and\n node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ]/node[@rel=\"hd\"\n and\n @getal=\"mv\"\n ]\n ) \"\"\"\n\n## relatieve bijzin die laag is aangehecht (dus er is een hogere\n## noun waar de bijzin eventueel ook bij had kunnen worden aangehect)\nPQ_laag = \"\"\" ( %PQ_laag_ev% or %PQ_laag_mv% ) \"\"\"\n\nPQ_hoog_ev = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @genus and\n string(@genus)\n =\n ../node[@cat=\"pp\"]/node[@cat=\"np\"]/node[@rel=\"hd\"\n and\n @genus]/string(@genus)\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ) \"\"\"\n\nPQ_hoog_mv = \"\"\"\n ( ../@cat=\"np\"\n and\n @rel=\"hd\"\n and\n @getal=\"mv\"\n and\n ../node[@cat=\"pp\"]/node[@cat=\"np\"]/node[@rel=\"hd\"\n and\n @getal=\"mv\"]\n and\n ../node[@rel=\"mod\"\n and\n @cat=\"rel\"\n ]\n ) \"\"\"\n\n## relatieve bijzin die hoog is aangehecht, maar waar er dus ook een\n## kandidaat is voor een eventuele lagere aanhechting\nPQ_hoog = \"\"\" ( %PQ_hoog_ev% or %PQ_hoog_mv% ) \"\"\"\n\nPQ_np_zonder_lidwoord = \"\"\"\n ( ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @pt=\"n\"\n and\n @ntype=\"soort\"\n ]\n and\n not(node[@rel=\"det\"])\n )\n or\n ( @pt=\"n\"\n and\n @ntype=\"soort\"\n and\n not(@rel=\"hd\"\n or\n @rel=\"mwp\")\n )\n ) \"\"\"\n\nPQ_onbepaald_lidwoord = \"\"\"\n ( @lemma=\"een\"\n or\n @lemma=\"geen\"\n or\n @lemma=\"veel\"\n or\n @lemma=\"sommig\"\n or\n @lemma=\"zo'n\"\n or\n @lemma=\"enkel\"\n ) \"\"\"\n\nPQ_np_onbepaald_lidwoord = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"det\"\n and\n %PQ_onbepaald_lidwoord%]\n ) \"\"\"\n\nPQ_onbepaalde_np = \"\"\"\n ( %PQ_np_zonder_lidwoord%\n or\n %PQ_np_onbepaald_lidwoord%\n ) \"\"\"\n\nPQ_bepaalde_np = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @ntype=\"soort\"\n ]\n and\n node[@rel=\"det\"\n and\n @lemma\n and\n not(%PQ_onbepaald_lidwoord%)\n ]\n ) \"\"\"\n\nPQ_mwdet_np = \"\"\"\n ( @cat=\"np\"\n and\n node[@rel=\"hd\"\n and\n @ntype=\"soort\"\n ]\n and\n node[@rel=\"det\"\n and\n @cat\n ]\n ) \"\"\"\n\nPQ_eigen = \"\"\"\n ( @cat=\"mwu\"\n or\n ( @pt=\"n\"\n and\n @ntype=\"eigen\"\n )\n or\n @pt=\"spec\"\n ) \"\"\"\n\nPQ_eigen_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_eigen%\n ]\n or\n %PQ_eigen%\n ) \"\"\"\n\nPQ_pron = \"\"\" @pt=\"vnw\" \"\"\"\n\nPQ_pron_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_pron%\n ]\n or\n %PQ_pron%\n ) \"\"\"\n\nPQ_adj = \"\"\" @pt=\"adj\" \"\"\"\n\nPQ_adj_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_adj%\n ]\n or\n %PQ_adj%\n ) \"\"\"\n\nPQ_ww = \"\"\" @pt=\"ww\" \"\"\"\n\nPQ_ww_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_ww%\n ]\n or\n %PQ_ww%\n ) \"\"\"\n\nPQ_tw = \"\"\" @pt=\"tw\" \"\"\"\n\nPQ_tw_p = \"\"\"\n ( node[@rel=\"hd\"\n and\n %PQ_tw%\n ]\n or\n %PQ_tw%\n ) \"\"\"\n\nPQ_negatielemma = \"\"\"\n ( @lemma=\"niet\"\n or\n @lemma=\"geen\"\n or\n @lemma=\"nooit\"\n or\n @lemma=\"nergens\"\n or\n @lemma=\"niemand\"\n ) \"\"\"\n\nPQ_s_met_negatie = \"\"\"\n ( %PQ_s%\n and\n ( node[%PQ_negatielemma%]\n or\n node/node[%PQ_negatielemma%]\n )\n ) \"\"\"\n\nPQ_pp_keten = \"\"\"\n ( @cat=\"pp\"\n and\n count(.//node[@cat=\"pp\"])>2\n ) \"\"\"\n\nPQ_max_pp_keten = \"\"\"\n //node[%PQ_pp_keten%\n and\n not(ancestor::node[%PQ_pp_keten%])\n ] \"\"\"\n\nPQ_su_op_zijn_lexical = \"\"\"\n ( @rel=\"su\"\n and\n @word\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ) \"\"\"\n\nPQ_su_op_zijn_non_lex = \"\"\"\n ( @rel=\"hd\"\n and\n @word\n and\n ../@rel=\"su\"\n and\n ../../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ) \"\"\"\n\nPQ_su_op_zijn_nloc_lex= \"\"\"\n ( @word\n and\n %PQ_i% = //node[@rel=\"su\"\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ]/%PQ_i%\n ) \"\"\"\n\nPQ_su_op_zijn_nloc_nlex= \"\"\"\n ( @rel=\"hd\"\n and\n @word\n and\n ../%PQ_i% = //node[@rel=\"su\"\n and\n ../node[@rel=\"hd\"\n and\n @lemma=\"zijn\"\n ]\n and\n ../node[@rel=\"predc\"\n and\n @lemma=\"op\"\n ]\n ]/%PQ_i%\n ) \"\"\"\n\nPQ_su_op_zijn = \"\"\"\n ( %PQ_su_op_zijn_lexical%\n or\n %PQ_su_op_zijn_non_lex%\n or\n %PQ_su_op_zijn_nloc_lex%\n or\n %PQ_su_op_zijn_nloc_nlex%\n ) \"\"\"\n\nPQ_vv_bigram = \"\"\"\n //node[@pt=\"ww\"\n and\n %PQ_e%=//node[@pt=\"ww\"]/%PQ_b%\n ] \"\"\"\n\nPQ_vv_trigram_ssub = \"\"\"\n //node[@cat=\"ssub\"\n and\n ( some $x in .//node[@pt=\"ww\"],\n $y in .//node[@pt=\"ww\"],\n $z in .//node[@pt=\"ww\"]\n\n satisfies\n ( $x/%PQ_e% = $y/%PQ_b%\n and\n $y/%PQ_e% = $z/%PQ_b%\n )\n )\n ] \"\"\"\n\nPQ_vv_fourgram_ssub = \"\"\"\n //node[@cat=\"ssub\"\n and\n ( some $x in .//node[@pt=\"ww\"],\n $y in .//node[@pt=\"ww\"],\n $z in .//node[@pt=\"ww\"],\n $w in .//node[@pt=\"ww\"]\n\n satisfies\n\n ( $x/%PQ_e% = $y/%PQ_b%\n and\n $y/%PQ_e% = $z/%PQ_b%\n and\n $z/%PQ_e% = $w/%PQ_b%\n )\n )\n ] \"\"\"\n\nPQ_lcatnp = \"\"\"\n ( @lcat=\"np\"\n and\n not(@rel=\"hd\")\n and\n not(@rel=\"mwp\")\n ) \"\"\"\n\nPQ_barenp = \"\"\"\n ( @pt=\"n\"\n and not (@rel=\"hd\")\n ) \"\"\"\n\nPQ_pronnp = \"\"\"\n ( @pt=\"vnw\"\n and\n @pdtype=\"pron\"\n and\n not(@rel=\"hd\")\n ) \"\"\"\n\nPQ_mwunp = \"\"\"\n ( @cat=\"mwu\"\n and\n not(@rel=\"hd\")\n and\n ( @rel=\"su\"\n or\n @rel=\"obj1\"\n or\n @rel=\"obj2\"\n or\n @rel=\"app\"\n )\n ) \"\"\"\n\nPQ_basenp = \"\"\"\n ( @cat=\"np\"\n or\n %PQ_lcatnp%\n or\n %PQ_barenp%\n or\n %PQ_pronnp%\n or\n %PQ_mwunp%\n ) \"\"\"\n\nPQ_np = \"\"\"\n ( %PQ_basenp%\n or\n ( @cat=\"conj\"\n and node[%PQ_basenp%]\n )\n ) \"\"\"\n\nPQ_npnode= \"\"\" //node[%PQ_np%] \"\"\"\n\nPQ_finiete_zin = \"\"\"\n ( @cat=\"smain\"\n or\n @cat=\"sv1\"\n or\n @cat=\"ssub\"\n or\n @cat=\"whq\"\n or\n @cat=\"whsub\"\n or\n @cat=\"rel\"\n ) \"\"\"\n\nPQ_finiete_inbedding0 = \"\"\"\n ( %PQ_finiete_zin%\n and\n not(.//node[ %PQ_finiete_zin%])\n and\n not(ancestor::node[%PQ_finiete_zin%])\n ) \"\"\"\n\nPQ_finiete_inbedding1 = \"\"\"\n ( %PQ_finiete_zin%\n and .//node[%PQ_finiete_zin%]\n ) \"\"\"\n\nPQ_finiete_inbedding2 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding1%]\n ) \"\"\"\n\nPQ_finiete_inbedding3 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding2%]\n ) \"\"\"\n\nPQ_finiete_inbedding4 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding3%]\n ) \"\"\"\n\nPQ_finiete_inbedding5 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding4%]\n ) \"\"\"\n\nPQ_finiete_inbedding6 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding5%]\n ) \"\"\"\n\nPQ_finiete_inbedding7 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding6%]\n ) \"\"\"\n\nPQ_finiete_inbedding8 = \"\"\"\n ( %PQ_finiete_zin%\n and\n .//node[%PQ_finiete_inbedding7%]\n ) \"\"\"\n\nPQ_janee_vragen = \"\"\"\n //node[@cat='sv1'\n and\n not(@rel='body')\n and\n not(node[@rel=\"hd\"\n and\n @stype\n and\n not(@stype='ynquestion')\n ]\n )\n and\n number(@end) < //node[@word='?']/number(@end)\n ] \"\"\"\n\nPQ_imperatieven = \"\"\"\n //node[@cat='sv1'\n and\n not(node[@rel='su'])\n and\n not(node[@rel='hd'\n and\n @stype\n and\n not( @stype=\"imparative\" )\n ]\n )\n and\n not(node[@rel='hd'\n and\n ( @tense='past'\n or\n @pvagr='mv'\n or\n @pvagr='met-t'\n )\n ]\n )\n ] \"\"\"\n\nPQ_ssub = \"\"\"\n ( @cat=\"ssub\"\n or\n ( @cat=\"conj\"\n and\n node[@rel=\"cnj\"\n and\n @cat=\"ssub\"\n ]\n )\n or\n ( @cat=\"du\"\n and\n node[@cat=\"ssub\"]\n )\n ) \"\"\"\n\nPQ_relatieve_bijzinnen = \"\"\"\n //node[@cat='rel'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_free_relatives = \"\"\"\n //node[@cat='whrel'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_ingebedde_vraagzinnen = \"\"\"\n //node[@cat='whsub'\n and\n node[@rel='body'\n and\n %PQ_ssub%\n ]\n ] \"\"\"\n\nPQ_vorfeld_np_subject = \"\"\"\n //node[ %PQ_vorfeld%\n and\n ( @rel=\"su\"\n or\n @rel=\"sup\"\n )\n and\n %PQ_np%\n ] \"\"\"\n\nPQ_vorfeld_np_no_subject = \"\"\"\n //node[ %PQ_vorfeld%\n and\n not(@rel=\"su\"\n or\n @rel=\"sup\"\n )\n and\n %PQ_np%\n ] \"\"\"\n\nPQ_non_local_coindex = \"\"\"\n ( %PQ_i% = ..//node[@cat=\"ssub\"]//node[@cat=\"ssub\"\n and\n not(../@rel=\"obcomp\")]//node/%PQ_i%\n ) \"\"\"\n\nPQ_non_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n %PQ_non_local_coindex%\n ] \"\"\"\n\nPQ_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n not(%PQ_non_local_coindex%)\n ] \"\"\"\n\nPQ_local_extraction = \"\"\"\n //node[( @rel=\"whd\"\n or\n @rel=\"rhd\"\n )\n and\n not(%PQ_non_local_coindex%)\n ] \"\"\"\n\nPQ_s_dominating_vorfeld = \"\"\"\n ( ( @cat=\"ssub\"\n or\n @cat=\"smain\"\n )\n and\n .//node[%PQ_vorfeld%]\n ) \"\"\"\n\nPQ_minimal_s_dominating_vorfeld = \"\"\"\n ( %PQ_s_dominating_vorfeld%\n and\n not(.//node[%PQ_s_dominating_vorfeld%])\n ) \"\"\"\n\nPQ_vorfeld_non_local = \"\"\"\n //node[ @cat=\"ssub\"\n and\n %PQ_minimal_s_dominating_vorfeld%\n ] \"\"\"\n"; |
@@ -0,0 +0,0 @@ export * from './default-macros'; |
@@ -0,0 +0,0 @@ "use strict"; |
import { HighlighterRules } from './xpath-interfaces'; | ||
export declare let TextHighlightRules: HighlighterRules; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare type XPathAttribute = { |
@@ -0,0 +0,0 @@ "use strict"; |
import { TextHighlightRules } from './text-highlight-rules'; | ||
export declare const identifierRe = "[a-zA-Z\\$_¡-][a-zA-Z\\d\\$_¡-]*"; | ||
export declare const identifierRe = "[a-zA-Z\\$_\u00A1-\uFFFF][a-zA-Z\\d\\$_\u00A1-\uFFFF]*"; | ||
export declare const equalityRe = "(=|!=|<=|<|>=|>)"; | ||
@@ -4,0 +4,0 @@ /** |
@@ -20,6 +20,3 @@ "use strict"; | ||
*/ | ||
var /** | ||
* Highlighter to use by ACE text editor for highlighting the different tokens in an XPATH string. | ||
*/ | ||
XPathHighlighterRules = /** @class */ (function (_super) { | ||
var XPathHighlighterRules = /** @class */ (function (_super) { | ||
__extends(XPathHighlighterRules, _super); | ||
@@ -26,0 +23,0 @@ function XPathHighlighterRules() { |
@@ -0,0 +0,0 @@ export declare type HighlighterRules = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
export * from './xpath-editor/xpath-editor'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './_index'; | ||
import './xpath-variables/xpath-variables.jquery'; | ||
import './xpath-editor/xpath-editor.jquery'; |
@@ -7,4 +7,3 @@ "use strict"; | ||
__export(require("./_index")); | ||
// trigger $.fn.extend | ||
require("./xpath-variables/xpath-variables.jquery"); | ||
require("./xpath-editor/xpath-editor.jquery"); |
export * from './_index'; | ||
export * from './xpath-editor/xpath-editor.component'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { TextHighlightRules } from '../../common/text-highlight-rules'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare type FunctionCompletion = { |
@@ -0,0 +0,0 @@ "use strict"; |
import { TextHighlightRules } from '../../common/text-highlight-rules'; | ||
export declare class AlpinoXPathHighlighter extends TextHighlightRules { | ||
constructor(); | ||
private embedFunction(name); | ||
private embedFunction; | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -15,3 +15,3 @@ import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core'; | ||
ngOnInit(): void; | ||
private emitChange(); | ||
private emitChange; | ||
} | ||
@@ -18,0 +18,0 @@ export interface ValueEvent { |
@@ -64,11 +64,11 @@ "use strict"; | ||
XPathEditorComponent.ctorParameters = function () { return [ | ||
{ type: _ng_1.ParserService, }, | ||
{ type: _ng_1.MacroService, }, | ||
{ type: _ng_1.ParserService }, | ||
{ type: _ng_1.MacroService } | ||
]; }; | ||
XPathEditorComponent.propDecorators = { | ||
"container": [{ type: core_1.ViewChild, args: ['container',] },], | ||
"autofocus": [{ type: core_1.Input },], | ||
"value": [{ type: core_1.Input },], | ||
"width": [{ type: core_1.Input },], | ||
"onChange": [{ type: core_1.Output },], | ||
container: [{ type: core_1.ViewChild, args: ['container',] }], | ||
autofocus: [{ type: core_1.Input }], | ||
value: [{ type: core_1.Input }], | ||
width: [{ type: core_1.Input }], | ||
onChange: [{ type: core_1.Output }] | ||
}; | ||
@@ -75,0 +75,0 @@ return XPathEditorComponent; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,5 +0,2 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/operator/debounceTime'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/distinctUntilKeyChanged'; | ||
import { Observable } from 'rxjs'; | ||
import 'brace/ext/language_tools'; | ||
@@ -25,3 +22,3 @@ import 'brace/theme/dawn'; | ||
constructor(xpathParserService: Parser, macroService: Macro); | ||
private updateValue(); | ||
private updateValue; | ||
initialize(container: HTMLElement, autofocus: boolean, value: string): void; | ||
@@ -31,7 +28,7 @@ /** | ||
*/ | ||
private showErrors(); | ||
private hideErrorMessage(); | ||
private hideWarningMessages(); | ||
private showErrorMessage(errorMessage); | ||
private showWarningMessages(warningMessages); | ||
private showErrors; | ||
private hideErrorMessage; | ||
private hideWarningMessages; | ||
private showErrorMessage; | ||
private showWarningMessages; | ||
} |
export declare type CreateJQueryXPathEditor = (options: { | ||
macrosUrl: string; | ||
}) => JQuery; | ||
declare global { | ||
declare global { | ||
interface JQuery { | ||
@@ -9,2 +9,1 @@ xpathEditor: CreateJQueryXPathEditor; | ||
} | ||
export {}; |
@@ -28,2 +28,3 @@ "use strict"; | ||
var _this = this; | ||
var _a; | ||
var $textArea = $(textArea); | ||
@@ -59,3 +60,2 @@ this.$wrapper = $textArea.wrap('<div class="xpath-editor-wrapper" />').parent(); | ||
this.initialize($editorContainer[0], autofocus, value); | ||
var _a; | ||
}; | ||
@@ -62,0 +62,0 @@ return JQueryXPathEditor; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var BehaviorSubject_1 = require("rxjs/BehaviorSubject"); | ||
require("rxjs/add/operator/debounceTime"); | ||
require("rxjs/add/operator/map"); | ||
require("rxjs/add/operator/distinctUntilKeyChanged"); | ||
var rxjs_1 = require("rxjs"); | ||
var operators_1 = require("rxjs/operators"); | ||
var ace = require("brace"); | ||
@@ -20,4 +18,4 @@ var xpath_mode_1 = require("./xpath-mode"); | ||
this.existingWarningMarkerIds = []; | ||
this.valueSubject = new BehaviorSubject_1.BehaviorSubject(''); | ||
this.errorMessageSubject = new BehaviorSubject_1.BehaviorSubject(''); | ||
this.valueSubject = new rxjs_1.BehaviorSubject(''); | ||
this.errorMessageSubject = new rxjs_1.BehaviorSubject(''); | ||
this.macroServiceLoaded = false; | ||
@@ -27,3 +25,3 @@ this.beforeEnrich = null; | ||
this.errorMessageObservable = this.errorMessageSubject.asObservable(); | ||
this.parsedObservable = this.valueSubject.debounceTime(50).map(function (xpath) { | ||
this.parsedObservable = this.valueSubject.pipe(operators_1.debounceTime(50), operators_1.map(function (xpath) { | ||
if (_this.macroServiceLoaded && | ||
@@ -33,3 +31,2 @@ (xpath != _this.beforeEnrich || | ||
// don't redo enrichment if the value is the same as before the enrichment: undo was probably used | ||
// don't redo enrichment if the value is the same as before the enrichment: undo was probably used | ||
_this.beforeEnrich = xpath; | ||
@@ -47,7 +44,6 @@ var enrichment = _this.macroService.enrich(xpath); | ||
return _this.xpathParserService.parse(xpath); | ||
}); | ||
})); | ||
this.macroService.onceLoaded.then(function () { | ||
_this.macroServiceLoaded = true; | ||
// parse again, just to be sure | ||
// parse again, just to be sure | ||
_this.valueSubject.next(_this.valueSubject.value); | ||
@@ -90,12 +86,6 @@ }); | ||
*/ | ||
/** | ||
* Listen for parse errors and warnings and show them. | ||
*/ | ||
XPathEditor.prototype.showErrors = /** | ||
* Listen for parse errors and warnings and show them. | ||
*/ | ||
function () { | ||
XPathEditor.prototype.showErrors = function () { | ||
var _this = this; | ||
this.parsedObservable | ||
.map(function (parsed) { | ||
.pipe(operators_1.map(function (parsed) { | ||
return { | ||
@@ -106,4 +96,3 @@ value: parsed, | ||
}; | ||
}) | ||
.distinctUntilKeyChanged('key') | ||
}), operators_1.distinctUntilKeyChanged('key')) | ||
.subscribe(function (parsed) { | ||
@@ -119,3 +108,2 @@ if (parsed.value.error) { | ||
// warning markers are rendered in the gutter | ||
// warning markers are rendered in the gutter | ||
_this.editor.renderer.setShowGutter(true); | ||
@@ -122,0 +110,0 @@ _this.showWarningMessages(parsed.value.warnings); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"Selector":"xpath-editor","XPathEditor":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../services/parser","name":"Parser","line":53,"character":44},{"__symbolic":"reference","module":"../../services/macro","name":"Macro","line":53,"character":74}]}],"updateValue":[{"__symbolic":"method"}],"initialize":[{"__symbolic":"method"}],"showErrors":[{"__symbolic":"method"}],"hideErrorMessage":[{"__symbolic":"method"}],"hideWarningMessages":[{"__symbolic":"method"}],"showErrorMessage":[{"__symbolic":"method"}],"showWarningMessages":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"Selector":"xpath-editor","XPathEditor":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../services/parser","name":"Parser","line":50,"character":44},{"__symbolic":"reference","module":"../../services/macro","name":"Macro","line":50,"character":74}]}],"updateValue":[{"__symbolic":"method"}],"initialize":[{"__symbolic":"method"}],"showErrors":[{"__symbolic":"method"}],"hideErrorMessage":[{"__symbolic":"method"}],"hideWarningMessages":[{"__symbolic":"method"}],"showErrorMessage":[{"__symbolic":"method"}],"showWarningMessages":[{"__symbolic":"method"}]}}}}] |
@@ -25,5 +25,5 @@ import 'brace/mode/javascript'; | ||
static onlyMacros: boolean; | ||
private getAttributeCompletions(currentToken, iterator); | ||
private getFunctionCompletions(currentToken, iterator); | ||
private getMacroCompletions(); | ||
private getAttributeCompletions; | ||
private getFunctionCompletions; | ||
private getMacroCompletions; | ||
getCompletions(editor: ace.Editor, session: ace.IEditSession, position: { | ||
@@ -43,3 +43,3 @@ column: number; | ||
constructor(); | ||
private startAutocomplete(editor); | ||
private startAutocomplete; | ||
} | ||
@@ -46,0 +46,0 @@ export interface AceBehaviour { |
@@ -43,3 +43,2 @@ "use strict"; | ||
// see https://github.com/thlorenz/brace/pull/98 | ||
// see https://github.com/thlorenz/brace/pull/98 | ||
ace.define(exports.modeName, [], { Mode: XPathMode }); | ||
@@ -124,8 +123,8 @@ var Completer = /** @class */ (function () { | ||
/** | ||
* Only show attribute auto-completions. | ||
*/ | ||
* Only show attribute auto-completions. | ||
*/ | ||
Completer.onlyAttributes = false; | ||
/** | ||
* Only show macro auto-completions. | ||
*/ | ||
* Only show macro auto-completions. | ||
*/ | ||
Completer.onlyMacros = false; | ||
@@ -138,6 +137,3 @@ return Completer; | ||
*/ | ||
var /** | ||
* Add additional XPATH behavior to autocomplete macros, functions and attributes. | ||
*/ | ||
XPathBehaviour = /** @class */ (function (_super) { | ||
var XPathBehaviour = /** @class */ (function (_super) { | ||
__extends(XPathBehaviour, _super); | ||
@@ -144,0 +140,0 @@ function XPathBehaviour() { |
@@ -8,4 +8,4 @@ export declare class XPathVariablesRenderer { | ||
constructor(element: HTMLElement, source: string | JQuery, formName: string); | ||
private update(); | ||
private extract(xpath); | ||
private update; | ||
private extract; | ||
} | ||
@@ -16,3 +16,3 @@ export declare type CreateXPathVariablesRenderer = (options: { | ||
}) => JQuery; | ||
declare global { | ||
declare global { | ||
interface JQuery { | ||
@@ -22,2 +22,1 @@ xpathVariables: CreateXPathVariablesRenderer; | ||
} | ||
export {}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
var rxjs_1 = require("rxjs"); | ||
var operators_1 = require("rxjs/operators"); | ||
var ts_xpath_1 = require("ts-xpath"); | ||
@@ -12,3 +13,3 @@ var XPathVariablesRenderer = /** @class */ (function () { | ||
this.subject = new rxjs_1.BehaviorSubject(''); | ||
this.variables = this.subject.debounceTime(50).map(function (xpath) { return _this.extract(xpath); }).filter(function (variables) { return variables != null; }); | ||
this.variables = this.subject.pipe(operators_1.debounceTime(50), operators_1.map(function (xpath) { return _this.extract(xpath); }), operators_1.filter(function (variables) { return variables != null; })); | ||
var $element = $(element); | ||
@@ -15,0 +16,0 @@ this.source = $(source); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"XPathVariablesRenderer":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"error","message":"Could not resolve type","line":13,"character":55,"context":{"typeName":"JQuery"}},{"__symbolic":"reference","name":"string"}]}],"update":[{"__symbolic":"method"}],"extract":[{"__symbolic":"method"}]}},"ɵ0":{"__symbolic":"error","message":"Lambda not supported","line":48,"character":51},"CreateXPathVariablesRenderer":{"__symbolic":"interface"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"XPathVariablesRenderer":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":17,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"error","message":"Could not resolve type","line":17,"character":55,"context":{"typeName":"JQuery"}},{"__symbolic":"reference","name":"string"}]}],"update":[{"__symbolic":"method"}],"extract":[{"__symbolic":"method"}]}},"ɵ0":{"__symbolic":"error","message":"Lambda not supported","line":52,"character":51},"CreateXPathVariablesRenderer":{"__symbolic":"interface"}}}] |
export * from './common/index'; | ||
export * from './components/_index'; | ||
export * from './services/_index'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './common/index'; | ||
export * from './components/_jquery'; | ||
export * from './services/_jquery'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -15,2 +15,3 @@ // Karma configuration file, see link for more information | ||
require('karma-jasmine'), | ||
require('karma-jquery'), | ||
require('karma-es6-shim'), | ||
@@ -17,0 +18,0 @@ require('karma-chrome-launcher'), |
export declare class LassyXPathModule { | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
import * as i0 from '@angular/core'; | ||
import * as i1 from './lassy-xpath.module'; | ||
export declare const LassyXPathModuleNgFactory: i0.NgModuleFactory<i1.LassyXPathModule>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
var i5 = require("./services/reconstructor.service"); | ||
var LassyXPathModuleNgFactory = i0.ɵcmf(i1.LassyXPathModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(4608, i2.ParserService, i2.ParserService, []), i0.ɵmpd(4608, i3.MacroService, i3.MacroService, []), i0.ɵmpd(4608, i4.ExtractinatorService, i4.ExtractinatorService, []), i0.ɵmpd(4608, i5.ReconstructorService, i5.ReconstructorService, []), i0.ɵmpd(512, i1.LassyXPathModule, i1.LassyXPathModule, [])]); }); | ||
var LassyXPathModuleNgFactory = i0.ɵcmf(i1.LassyXPathModule, [], function (_l) { return i0.ɵmod([i0.ɵmpd(512, i0.ComponentFactoryResolver, i0.ɵCodegenComponentFactoryResolver, [[8, []], [3, i0.ComponentFactoryResolver], i0.NgModuleRef]), i0.ɵmpd(4608, i2.ParserService, i2.ParserService, []), i0.ɵmpd(4608, i3.MacroService, i3.MacroService, []), i0.ɵmpd(4608, i4.ExtractinatorService, i4.ExtractinatorService, []), i0.ɵmpd(4608, i5.ReconstructorService, i5.ReconstructorService, []), i0.ɵmpd(1073742336, i1.LassyXPathModule, i1.LassyXPathModule, [])]); }); | ||
exports.LassyXPathModuleNgFactory = LassyXPathModuleNgFactory; |
@@ -0,0 +0,0 @@ export * from './common/index'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "lassy-xpath", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "XPath format and editor for searching LASSY XML files", | ||
@@ -23,13 +23,13 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@angular/common": "^5.2.0", | ||
"@angular/compiler": "^5.2.0", | ||
"@angular/compiler-cli": "^5.2.0", | ||
"@angular/core": "^5.2.0", | ||
"@angular/forms": "^5.2.0", | ||
"@angular/http": "^5.2.0", | ||
"@angular/platform-server": "^5.2.0", | ||
"@types/es6-shim": "^0.31.36", | ||
"@angular/common": "^6.1.6", | ||
"@angular/compiler": "^6.1.6", | ||
"@angular/compiler-cli": "^6.1.6", | ||
"@angular/core": "^6.1.6", | ||
"@types/es6-shim": "^0.31.37", | ||
"@types/jasmine": "^2.8.6", | ||
"@types/jquery": "^3.3.1", | ||
"@types/node": "^10.9.4", | ||
"ajv": "^6.5.3", | ||
"copyfiles": "^2.0.0", | ||
"core-js": "^2.5.7", | ||
"jasmine": "^3.1.0", | ||
@@ -39,3 +39,3 @@ "jasmine-core": "^3.1.0", | ||
"jquery": "^3.3.1", | ||
"karma": "^2.0.0", | ||
"karma": "^3.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
@@ -46,9 +46,10 @@ "karma-coverage-istanbul-reporter": "^1.4.2", | ||
"karma-jasmine-html-reporter": "^1.0.0", | ||
"karma-jasmine-jquery": "^0.1.1", | ||
"karma-typescript": "^3.0.12", | ||
"karma-jquery": "^0.2.3", | ||
"karma-typescript": "^3.0.13", | ||
"karma-webpack": "^3.0.0", | ||
"rxjs": "^5.5.6", | ||
"rxjs": "^6.3.2", | ||
"ts-loader": "^4.1.0", | ||
"typescript": "<2.7", | ||
"webpack": "^4.1.1" | ||
"typescript": "2.9.2", | ||
"webpack": "^4.17.2", | ||
"zone.js": "^0.8.26" | ||
}, | ||
@@ -55,0 +56,0 @@ "dependencies": { |
@@ -9,3 +9,3 @@ [![Build Status](https://travis-ci.org/UUDigitalHumanitieslab/lassy-xpath.svg?branch=develop)](https://travis-ci.org/UUDigitalHumanitieslab/lassy-xpath) | ||
(Only tested in Angular 5) | ||
(Only tested in Angular 6) | ||
@@ -12,0 +12,0 @@ Import the module: |
@@ -0,0 +0,0 @@ export * from './parser'; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './_index'; | ||
export * from './macro.jquery'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from './_index'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -111,3 +111,3 @@ import { XPathModels } from 'ts-xpath'; | ||
}[]; | ||
private extractRecursively(parentName, children, nameGenerator); | ||
private extractRecursively; | ||
} | ||
@@ -114,0 +114,0 @@ export declare class FormatError { |
@@ -14,15 +14,3 @@ "use strict"; | ||
*/ | ||
/** | ||
* Extracts a variable for each node matched by the query. | ||
* @param xPath Query to analyse. | ||
* @throws {XPathModels.ParseError} The provided query is malformed. | ||
* @throws {FormatError} The provided query is in an unexpected format. | ||
*/ | ||
Extractinator.prototype.extract = /** | ||
* Extracts a variable for each node matched by the query. | ||
* @param xPath Query to analyse. | ||
* @throws {XPathModels.ParseError} The provided query is malformed. | ||
* @throws {FormatError} The provided query is in an unexpected format. | ||
*/ | ||
function (xPath) { | ||
Extractinator.prototype.extract = function (xPath) { | ||
if (!xPath || !xPath.trim()) { | ||
@@ -53,13 +41,3 @@ return []; | ||
*/ | ||
/** | ||
* Annotates the xpath and marks parts referencing any of the passed variables. | ||
* @param xPath | ||
* @param variables | ||
*/ | ||
Extractinator.prototype.annotate = /** | ||
* Annotates the xpath and marks parts referencing any of the passed variables. | ||
* @param xPath | ||
* @param variables | ||
*/ | ||
function (xPath, variables) { | ||
Extractinator.prototype.annotate = function (xPath, variables) { | ||
var annotated = this.parser.annotate(xPath); | ||
@@ -70,3 +48,3 @@ var result = []; | ||
if (token.type == 'node.name' && token.expression.properties.name == 'node') { | ||
// expect any query to at least start with //node | ||
// expect any query to at least start with //node | ||
var location_1 = getLocation(token.expression.properties.location); | ||
@@ -90,12 +68,23 @@ variable = variables.find(function (v) { return location_1.equals(v.location); }); | ||
// this is a level below the parent e.g. $parent/* | ||
var name_1 = nameGenerator(); | ||
for (var _a = 0, _b = child.steps; _a < _b.length; _a++) { | ||
var step = _b[_a]; | ||
if (step.properties.axis == 'child') { | ||
result.push({ name: name_1, path: parentName + "/" + child.toXPath(), location: getLocation(step.properties.location) }); | ||
result.push.apply(result, this.extractRecursively(name_1, step.predicates, nameGenerator)); | ||
switch (step.properties.axis) { | ||
case 'child': | ||
var name_1 = nameGenerator(); | ||
result.push({ | ||
name: name_1, | ||
path: parentName + "/" + child.toXPath(), | ||
location: getLocation(step.properties.location) | ||
}); | ||
result.push.apply(result, this.extractRecursively(name_1, step.predicates, nameGenerator)); | ||
break; | ||
case 'attribute': | ||
// We are only interested in nodes, | ||
// an attribute shouldn't be returned as | ||
// a separate path. | ||
break; | ||
default: | ||
console.error("Unknown axis type " + step.properties.axis); | ||
throw new FormatError('axis_type', [step.properties.axis]); | ||
} | ||
else { | ||
throw new FormatError('axis_type', [step.properties.axis]); | ||
} | ||
} | ||
@@ -102,0 +91,0 @@ break; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"Extractinator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}],"extract":[{"__symbolic":"method"}],"annotate":[{"__symbolic":"method"}],"extractRecursively":[{"__symbolic":"method"}]}},"FormatError":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":97,"character":29},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}]}},"PathVariable":{"__symbolic":"interface"},"Location":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"}]}],"equals":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"Extractinator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}],"extract":[{"__symbolic":"method"}],"annotate":[{"__symbolic":"method"}],"extractRecursively":[{"__symbolic":"method"}]}},"FormatError":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":111,"character":29},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}]}},"PathVariable":{"__symbolic":"interface"},"Location":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"},{"__symbolic":"reference","name":"number"}]}],"equals":[{"__symbolic":"method"}]}}}}] |
@@ -0,0 +0,0 @@ import { Extractinator } from './extractinator'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -44,2 +44,34 @@ "use strict"; | ||
}); | ||
it("Extracts attributes without value", function () { | ||
expectExtract('//node[node[@pt and @rel]]', [{ | ||
name: '$node1', | ||
path: '$node/node[@pt and @rel]', | ||
location: location(7) | ||
}]); | ||
expectExtract('//node[node[@pt and @rel or node[@cat]]]', [{ | ||
name: '$node1', | ||
path: '$node/node[@pt and @rel or node[@cat]]', | ||
location: location(7) | ||
}, { | ||
name: '$node2', | ||
path: '$node1/node[@cat]', | ||
location: location(28) | ||
}]); | ||
}); | ||
it("Extracts double predicates", function () { | ||
expectExtract('//node[@rel="obj1"][node[@rel="su"]]', [{ | ||
name: '$node1', | ||
path: '$node/node[@rel = "su"]', | ||
location: location(20) | ||
}]); | ||
expectExtract('//node[@rel="obj1"][node[@rel="su"][node[@cat and @pt]]]', [{ | ||
name: '$node1', | ||
path: '$node/node[@rel = "su"][node[@cat and @pt]]', | ||
location: location(20) | ||
}, { | ||
name: '$node2', | ||
path: '$node1/node[@cat and @pt]', | ||
location: location(36) | ||
}]); | ||
}); | ||
it("Extracts multiple children", function () { | ||
@@ -46,0 +78,0 @@ expectExtract('//node[@cat="smain" and node and node[@cat="np"]]', [{ name: '$node1', path: '$node/node', location: location(24) }, |
@@ -39,3 +39,3 @@ /** | ||
*/ | ||
private parseValues(data); | ||
private parseValues; | ||
} | ||
@@ -42,0 +42,0 @@ export declare type MacroLookup = { |
@@ -0,0 +0,0 @@ import { Macro } from './macro'; |
@@ -19,7 +19,3 @@ "use strict"; | ||
*/ | ||
var /** | ||
* The macro service is used to replace macro variables in the XPATH with the macro value. | ||
* This is done using the same syntax as used by PaQU e.g. `%PQ_example%`. | ||
*/ | ||
MacroService = /** @class */ (function (_super) { | ||
var MacroService = /** @class */ (function (_super) { | ||
__extends(MacroService, _super); | ||
@@ -33,11 +29,3 @@ function MacroService() { | ||
*/ | ||
/** | ||
* Loads the macro definitions from a URL. | ||
* @param url The URL of the macro definitions | ||
*/ | ||
MacroService.prototype.loadFromUrl = /** | ||
* Loads the macro definitions from a URL. | ||
* @param url The URL of the macro definitions | ||
*/ | ||
function (url) { | ||
MacroService.prototype.loadFromUrl = function (url) { | ||
var _this = this; | ||
@@ -44,0 +32,0 @@ return new Promise(function (resolve, reject) { |
@@ -12,4 +12,4 @@ "use strict"; | ||
/** | ||
* Waits for the definitions to be loaded | ||
*/ | ||
* Waits for the definitions to be loaded | ||
*/ | ||
this.onceLoaded = new Promise(function (resolve, reject) { | ||
@@ -29,11 +29,3 @@ _this.loaded = function () { | ||
*/ | ||
/** | ||
* Loads the macro definitions from the passed text data. | ||
* @param data The definitions to load. | ||
*/ | ||
Macro.prototype.loadFromText = /** | ||
* Loads the macro definitions from the passed text data. | ||
* @param data The definitions to load. | ||
*/ | ||
function (data) { | ||
Macro.prototype.loadFromText = function (data) { | ||
Macro.macroLookup = this.parseValues(data); | ||
@@ -51,15 +43,3 @@ this.loaded(); | ||
*/ | ||
/** | ||
* Find all the macro references in the specified XPATH and returns their replacements. | ||
* @param value | ||
* @returns The replacements which were performed (should be repeated sequentially) and the replacement results, | ||
* if no replacements were performed the result is false. | ||
*/ | ||
Macro.prototype.enrich = /** | ||
* Find all the macro references in the specified XPATH and returns their replacements. | ||
* @param value | ||
* @returns The replacements which were performed (should be repeated sequentially) and the replacement results, | ||
* if no replacements were performed the result is false. | ||
*/ | ||
function (value) { | ||
Macro.prototype.enrich = function (value) { | ||
var macroCalls = /%([^\%\s]+)%/g; | ||
@@ -109,15 +89,3 @@ var macroCall; | ||
*/ | ||
/** | ||
* Parses the macro definition text and returns all the macro names and their replacement values. | ||
* The macro definition should contain macro names (e.g. PQ_example) followed by the value to | ||
* place in the XPATH instead of this macro call, which is surrounded by """. | ||
* @param data The macro definition text | ||
*/ | ||
Macro.prototype.parseValues = /** | ||
* Parses the macro definition text and returns all the macro names and their replacement values. | ||
* The macro definition should contain macro names (e.g. PQ_example) followed by the value to | ||
* place in the XPATH instead of this macro call, which is surrounded by """. | ||
* @param data The macro definition text | ||
*/ | ||
function (data) { | ||
Macro.prototype.parseValues = function (data) { | ||
var macroLookup = {}; | ||
@@ -132,4 +100,4 @@ var macroPattern = /\b(.*)\b\s*=\s*"""([\s\S]*?)"""/g; | ||
/** | ||
* defined statically, to make it available in the XPATH mode | ||
*/ | ||
* defined statically, to make it available in the XPATH mode | ||
*/ | ||
Macro.macroLookup = {}; | ||
@@ -136,0 +104,0 @@ return Macro; |
@@ -0,0 +0,0 @@ import { Macro } from './macro'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -32,6 +32,6 @@ "use strict"; | ||
/** | ||
* Simulate performing multiple replacements in the editor sequentially | ||
* @param value | ||
* @param replacements | ||
*/ | ||
* Simulate performing multiple replacements in the editor sequentially | ||
* @param value | ||
* @param replacements | ||
*/ | ||
function performReplacements(value, replacements) { | ||
@@ -38,0 +38,0 @@ if (!replacements.length) { |
@@ -13,6 +13,6 @@ import { XPathModels } from 'ts-xpath'; | ||
format(xpath: string, indentSize?: number, indentCount?: number): string; | ||
private createWarning(message, location, offset?); | ||
private getWarnings(expressions); | ||
private getOperationWarnings(expression); | ||
private getPathWarnings(expression); | ||
private createWarning; | ||
private getWarnings; | ||
private getOperationWarnings; | ||
private getPathWarnings; | ||
} | ||
@@ -19,0 +19,0 @@ export interface ParsedXPath { |
@@ -48,15 +48,3 @@ "use strict"; | ||
*/ | ||
/** | ||
* Formats an xpath (add indentation and newlines). | ||
* @param xpath The xpath to format. | ||
* @param indentSize The indentation size of each step. | ||
* @param indentCount The zero-based count of the current level of indentation. | ||
*/ | ||
Parser.prototype.format = /** | ||
* Formats an xpath (add indentation and newlines). | ||
* @param xpath The xpath to format. | ||
* @param indentSize The indentation size of each step. | ||
* @param indentCount The zero-based count of the current level of indentation. | ||
*/ | ||
function (xpath, indentSize, indentCount) { | ||
Parser.prototype.format = function (xpath, indentSize, indentCount) { | ||
if (indentSize === void 0) { indentSize = 4; } | ||
@@ -63,0 +51,0 @@ if (indentCount === void 0) { indentCount = 0; } |
import { Parser } from "./parser"; | ||
export declare class ParserService extends Parser { | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -12,5 +12,5 @@ import { PathVariable } from './extractinator'; | ||
construct(variables: PathVariable[], xpath?: string): string; | ||
private constructRecursively(node, level?); | ||
private constructAttributes(expression); | ||
private indent(count, text); | ||
private constructRecursively; | ||
private constructAttributes; | ||
private indent; | ||
} |
@@ -15,15 +15,3 @@ "use strict"; | ||
*/ | ||
/** | ||
* Reconstructs a minimal tree matching the specified variables | ||
* @param variables The variables to analyse | ||
* @param variables The xpath to extract the root's properties from | ||
* @returns An XML node structure | ||
*/ | ||
Reconstructor.prototype.construct = /** | ||
* Reconstructs a minimal tree matching the specified variables | ||
* @param variables The variables to analyse | ||
* @param variables The xpath to extract the root's properties from | ||
* @returns An XML node structure | ||
*/ | ||
function (variables, xpath) { | ||
Reconstructor.prototype.construct = function (variables, xpath) { | ||
if (xpath === void 0) { xpath = null; } | ||
@@ -30,0 +18,0 @@ if (!variables || variables.length == 0) { |
@@ -0,0 +0,0 @@ import { Reconstructor } from './reconstructor'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ module.exports = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280587
29
3407