【计划】看Saxon把XQuery编译为语法树的这个过程,在哪里体现的。如果没有的话,要找出执行具体查询的代码段,贴到blog里面。
在语法分析阶段,需要建立语法树,下面的代码中,在解析了特定的Token以后,生成新的exp类,并通过setLocation,加入这个结构。虽然还没有具体的看Expression这个类,但,应该实现了类似的结构
private Expression parseOrExpression() throws StaticError {
Expression exp = parseAndExpression();
while (t.currentToken == Token.OR) {
nextToken();
exp = new BooleanExpression(exp, Token.OR, parseAndExpression());
setLocation(exp);
}
return exp;
}
在跟踪Saxon运行的状态下,反复看到一个输出的模式
int properties = (inheritNamespaces ? 0 : ReceiverOptions.DISINHERIT_NAMESPACES);
out.startElement(nameCode, typeCode, locationId, properties);

// output the required namespace nodes via a callback

outputNamespaceNodes(c2, out);

// process subordinate instructions to generate attributes and content
content.process(c2);

// output the element end tag (which will fail if validation fails)
out.endElement();
输出<tagname someNB someAttr> some content </tagname> 这个内容。还没有看到具体的处理过程。每一个 XQuery语法的语法要素都有对应的action对象,这块还是不理解。
NND ,脑子又开始乱了
在语法分析阶段,需要建立语法树,下面的代码中,在解析了特定的Token以后,生成新的exp类,并通过setLocation,加入这个结构。虽然还没有具体的看Expression这个类,但,应该实现了类似的结构









在跟踪Saxon运行的状态下,反复看到一个输出的模式












输出<tagname someNB someAttr> some content </tagname> 这个内容。还没有看到具体的处理过程。每一个 XQuery语法的语法要素都有对应的action对象,这块还是不理解。
NND ,脑子又开始乱了