Browse Source

Update string resources.

Improve lexer code determining the type of integer literals.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2639 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts 2.2.1
Daniel Grunwald 18 years ago
parent
commit
5f9f3db75c
  1. BIN
      data/resources/StringResources.cz.resources
  2. BIN
      data/resources/StringResources.es-mx.resources
  3. BIN
      data/resources/StringResources.es.resources
  4. BIN
      data/resources/StringResources.nl.resources
  5. BIN
      data/resources/StringResources.se.resources
  6. BIN
      data/resources/StringResources.tr.resources
  7. 17
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  8. 9
      src/Libraries/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs

BIN
data/resources/StringResources.cz.resources

Binary file not shown.

BIN
data/resources/StringResources.es-mx.resources

Binary file not shown.

BIN
data/resources/StringResources.es.resources

Binary file not shown.

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

BIN
data/resources/StringResources.se.resources

Binary file not shown.

BIN
data/resources/StringResources.tr.resources

Binary file not shown.

17
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -320,29 +320,26 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -320,29 +320,26 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
}
}
// Try to determine a parsable value using ranges. (Quick hack!)
decimal d = 0;
// Try to determine a parsable value using ranges.
ulong result;
if (ishex) {
ulong result;
if (ulong.TryParse(digit, NumberStyles.HexNumber, null, out result)) {
d = result;
} else {
if (!ulong.TryParse(digit, NumberStyles.HexNumber, null, out result)) {
errors.Error(y, x, String.Format("Can't parse hexadecimal constant {0}", digit));
return new Token(Tokens.Literal, x, y, stringValue.ToString(), 0);
}
} else {
if (!decimal.TryParse(digit, NumberStyles.Integer, null, out d)) {
if (!ulong.TryParse(digit, NumberStyles.Integer, null, out result)) {
errors.Error(y, x, String.Format("Can't parse integral constant {0}", digit));
return new Token(Tokens.Literal, x, y, stringValue.ToString(), 0);
}
}
if (d < long.MinValue || d > long.MaxValue) {
if (result > long.MaxValue) {
islong = true;
isunsigned = true;
} else if (d < uint.MinValue || d > uint.MaxValue) {
} else if (result > uint.MaxValue) {
islong = true;
} else if (d < int.MinValue || d > int.MaxValue) {
} else if (result > int.MaxValue) {
isunsigned = true;
}

9
src/Libraries/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs

@ -33,6 +33,15 @@ namespace ICSharpCode.NRefactory.Tests.Ast @@ -33,6 +33,15 @@ namespace ICSharpCode.NRefactory.Tests.Ast
CheckSimpleObjectCreateExpression(ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new MyObject(1, 2, 3)"));
}
[Test]
public void CSharpNullableObjectCreateExpressionTest()
{
ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new IntPtr?(1)");
Assert.AreEqual("System.Nullable", oce.CreateType.SystemType);
Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
Assert.AreEqual("IntPtr", oce.CreateType.GenericTypes[0].Type);
}
[Test]
public void CSharpInvalidNestedObjectCreateExpressionTest()
{

Loading…
Cancel
Save