diff options
author | Piers Haken <piers@mono-cvs.ximian.com> | 2002-09-13 07:17:22 +0400 |
---|---|---|
committer | Piers Haken <piers@mono-cvs.ximian.com> | 2002-09-13 07:17:22 +0400 |
commit | 474fe75047be480c60ff1920408576ab5865346c (patch) | |
tree | 9e4e6ac49c9b36668c194f76596eed420597f62e /mcs/class/System.XML | |
parent | a49dae415fb3b9e52245937b051272451b219c48 (diff) |
2002-09-12 Piers Haken <piersh@friskit.com>
* Tokenizer.cs: fix parsing numbers that start with '.'
* DefaultContext.cs: use MS-compatible formatting of doubles
svn path=/trunk/mcs/; revision=7427
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r-- | mcs/class/System.XML/System.Xml.XPath/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs | 2 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs | 15 |
3 files changed, 18 insertions, 4 deletions
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog index 7bb08217914..af46b514b37 100644 --- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog @@ -1,5 +1,10 @@ 2002-09-12 Piers Haken <piersh@friskit.com> + * Tokenizer.cs: fix parsing numbers that start with '.' + * DefaultContext.cs: use MS-compatible formatting of doubles + +2002-09-12 Piers Haken <piersh@friskit.com> + * Iterator.cs: added NullIterator to handle unspecified contexts * XPathNavigator.cs: use NullIterator insted of SelfIterator when context is unspecified. * XPathNodeIterator.cs: change default _count to -1 to prevent recalculations for NullIterators diff --git a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs index 7c3fe746ca7..ed27d168858 100644 --- a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs +++ b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs @@ -137,7 +137,7 @@ namespace System.Xml.XPath if (arg is bool) return ((bool) arg) ? "true" : "false"; if (arg is double) - return (string) XmlConvert.ToString ((double) arg); // TODO: spec? convert number to string + return ((double) arg).ToString ("R", System.Globalization.NumberFormatInfo.InvariantInfo); if (arg is BaseIterator) { BaseIterator iter = (BaseIterator) arg; diff --git a/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs b/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs index 990fb18509f..df94f5703e8 100644 --- a/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs +++ b/mcs/class/System.XML/System.Xml.XPath/Tokenizer.cs @@ -77,6 +77,13 @@ namespace System.Xml.XPath return m_rgchInput [m_ich++]; } + private int PutBack () + { + if (m_ich == 0) + throw new Exception (); // TODO: better description + return m_rgchInput [--m_ich]; + } + private void SkipWhitespace () { while (IsWhitespace (Peek ())) @@ -165,7 +172,8 @@ namespace System.Xml.XPath int ParseToken () { - switch (Peek ()) + int ch = Peek (); + switch (ch) { case -1: return Token.EOF; @@ -186,8 +194,9 @@ namespace System.Xml.XPath GetChar (); return Token.DOT2; } - else if (Peek () >= '0' && Peek () <= '9') + else if (IsDigit (Peek ())) { + PutBack (); return ParseNumber (); } return Token.DOT; @@ -284,7 +293,7 @@ namespace System.Xml.XPath default: { - if (IsDigit (Peek ())) + if (IsDigit (ch)) { return ParseNumber (); } |