Robin,
this was a funny way of saying "not yet implemented"; we somehow forgot
about // in match patterns. Anyway, it was not too hard to fill it in.
The patch is attached. Apply it over Sablot-0.36-patch-3 I sent
yesterday (or the day before?)
Tom
[EMAIL PROTECTED] wrote:
>
> I'm afraid there seems to be another bug!
>
> It has something to do with the // operator, and is triggered
> by the attached short template/document combination.
>
> The crash happens both on vanilla Sablotron 0.36 and also with
> all the patches recently posted here applied.
>
> .robin.
>
> ------------------------------------------------------------------------
>
> bug3.xslName: bug3.xsl
> Type: Plain Text (text/plain)
>
> bug3.xmlName: bug3.xml
> Type: Plain Text (text/plain)
diff -Naur Sablot\expr.cpp Patch4\expr.cpp
--- Sablot\expr.cpp Thu Jun 29 13:14:02 2000
+++ Patch4\expr.cpp Thu Jun 29 13:04:20 2000
@@ -1218,7 +1225,7 @@
{
assert(type == EX_NODESET);
if (functor == EXF_LOCPATH)
- return(matchesLP(c));
+ return(matchesLP(c -> current(), args.number() - 1));
if (functor == EXFO_UNION)
{
int j, argsNumber = args.number();
@@ -2914,14 +2915,15 @@
return OK;
}
-Bool Expression::matchesLP(Context *c)
+Bool Expression::matchesLP(Vertex *v, int lastIndex)
{
assert(functor == EXF_LOCPATH);
- Vertex *v = c -> current();
+ // Vertex *v = c -> current();
int i;
LocStep *p;
Vertex *w = v;
- for (i = args.number()-1; i >= 0; i--)
+ // for (i = args.number()-1; i >= 0; i--)
+ for (i = lastIndex; i >= 0; i--)
{
if (!w) return FALSE;
p = args[i] -> step;
@@ -2940,8 +2942,18 @@
};
break;
case AXIS_DESC_OR_SELF:
- assert(0);
- // Err(ED_DESC_OR_SELF); - to be handled in parse
+ {
+ if (!p -> matches(w)) return FALSE;
+ Vertex *previous = w;
+ while (previous)
+ {
+ if (matchesLP(previous, i-1))
+ return TRUE;
+ else
+ previous = previous -> parent;
+ };
+ return FALSE;
+ }
break;
default:
assert(0); // bad axis in pattern
diff -Naur Sablot\expr.h Patch4\expr.h
--- Sablot\expr.h Fri Jun 02 13:39:34 2000
+++ Patch4\expr.h Thu Jun 29 13:04:20 2000
@@ -344,7 +356,7 @@
eFlag callFunc(Expression&, ExprList&, Context *);
eFlag parseBasic(Tokenizer &, int, int);
eFlag parseLP(Tokenizer&, int &, Bool = FALSE);
- Bool matchesLP(Context *);
+ Bool matchesLP(Vertex *v, int lastIndex);
Bool
isPattern;
Bool patternOK();