diff options
author | Piers Haken <piers@mono-cvs.ximian.com> | 2002-09-13 06:13:11 +0400 |
---|---|---|
committer | Piers Haken <piers@mono-cvs.ximian.com> | 2002-09-13 06:13:11 +0400 |
commit | 643a34dd9ad4af90f4b7fc9927b4b23a6ce75235 (patch) | |
tree | 945bdfbfb14d324a77bf4c363c06cf5fafb93888 /mcs/class/System.XML | |
parent | 62f60f873152e086694ae20e2409f8ce66b548f0 (diff) |
2002-09-12 Piers Haken <piersh@friskit.com>
* Expression.cs, Parser.jay: allow ExprSLASH to take a generic expression as its left argument.
* Iterator.cs: fix SlashIterator.Clone() when _iterRight is null.
* DefaultContext.cs: fix id() return type.
svn path=/trunk/mcs/; revision=7422
Diffstat (limited to 'mcs/class/System.XML')
6 files changed, 58 insertions, 50 deletions
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog index 97610b85bad..6422b7a379c 100644 --- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog @@ -1,3 +1,9 @@ +2002-09-12 Piers Haken <piersh@friskit.com> + + * Expression.cs, Parser.jay: allow ExprSLASH to take a generic expression as its left argument. + * Iterator.cs: fix SlashIterator.Clone() when _iterRight is null. + * DefaultContext.cs: fix id() return type. + 2002-09-03 Gonzalo Paniagua Javier <gonzalo@ximian.com> * DefaultContext.cs: fixed bug #28840. diff --git a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs index c13cdd3b59a..7c3fe746ca7 100644 --- a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs +++ b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs @@ -218,7 +218,7 @@ namespace System.Xml.XPath internal class XPathFunctionId : XPathFunction { private static char [] rgchWhitespace = {' ', '\t', '\r', '\n'}; - public override XPathResultType ReturnType { get { return XPathResultType.Number; }} + public override XPathResultType ReturnType { get { return XPathResultType.NodeSet; }} public override int Minargs { get { return 1; }} public override int Maxargs { get { return 1; }} public override XPathResultType [] ArgTypes { get { return new XPathResultType [] { XPathResultType.Any }; }} diff --git a/mcs/class/System.XML/System.Xml.XPath/Expression.cs b/mcs/class/System.XML/System.Xml.XPath/Expression.cs index edc09085641..cf8a1e0ad38 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Expression.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Expression.cs @@ -498,7 +498,7 @@ namespace System.Xml.XPath internal class ExprSLASH : NodeSet { protected Expression _left, _right; - public ExprSLASH (NodeSet left, NodeSet right) + public ExprSLASH (Expression left, NodeSet right) { _left = left; _right = right; diff --git a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs index 9584cf46f89..560cd8097ca 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs @@ -428,7 +428,8 @@ namespace System.Xml.XPath protected SlashIterator (SlashIterator other) : base (other) { _iterLeft = (BaseIterator) other._iterLeft.Clone (); - _iterRight = (BaseIterator) other._iterRight.Clone (); + if (other._iterRight != null) + _iterRight = (BaseIterator) other._iterRight.Clone (); _expr = other._expr; _pos = other._pos; } diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.cs b/mcs/class/System.XML/System.Xml.XPath/Parser.cs index 0da95f7ad54..3183c65271a 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Parser.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Parser.cs @@ -12,6 +12,7 @@ using System; using System.Xml.XPath; +using Test.Xml.XPath; namespace Mono.Xml.XPath { @@ -256,10 +257,10 @@ namespace Mono.Xml.XPath for (;; ++ yyTop) { if (yyTop >= yyStates.Length) { // dynamically increase int[] i = new int[yyStates.Length+yyMax]; - System.Array.Copy(yyStates, i, 0); + yyStates.CopyTo (i, 0); yyStates = i; Object[] o = new Object[yyVals.Length+yyMax]; - System.Array.Copy(yyVals, o, 0); + yyVals.CopyTo (o, 0); yyVals = o; } yyStates[yyTop] = yyState; @@ -440,27 +441,27 @@ case 28: case 30: // line 218 "Parser.jay" { - yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); + yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); } break; case 31: // line 222 "Parser.jay" { ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All)); - yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]); + yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]); } break; case 33: // line 231 "Parser.jay" { - yyVal = new ExprSLASH ((NodeSet) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); + yyVal = new ExprSLASH ((Expression) yyVals[-2+yyTop], (NodeSet) yyVals[0+yyTop]); } break; case 34: // line 235 "Parser.jay" { ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All)); - yyVal = new ExprSLASH (new ExprSLASH ((NodeSet) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]); + yyVal = new ExprSLASH (new ExprSLASH ((Expression) yyVals[-2+yyTop], exprStep), (NodeSet) yyVals[0+yyTop]); } break; case 35: @@ -476,183 +477,183 @@ case 36: } break; case 37: - // line 256 "Parser.jay" + // line 251 "Parser.jay" { yyVal = new ExprStep (new NodeTypeTest ((Axes) yyVals[-5+yyTop], (XPathNodeType) yyVals[-4+yyTop], (String) yyVals[-2+yyTop]), (ExprPredicates) yyVals[0+yyTop]); } break; case 38: - // line 260 "Parser.jay" + // line 255 "Parser.jay" { yyVal = new ExprStep (new NodeTypeTest (Axes.Self, XPathNodeType.All)); } break; case 39: - // line 264 "Parser.jay" + // line 259 "Parser.jay" { yyVal = new ExprStep (new NodeTypeTest (Axes.Parent, XPathNodeType.All)); } break; case 40: - // line 271 "Parser.jay" + // line 266 "Parser.jay" { yyVal = Axes.Child; } break; case 41: - // line 275 "Parser.jay" + // line 270 "Parser.jay" { yyVal = Axes.Attribute; } break; case 42: - // line 279 "Parser.jay" + // line 274 "Parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 43: - // line 285 "Parser.jay" + // line 280 "Parser.jay" { yyVal = XPathNodeType.Comment; } break; case 44: - // line 286 "Parser.jay" + // line 281 "Parser.jay" { yyVal = XPathNodeType.Text; } break; case 45: - // line 287 "Parser.jay" + // line 282 "Parser.jay" { yyVal = XPathNodeType.ProcessingInstruction; } break; case 46: - // line 288 "Parser.jay" + // line 283 "Parser.jay" { yyVal = XPathNodeType.All; } break; case 48: - // line 295 "Parser.jay" + // line 290 "Parser.jay" { yyVal = new ExprFilter ((Expression) yyVals[-1+yyTop], (Expression) yyVals[0+yyTop]); } break; case 49: - // line 302 "Parser.jay" + // line 297 "Parser.jay" { yyVal = new ExprVariable ((QName) yyVals[0+yyTop]); } break; case 50: - // line 306 "Parser.jay" + // line 301 "Parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 51: - // line 310 "Parser.jay" + // line 305 "Parser.jay" { yyVal = new ExprLiteral ((String) yyVals[0+yyTop]); } break; case 52: - // line 314 "Parser.jay" + // line 309 "Parser.jay" { yyVal = new ExprNumber ((double) yyVals[0+yyTop]); } break; case 54: - // line 322 "Parser.jay" + // line 317 "Parser.jay" { yyVal = new ExprFunctionCall ((String) yyVals[-3+yyTop], (FunctionArguments) yyVals[-1+yyTop]); } break; case 56: - // line 330 "Parser.jay" + // line 325 "Parser.jay" { yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]); } break; case 58: - // line 338 "Parser.jay" + // line 333 "Parser.jay" { yyVal = new FunctionArguments ((Expression) yyVals[-1+yyTop], (FunctionArguments) yyVals[0+yyTop]); } break; case 60: - // line 347 "Parser.jay" + // line 342 "Parser.jay" { yyVal = new ExprPredicates ((Expression) yyVals[-1+yyTop], (ExprPredicates) yyVals[0+yyTop]); } break; case 61: - // line 354 "Parser.jay" + // line 349 "Parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 62: - // line 360 "Parser.jay" + // line 355 "Parser.jay" { yyVal = Axes.Ancestor; } break; case 63: - // line 361 "Parser.jay" + // line 356 "Parser.jay" { yyVal = Axes.AncestorOrSelf; } break; case 64: - // line 362 "Parser.jay" + // line 357 "Parser.jay" { yyVal = Axes.Attribute; } break; case 65: - // line 363 "Parser.jay" + // line 358 "Parser.jay" { yyVal = Axes.Child; } break; case 66: - // line 364 "Parser.jay" + // line 359 "Parser.jay" { yyVal = Axes.Descendant; } break; case 67: - // line 365 "Parser.jay" + // line 360 "Parser.jay" { yyVal = Axes.DescendantOrSelf; } break; case 68: - // line 366 "Parser.jay" + // line 361 "Parser.jay" { yyVal = Axes.Following; } break; case 69: - // line 367 "Parser.jay" + // line 362 "Parser.jay" { yyVal = Axes.FollowingSibling; } break; case 70: - // line 368 "Parser.jay" + // line 363 "Parser.jay" { yyVal = Axes.Namespace; } break; case 71: - // line 369 "Parser.jay" + // line 364 "Parser.jay" { yyVal = Axes.Parent; } break; case 72: - // line 370 "Parser.jay" + // line 365 "Parser.jay" { yyVal = Axes.Preceding; } break; case 73: - // line 371 "Parser.jay" + // line 366 "Parser.jay" { yyVal = Axes.PrecedingSibling; } break; case 74: - // line 372 "Parser.jay" + // line 367 "Parser.jay" { yyVal = Axes.Self; } break; case 77: - // line 382 "Parser.jay" + // line 377 "Parser.jay" { yyVal = new NCName ((String) yyVals[0+yyTop]); } break; case 78: - // line 386 "Parser.jay" + // line 381 "Parser.jay" { yyVal = new QName ((String) yyVals[-2+yyTop], null); } break; case 79: - // line 390 "Parser.jay" + // line 385 "Parser.jay" { yyVal = new QName ((String) yyVals[-2+yyTop], (String) yyVals[0+yyTop]); } @@ -922,7 +923,7 @@ case 79: 271, -1, 273, }; - // line 396 "Parser.jay" + // line 391 "Parser.jay" } // line 929 "-" namespace yydebug { diff --git a/mcs/class/System.XML/System.Xml.XPath/Parser.jay b/mcs/class/System.XML/System.Xml.XPath/Parser.jay index 5c3906d19fc..5302dcfd2cd 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Parser.jay +++ b/mcs/class/System.XML/System.Xml.XPath/Parser.jay @@ -216,12 +216,12 @@ PathExpr | FilterExpr | FilterExpr SLASH RelativeLocationPath { - $$ = new ExprSLASH ((NodeSet) $1, (NodeSet) $3); + $$ = new ExprSLASH ((Expression) $1, (NodeSet) $3); } | FilterExpr SLASH2 RelativeLocationPath { ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All)); - $$ = new ExprSLASH (new ExprSLASH ((NodeSet) $1, exprStep), (NodeSet) $3); + $$ = new ExprSLASH (new ExprSLASH ((Expression) $1, exprStep), (NodeSet) $3); } ; @@ -229,12 +229,12 @@ RelativeLocationPath : Step | RelativeLocationPath SLASH Step { - $$ = new ExprSLASH ((NodeSet) $1, (NodeSet) $3); + $$ = new ExprSLASH ((Expression) $1, (NodeSet) $3); } | RelativeLocationPath SLASH2 Step { ExprStep exprStep = new ExprStep (new NodeTypeTest (Axes.DescendantOrSelf, XPathNodeType.All)); - $$ = new ExprSLASH (new ExprSLASH ((NodeSet) $1, exprStep), (NodeSet) $3); + $$ = new ExprSLASH (new ExprSLASH ((Expression) $1, exprStep), (NodeSet) $3); } ; |