Socket
Book a DemoInstallSign in
Socket

@getodk/tree-sitter-xpath

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getodk/tree-sitter-xpath - npm Package Compare versions

Comparing version

to
0.1.2

2

grammar.js

@@ -1,2 +0,2 @@

"use strict";const _=(e,a,r)=>choice(seq(e,a,r),r),t=/[_a-zA-Z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}]/u,i=/[-.\u{B7}0-9\u{0300}-\u{036F}\u{203F}-\u{2040}]/u,p=new RegExp([t.source,"(?:",t.source,"|",i.source,")*"].join(""),"u"),o=grammar({name:"xpath",inline:e=>[e._axis_specifier,e._local_part,e._prefix,e._axis_name],word:e=>e._nc_name,rules:{xpath:e=>e.expr,_location_path:e=>choice(e.relative_location_path,e.absolute_location_path),absolute_location_path:e=>choice(seq(e.absolute_root_location_path,optional(e._relative_location_path)),e.abbreviated_absolute_location_path),absolute_root_location_path:e=>e._slash,relative_location_path:e=>e._relative_location_path,_relative_location_path:e=>choice(e.step,seq(e._relative_location_path,e._slash,e.step),e._abbreviated_relative_location_path),step:e=>choice(seq(choice(e.axis_test,e.abbreviated_axis_test,e.node_test),repeat(e.predicate)),e.abbreviated_step),axis_test:e=>seq(e._axis_specifier,e._node_test),abbreviated_axis_test:e=>seq(e._abbreviated_axis_specifier,e._node_test),_axis_specifier:e=>choice(seq(e.axis_name,/::/)),axis_name:e=>e._axis_name,_axis_name:()=>choice(/ancestor/,/ancestor-or-self/,/attribute/,/child/,/descendant/,/descendant-or-self/,/following/,/following-sibling/,/namespace/,/parent/,/preceding/,/preceding-sibling/,/self/),node_test:e=>e._node_test,_node_test:e=>choice(e._name_test,e._axis_name,e.node_type_test,e.processing_instruction_name_test),processing_instruction_name_test:e=>seq(/processing-instruction\s*\(/,e.string_literal,/\)/),predicate:e=>seq(/\[/,e._predicate_expr,/\]/),_predicate_expr:e=>e.expr,abbreviated_absolute_location_path:e=>seq(token("//"),e._relative_location_path),_abbreviated_relative_location_path:e=>seq(e._relative_location_path,token("//"),e.step),abbreviated_step:e=>choice(alias(".",e.self),alias("..",e.parent)),_abbreviated_axis_specifier:()=>"@",expr:e=>e._expr,_expr:e=>e._or_expr,_primary_expr:e=>choice(e.variable_reference,seq(/\(/,e.expr,/\)/),e.string_literal,e.number,e.function_call),function_call:e=>seq(field("name",e.function_name),seq(/\(/,field("arguments",optional(seq(e.argument,repeat(seq(/,/,e.argument))))),/\)/)),function_name:e=>e._q_name,argument:e=>e.expr,union_expr:e=>prec(1,_(e._union_expr,/\|/,e._path_expr)),_union_expr:e=>prec(2,choice(e.union_expr,e._path_expr)),_path_expr:e=>choice(e._location_path,e.filter_path_expr),_slash:()=>token("/"),filter_path_expr:e=>e._filter_path_expr,_filter_path_expr:e=>seq(e.filter_expr,optional(seq(choice(e._slash,token("//")),e._relative_location_path))),filter_expr:e=>e._filter_expr,_filter_expr:e=>choice(e._primary_expr,seq(e._filter_expr,e.predicate)),or_expr:e=>prec(1,_(e._or_expr,/or/,e._and_expr)),_or_expr:e=>prec(2,choice(e.or_expr,e._and_expr)),and_expr:e=>prec(1,_(e._and_expr,/and/,e._equality_expr)),_and_expr:e=>prec(2,choice(e.and_expr,e._equality_expr)),ne_expr:e=>prec(1,_(e._equality_expr,/!=/,e._relational_expr)),eq_expr:e=>prec(1,_(e._equality_expr,/=/,e._relational_expr)),_equality_expr:e=>prec(2,choice(e.ne_expr,e.eq_expr,e._relational_expr)),lte_expr:e=>prec(1,_(e._relational_expr,/<=/,e._additive_expr)),lt_expr:e=>prec(1,_(e._relational_expr,/</,e._additive_expr)),gte_expr:e=>prec(1,_(e._relational_expr,/>=/,e._additive_expr)),gt_expr:e=>prec(1,_(e._relational_expr,/>/,e._additive_expr)),_relational_expr:e=>prec(2,choice(e.lte_expr,e.lt_expr,e.gte_expr,e.gt_expr,e._additive_expr)),addition_expr:e=>prec(1,_(e._additive_expr,/\+/,e._multiplicative_expr)),subtraction_expr:e=>prec(1,_(e._additive_expr,/-/,e._multiplicative_expr)),_additive_expr:e=>prec(2,choice(e.addition_expr,e.subtraction_expr,e._multiplicative_expr)),multiplication_expr:e=>prec(1,_(e._multiplicative_expr,e._multiply_operator,e._unary_expr)),division_expr:e=>prec(1,_(e._multiplicative_expr,e._divide_operator,e._unary_expr)),modulo_expr:e=>prec(1,_(e._multiplicative_expr,e._modulo_operator,e._unary_expr)),_multiplicative_expr:e=>prec(2,choice(e.multiplication_expr,e.division_expr,e.modulo_expr,e._unary_expr)),unary_expr:e=>seq(/-/,e._union_expr),_unary_expr:e=>choice(prec.right(e.unary_expr),e._union_expr),string_literal:e=>e._literal,_literal:()=>choice(/"[^"]*"/,/'[^']*'/),number:()=>choice(/\d+(\.\d*)?/,/\.\d+/),variable_reference:e=>seq(e._variable_reference,e.variable_reference),_variable_reference:e=>seq(/\$/,e._q_name),_name_test:e=>choice(e.unprefixed_wildcard_name_test,e.prefixed_wildcard_name_test,e._q_name),unprefixed_wildcard_name_test:e=>e._wildcard_name_test,prefixed_wildcard_name_test:e=>seq(e.prefix,/:/,e._wildcard_name_test),_wildcard_name_test:()=>"*",_q_name:e=>choice(e.prefixed_name,e.unprefixed_name),prefixed_name:e=>seq(e.prefix,/:/,e.local_part),unprefixed_name:e=>e._local_part,prefix:e=>e._prefix,_prefix:e=>e._nc_name,local_part:e=>e._local_part,_local_part:e=>e._nc_name,_nc_name:()=>p,_multiply_operator:()=>/\*/,_divide_operator:()=>prec(1,/div/),_modulo_operator:()=>prec(1,/mod/),node_type_test:()=>seq(choice(token(seq("comment",/\s*\(\s*\)/)),token(seq("node",/\s*\(\s*\)/)),token(seq("processing-instruction",/\s*\(\s*\)/)),token(seq("text",/\s*\(\s*\)/))))}});module.exports=o;
"use strict";const _=(e,t,r)=>choice(seq(e,t,r),r),a=/[_a-zA-Z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}]/u,i=/[-.\u{B7}0-9\u{0300}-\u{036F}\u{203F}-\u{2040}]/u,p=new RegExp([a.source,"(?:",a.source,"|",i.source,")*"].join(""),"u"),n=grammar({name:"xpath",inline:e=>[e._axis_specifier,e._local_part,e._prefix,e._axis_name],word:e=>e._nc_name,rules:{xpath:e=>e.expr,_location_path:e=>choice(e.relative_location_path,e.absolute_location_path),absolute_location_path:e=>choice(seq(e.absolute_root_location_path,optional(e._relative_location_path)),e.abbreviated_absolute_location_path),absolute_root_location_path:e=>e._slash,relative_location_path:e=>e._relative_location_path,_relative_location_path:e=>choice(e.step,seq(e._relative_location_path,e._slash,e.step),e._abbreviated_relative_location_path),step:e=>choice(seq(choice(e.axis_test,e.abbreviated_axis_test,e.node_test),repeat(e.predicate)),e.abbreviated_step),axis_test:e=>seq(e._axis_specifier,e._node_test),abbreviated_axis_test:e=>seq(e._abbreviated_axis_specifier,e._node_test),_axis_specifier:e=>choice(seq(e.axis_name,/::/)),axis_name:e=>e._axis_name,_axis_name:()=>choice(/ancestor/,/ancestor-or-self/,/attribute/,/child/,/descendant/,/descendant-or-self/,/following/,/following-sibling/,/namespace/,/parent/,/preceding/,/preceding-sibling/,/self/),node_test:e=>e._node_test,_node_test:e=>choice(e._name_test,alias(e._axis_name,e.unprefixed_name),e.node_type_test,e.processing_instruction_name_test),processing_instruction_name_test:e=>seq(/processing-instruction\s*\(/,e.string_literal,/\)/),predicate:e=>seq(/\[/,e._predicate_expr,/\]/),_predicate_expr:e=>e.expr,abbreviated_absolute_location_path:e=>seq(token("//"),e._relative_location_path),_abbreviated_relative_location_path:e=>seq(e._relative_location_path,token("//"),e.step),abbreviated_step:e=>choice(alias(".",e.self),alias("..",e.parent)),_abbreviated_axis_specifier:()=>"@",expr:e=>e._expr,_expr:e=>e._or_expr,_primary_expr:e=>choice(e.variable_reference,seq(/\(/,e.expr,/\)/),e.string_literal,e.number,e.function_call),function_call:e=>seq(field("name",e.function_name),seq(/\(/,field("arguments",optional(seq(e.argument,repeat(seq(/,/,e.argument))))),/\)/)),function_name:e=>e._q_name,argument:e=>e.expr,union_expr:e=>prec(1,_(e._union_expr,/\|/,e._path_expr)),_union_expr:e=>prec(2,choice(e.union_expr,e._path_expr)),_path_expr:e=>choice(e._location_path,e.filter_path_expr),_slash:()=>token("/"),filter_path_expr:e=>e._filter_path_expr,_filter_path_expr:e=>seq(e.filter_expr,optional(seq(choice(e._slash,token("//")),e._relative_location_path))),filter_expr:e=>e._filter_expr,_filter_expr:e=>choice(e._primary_expr,seq(e._filter_expr,e.predicate)),or_expr:e=>prec(1,_(e._or_expr,/or/,e._and_expr)),_or_expr:e=>prec(2,choice(e.or_expr,e._and_expr)),and_expr:e=>prec(1,_(e._and_expr,/and/,e._equality_expr)),_and_expr:e=>prec(2,choice(e.and_expr,e._equality_expr)),ne_expr:e=>prec(1,_(e._equality_expr,/!=/,e._relational_expr)),eq_expr:e=>prec(1,_(e._equality_expr,/=/,e._relational_expr)),_equality_expr:e=>prec(2,choice(e.ne_expr,e.eq_expr,e._relational_expr)),lte_expr:e=>prec(1,_(e._relational_expr,/<=/,e._additive_expr)),lt_expr:e=>prec(1,_(e._relational_expr,/</,e._additive_expr)),gte_expr:e=>prec(1,_(e._relational_expr,/>=/,e._additive_expr)),gt_expr:e=>prec(1,_(e._relational_expr,/>/,e._additive_expr)),_relational_expr:e=>prec(2,choice(e.lte_expr,e.lt_expr,e.gte_expr,e.gt_expr,e._additive_expr)),addition_expr:e=>prec(1,_(e._additive_expr,/\+/,e._multiplicative_expr)),subtraction_expr:e=>prec(1,_(e._additive_expr,/-/,e._multiplicative_expr)),_additive_expr:e=>prec(2,choice(e.addition_expr,e.subtraction_expr,e._multiplicative_expr)),multiplication_expr:e=>prec(1,_(e._multiplicative_expr,e._multiply_operator,e._unary_expr)),division_expr:e=>prec(1,_(e._multiplicative_expr,e._divide_operator,e._unary_expr)),modulo_expr:e=>prec(1,_(e._multiplicative_expr,e._modulo_operator,e._unary_expr)),_multiplicative_expr:e=>prec(2,choice(e.multiplication_expr,e.division_expr,e.modulo_expr,e._unary_expr)),unary_expr:e=>seq(/-/,e._union_expr),_unary_expr:e=>choice(prec.right(e.unary_expr),e._union_expr),string_literal:e=>e._literal,_literal:()=>choice(/"[^"]*"/,/'[^']*'/),number:()=>choice(/\d+(\.\d*)?/,/\.\d+/),variable_reference:e=>seq(e._variable_reference,e.variable_reference),_variable_reference:e=>seq(/\$/,e._q_name),_name_test:e=>choice(e.unprefixed_wildcard_name_test,e.prefixed_wildcard_name_test,e._q_name),unprefixed_wildcard_name_test:e=>e._wildcard_name_test,prefixed_wildcard_name_test:e=>seq(e.prefix,/:/,e._wildcard_name_test),_wildcard_name_test:()=>"*",_q_name:e=>choice(e.prefixed_name,e.unprefixed_name),prefixed_name:e=>seq(e.prefix,/:/,e.local_part),unprefixed_name:e=>e._local_part,prefix:e=>e._prefix,_prefix:e=>e._nc_name,local_part:e=>e._local_part,_local_part:e=>e._nc_name,_nc_name:()=>p,_multiply_operator:()=>/\*/,_divide_operator:()=>prec(1,/div/),_modulo_operator:()=>prec(1,/mod/),node_type_test:()=>seq(choice(token(seq("comment",/\s*\(\s*\)/)),token(seq("node",/\s*\(\s*\)/)),token(seq("processing-instruction",/\s*\(\s*\)/)),token(seq("text",/\s*\(\s*\)/))))}});module.exports=n;
//# sourceMappingURL=grammar.js.map
{
"name": "@getodk/tree-sitter-xpath",
"version": "0.1.1",
"version": "0.1.2",
"license": "Apache-2.0",

@@ -23,4 +23,4 @@ "description": "XPath grammar for tree-sitter",

"engines": {
"node": "^18.20.3 || ^20.13.1 || ^22.2.0",
"yarn": "1.22.19"
"node": "^18.20.4 || ^20.15.1 || ^22.4.1",
"yarn": "1.22.22"
},

@@ -37,13 +37,12 @@ "scripts": {

"test": "npm-run-all -nl test:*",
"test:grammar": "tree-sitter test",
"test:web": "playwright test",
"test:types": "tsc --project ./tsconfig.json"
"test:types": "tsc --project ./tsconfig.json",
"test:grammar": "tree-sitter test"
},
"devDependencies": {
"@asgerf/dts-tree-sitter": "^0.1.0",
"nan": "^2.19.0",
"nan": "2.20.0",
"node-gyp": "10.1.0",
"tree-sitter": "0.21.1",
"tree-sitter-cli": "0.22.6",
"vite": "^5.2.11",
"vite": "^5.3.3",
"web-tree-sitter": "0.22.6"

@@ -50,0 +49,0 @@ },

Sorry, the diff of this file is not supported yet