Implement count function
This commit is contained in:
parent
78fe5a2a85
commit
00eb9e97b6
|
@ -1,5 +1,5 @@
|
||||||
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„µ±Function´³refµ„³Function„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
||||||
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Function´³rec´³lit³count„´³tupleµ´³named³selector´³refµ„³Selector„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
||||||
ByteString´³lit³
|
ByteString´³lit³
|
||||||
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
||||||
Dictionary´³lit³
|
Dictionary´³lit³
|
||||||
|
|
|
@ -57,12 +57,17 @@ FILTER_SET = Symbol('set')
|
||||||
FILTER_DICT = Symbol('dict')
|
FILTER_DICT = Symbol('dict')
|
||||||
FILTER_EMBEDDED = Symbol('embedded')
|
FILTER_EMBEDDED = Symbol('embedded')
|
||||||
|
|
||||||
|
FUNCTION_COUNT = Symbol('count')
|
||||||
|
|
||||||
TRANSFORM_REAL = Symbol('~real')
|
TRANSFORM_REAL = Symbol('~real')
|
||||||
TRANSFORM_INT = Symbol('~int')
|
TRANSFORM_INT = Symbol('~int')
|
||||||
|
|
||||||
def parse_step(tokens):
|
def parse_step(tokens):
|
||||||
t = next(tokens)
|
t = next(tokens)
|
||||||
if isinstance(t, tuple): return syntax.Step.Filter(syntax.Filter.test(parse_predicate(iter(t))))
|
if isinstance(t, tuple): return syntax.Step.Filter(syntax.Filter.test(parse_predicate(t)))
|
||||||
|
if isinstance(t, Record):
|
||||||
|
if t.key == FUNCTION_COUNT: return syntax.Step.Function(syntax.Function(parse_selector(t.fields)))
|
||||||
|
raise ValueError('Invalid Preserves path function: ' + repr(t))
|
||||||
if t == AXIS_VALUES: return syntax.Step.Axis(syntax.Axis.values())
|
if t == AXIS_VALUES: return syntax.Step.Axis(syntax.Axis.values())
|
||||||
if t == AXIS_DESCENDANTS: return syntax.Step.Axis(syntax.Axis.descendants())
|
if t == AXIS_DESCENDANTS: return syntax.Step.Axis(syntax.Axis.descendants())
|
||||||
if t == AXIS_MEMBER: return syntax.Step.Axis(syntax.Axis.at(next(tokens)))
|
if t == AXIS_MEMBER: return syntax.Step.Axis(syntax.Axis.at(next(tokens)))
|
||||||
|
@ -88,11 +93,11 @@ def parse_step(tokens):
|
||||||
return syntax.Step.Filter(syntax.Filter.regex(re_val))
|
return syntax.Step.Filter(syntax.Filter.regex(re_val))
|
||||||
if t == FILTER_LABEL:
|
if t == FILTER_LABEL:
|
||||||
label_lit = next(tokens)
|
label_lit = next(tokens)
|
||||||
return syntax.Step.Test(syntax.Predicate.Selector(syntax.Selector([
|
return syntax.Step.Filter(syntax.Filter.test(syntax.Predicate.Selector(syntax.Selector([
|
||||||
syntax.Step.Axis(syntax.Axis.label()),
|
syntax.Step.Axis(syntax.Axis.label()),
|
||||||
syntax.Step.Filter(syntax.Filter.compare(
|
syntax.Step.Filter(syntax.Filter.compare(
|
||||||
syntax.Comparison.eq(),
|
syntax.Comparison.eq(),
|
||||||
label_lit))])))
|
label_lit))]))))
|
||||||
if t == TRANSFORM_REAL: return syntax.Step.Filter(syntax.Filter.real)
|
if t == TRANSFORM_REAL: return syntax.Step.Filter(syntax.Filter.real)
|
||||||
if t == TRANSFORM_INT: return syntax.Step.Filter(syntax.Filter.int)
|
if t == TRANSFORM_INT: return syntax.Step.Filter(syntax.Filter.int)
|
||||||
if t == FILTER_BOOL: return kind_filter(syntax.ValueKind.Boolean())
|
if t == FILTER_BOOL: return kind_filter(syntax.ValueKind.Boolean())
|
||||||
|
@ -181,6 +186,7 @@ def exec(self, v):
|
||||||
|
|
||||||
@extend(syntax.Step.Axis)
|
@extend(syntax.Step.Axis)
|
||||||
@extend(syntax.Step.Filter)
|
@extend(syntax.Step.Filter)
|
||||||
|
@extend(syntax.Step.Function)
|
||||||
def exec(self, v):
|
def exec(self, v):
|
||||||
return self.value.exec(v)
|
return self.value.exec(v)
|
||||||
|
|
||||||
|
@ -225,7 +231,7 @@ def exec(self, v):
|
||||||
@extend(syntax.Axis.label)
|
@extend(syntax.Axis.label)
|
||||||
def exec(self, v):
|
def exec(self, v):
|
||||||
v = preserve(_unwrap(v))
|
v = preserve(_unwrap(v))
|
||||||
return (v.label,) if isinstance(v, Record) else ()
|
return (v.key,) if isinstance(v, Record) else ()
|
||||||
|
|
||||||
@extend(syntax.Axis.keys)
|
@extend(syntax.Axis.keys)
|
||||||
def exec(self, v):
|
def exec(self, v):
|
||||||
|
@ -383,6 +389,10 @@ def exec(self, v):
|
||||||
def exec(self, v):
|
def exec(self, v):
|
||||||
return (v,) if isinstance(v, Embedded) else ()
|
return (v,) if isinstance(v, Embedded) else ()
|
||||||
|
|
||||||
|
@extend(syntax.Function)
|
||||||
|
def exec(self, v):
|
||||||
|
return (len(self.selector.exec(v)),)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
sel = parse(sys.argv[1])
|
sel = parse(sys.argv[1])
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from preserves import *
|
||||||
|
from preserves.path import parse
|
||||||
|
|
||||||
|
class BasicPathTests(unittest.TestCase):
|
||||||
|
def test_identity(self):
|
||||||
|
self.assertEqual(parse('').exec(1), (1,))
|
||||||
|
self.assertEqual(parse('').exec([]), ([],))
|
||||||
|
self.assertEqual(parse('').exec(Record(Symbol('hi'), [])), (Record(Symbol('hi'), []),))
|
||||||
|
|
||||||
|
def test_children(self):
|
||||||
|
self.assertEqual(parse('/').exec([1, 2, 3]), (1, 2, 3))
|
||||||
|
self.assertEqual(parse('/').exec([1, [2], 3]), (1, [2], 3))
|
||||||
|
self.assertEqual(parse('/').exec(Record(Symbol('hi'), [1, [2], 3])), (1, [2], 3))
|
||||||
|
|
||||||
|
def test_label(self):
|
||||||
|
self.assertEqual(parse('.^').exec([1, 2, 3]), ())
|
||||||
|
self.assertEqual(parse('.^').exec([1, [2], 3]), ())
|
||||||
|
self.assertEqual(parse('.^').exec(Record(Symbol('hi'), [1, [2], 3])), (Symbol('hi'),))
|
||||||
|
|
||||||
|
def test_count(self):
|
||||||
|
self.assertEqual(parse('<count / ^ hi>').exec([ Record(Symbol('hi'), [1]),
|
||||||
|
Record(Symbol('no'), [2]),
|
||||||
|
Record(Symbol('hi'), [3]) ]),
|
||||||
|
(2,))
|
||||||
|
self.assertEqual(parse('/ <count ^ hi>').exec([ Record(Symbol('hi'), [1]),
|
||||||
|
Record(Symbol('no'), [2]),
|
||||||
|
Record(Symbol('hi'), [3]) ]),
|
||||||
|
(1, 0, 1))
|
|
@ -1,5 +1,5 @@
|
||||||
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„µ±Function´³refµ„³Function„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
||||||
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Function´³rec´³lit³count„´³tupleµ´³named³selector´³refµ„³Selector„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
||||||
ByteString´³lit³
|
ByteString´³lit³
|
||||||
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
||||||
Dictionary´³lit³
|
Dictionary´³lit³
|
||||||
|
|
|
@ -93,6 +93,22 @@ fn parse_step<'a>(env: &Env, tokens: &'a [IOValue]) -> Result<Option<(path::Step
|
||||||
})), remainder)));
|
})), remainder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match tokens[0].value().as_record(None) {
|
||||||
|
None => (),
|
||||||
|
Some(r) => match r.label().value().as_symbol() {
|
||||||
|
None => return Err(CompilationError::InvalidStep),
|
||||||
|
Some(t) => match t.as_str() {
|
||||||
|
"count" => return Ok(Some((
|
||||||
|
path::Step::Function(Box::new(path::Function {
|
||||||
|
selector: parse_selector(env, r.fields())?,
|
||||||
|
})),
|
||||||
|
remainder
|
||||||
|
))),
|
||||||
|
_ => return Err(CompilationError::InvalidStep),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match tokens[0].value().as_symbol() {
|
match tokens[0].value().as_symbol() {
|
||||||
None => return Err(CompilationError::InvalidStep),
|
None => return Err(CompilationError::InvalidStep),
|
||||||
Some(t) => match t.as_str() {
|
Some(t) => match t.as_str() {
|
||||||
|
|
|
@ -95,15 +95,24 @@ struct KindStep {
|
||||||
step: Node,
|
step: Node,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct CountCollector {
|
||||||
|
count: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct CountStep {
|
||||||
|
step: Node,
|
||||||
|
counter: Node,
|
||||||
|
}
|
||||||
|
|
||||||
impl Node {
|
impl Node {
|
||||||
fn new<S: Step + 'static>(s: S) -> Self {
|
fn new<S: Step + 'static>(s: S) -> Self {
|
||||||
Node(Rc::new(RefCell::new(s)))
|
Node(Rc::new(RefCell::new(s)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test(&self, ctxt: &mut Context, value: &IOValue) -> bool {
|
pub fn test(&self, ctxt: &mut Context, value: &IOValue) -> bool {
|
||||||
self.accept(ctxt, value);
|
!self.exec(ctxt, value).is_empty()
|
||||||
self.finish();
|
|
||||||
!self.reset().is_empty()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn accept(&self, ctxt: &mut Context, value: &IOValue) {
|
pub fn accept(&self, ctxt: &mut Context, value: &IOValue) {
|
||||||
|
@ -145,6 +154,7 @@ impl StepMaker for path::Step {
|
||||||
match self {
|
match self {
|
||||||
path::Step::Axis(b) => (&**b).connect(step),
|
path::Step::Axis(b) => (&**b).connect(step),
|
||||||
path::Step::Filter(b) => (&**b).connect(step),
|
path::Step::Filter(b) => (&**b).connect(step),
|
||||||
|
path::Step::Function(b) => (&**b).connect(step),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,3 +428,40 @@ impl path::Selector {
|
||||||
Ok(self.compile()?.exec(ctxt, value))
|
Ok(self.compile()?.exec(ctxt, value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl StepMaker for path::Function {
|
||||||
|
fn connect(&self, step: Node) -> Result<Node, CompilationError> {
|
||||||
|
// For now, there's just one function: `count`.
|
||||||
|
Ok(Node::new(CountStep { step, counter: self.selector.connect(CountCollector::new())? }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CountCollector {
|
||||||
|
pub fn new() -> Node {
|
||||||
|
Node::new(CountCollector { count: 0 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Step for CountCollector {
|
||||||
|
fn accept(&mut self, _ctxt: &mut Context, _value: &IOValue) {
|
||||||
|
self.count += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
fn finish(&mut self) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reset(&mut self) -> Vec<IOValue> {
|
||||||
|
let result = vec![IOValue::new(self.count)];
|
||||||
|
self.count = 0;
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Step for CountStep {
|
||||||
|
fn accept(&mut self, ctxt: &mut Context, value: &IOValue) {
|
||||||
|
let count = &self.counter.exec(ctxt, value)[0];
|
||||||
|
self.step.accept(ctxt, count)
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate_finish_and_reset!(self, self.step);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
´³schema·³version‘³definitions·³Axis´³orµµ±values´³rec´³lit³values„´³tupleµ„„„„µ±descendants´³rec´³lit³descendants„´³tupleµ„„„„µ±at´³rec´³lit³at„´³tupleµ´³named³key³any„„„„„µ±label´³rec´³lit³label„´³tupleµ„„„„µ±keys´³rec´³lit³keys„´³tupleµ„„„„µ±length´³rec´³lit³length„´³tupleµ„„„„µ±annotations´³rec´³lit³annotations„´³tupleµ„„„„µ±embedded´³rec´³lit³embedded„´³tupleµ„„„„µ±parse´³rec´³lit³parse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„µ±unparse´³rec´³lit³unparse„´³tupleµ´³named³module´³seqof´³atom³Symbol„„„´³named³name´³atom³Symbol„„„„„„„„³Step´³orµµ±Axis´³refµ„³Axis„„µ±Filter´³refµ„³Filter„„µ±Function´³refµ„³Function„„„„³Filter´³orµµ±nop´³rec´³lit³nop„´³tupleµ„„„„µ±compare´³rec´³lit³compare„´³tupleµ´³named³op´³refµ„³
|
||||||
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
Comparison„„´³named³literal³any„„„„„µ±regex´³rec´³lit³regex„´³tupleµ´³named³regex´³atom³String„„„„„„µ±test´³rec´³lit³test„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±real´³rec´³lit³real„´³tupleµ„„„„µ±int´³rec´³lit³int„´³tupleµ„„„„µ±kind´³rec´³lit³kind„´³tupleµ´³named³kind´³refµ„³ ValueKind„„„„„„„„³Function´³rec´³lit³count„´³tupleµ´³named³selector´³refµ„³Selector„„„„„³Selector´³seqof´³refµ„³Step„„³ Predicate´³orµµ±Selector´³refµ„³Selector„„µ±not´³rec´³lit³not„´³tupleµ´³named³pred´³refµ„³ Predicate„„„„„„µ±or´³rec´³lit³or„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„µ±and´³rec´³lit³and„´³tupleµ´³named³preds´³seqof´³refµ„³ Predicate„„„„„„„„„³ ValueKind´³orµµ±Boolean´³lit³Boolean„„µ±Float´³lit³Float„„µ±Double´³lit³Double„„µ±
SignedInteger´³lit³
SignedInteger„„µ±String´³lit³String„„µ±
|
||||||
ByteString´³lit³
|
ByteString´³lit³
|
||||||
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
ByteString„„µ±Symbol´³lit³Symbol„„µ±Record´³lit³Record„„µ±Sequence´³lit³Sequence„„µ±Set´³lit³Set„„µ±
|
||||||
Dictionary´³lit³
|
Dictionary´³lit³
|
||||||
|
|
|
@ -9,7 +9,7 @@ Predicate =
|
||||||
/ <and @preds [Predicate ...]>
|
/ <and @preds [Predicate ...]>
|
||||||
.
|
.
|
||||||
|
|
||||||
Step = Axis / Filter .
|
Step = Axis / Filter / Function .
|
||||||
|
|
||||||
Axis =
|
Axis =
|
||||||
/ <values>
|
/ <values>
|
||||||
|
@ -41,3 +41,7 @@ ValueKind =
|
||||||
/ =Record / =Sequence / =Set / =Dictionary
|
/ =Record / =Sequence / =Set / =Dictionary
|
||||||
/ =Embedded
|
/ =Embedded
|
||||||
.
|
.
|
||||||
|
|
||||||
|
Function =
|
||||||
|
/ <count @selector Selector>
|
||||||
|
.
|
||||||
|
|
Loading…
Reference in New Issue