Browse Source

Fixed unit tests with leading dots & integer at eol.

newNRvisualizers
Mike Krüger 15 years ago
parent
commit
d5ead16000
  1. 8
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs
  2. 5
      ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs
  3. 3
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs

8
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

@ -1514,6 +1514,7 @@ namespace Mono.CSharp @@ -1514,6 +1514,7 @@ namespace Mono.CSharp
#endif
number_pos = 0;
var loc = Location;
bool hasLeadingDot = c == '.';
if (c >= '0' && c <= '9'){
if (c == '0'){
@ -1545,7 +1546,6 @@ namespace Mono.CSharp @@ -1545,7 +1546,6 @@ namespace Mono.CSharp
putback ('.');
number_pos--;
val = res = adjust_int (-1, loc);
#if FULL_AST
res.ParsedValue = reader.ReadChars (read_start, reader.Position - 1);
#endif
@ -1595,9 +1595,11 @@ namespace Mono.CSharp @@ -1595,9 +1595,11 @@ namespace Mono.CSharp
}
val = res;
#if FULL_AST
res.ParsedValue = reader.ReadChars (read_start, reader.Position - (type == TypeCode.Empty ? 1 : 0));
var endPos = reader.Position - (type == TypeCode.Empty ? 1 : 0);
if (reader.GetChar (endPos - 1) == '\r')
endPos--;
res.ParsedValue = reader.ReadChars (hasLeadingDot ? read_start - 1 : read_start, endPos);
#endif
return Token.LITERAL;

5
ICSharpCode.NRefactory.CSharp/Parser/mcs/support.cs

@ -239,6 +239,11 @@ namespace Mono.CSharp { @@ -239,6 +239,11 @@ namespace Mono.CSharp {
return pos < char_count;
}
public char GetChar (int position)
{
return buffer[position];
}
public char[] ReadChars (int fromPosition, int toPosition)
{
char[] chars = new char[toPosition - fromPosition];

3
ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/PrimitiveExpressionTests.cs

@ -49,14 +49,12 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression @@ -49,14 +49,12 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression
Assert.AreEqual(code, pe.LiteralValue);
}
[Ignore("Fixme!")]
[Test]
public void DoubleWithLeadingDot()
{
CheckLiteral(".5e-06", .5e-06);
}
[Ignore("Fixme!")]
[Test]
public void FloatWithLeadingDot()
{
@ -228,7 +226,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression @@ -228,7 +226,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Expression
CheckLiteral(@"'\U00000041'", '\U00000041');
}
[Ignore("Fixme!")]
[Test]
public void TestPositionOfIntegerAtEndOfLine()
{

Loading…
Cancel
Save