Browse Source

* Log.cs:

* ICSharpCode.NRefactory.csproj:
* CSharpParser.cs: 

* location.cs:
* cs-parser.cs:
* cs-parser.jay: Fixed optional semicolon location.
newNRvisualizers
Mike Krüger 14 years ago
parent
commit
0ee81980ec
  1. 10
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 1328
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  3. 10
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  4. 6
      ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs
  5. 10
      ICSharpCode.NRefactory.CSharp/Resolver/Log.cs
  6. 4
      ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj

10
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -3100,7 +3100,15 @@ namespace ICSharpCode.NRefactory.CSharp
while (true) { while (true) {
var nextLeaf = NextLeaf(leaf); var nextLeaf = NextLeaf(leaf);
// instert comment at the end // insert comment at begin
if (domComment.StartLocation < leaf.StartLocation) {
var node = leaf.Parent ?? conversionVisitor.Unit;
node.InsertChildBefore (leaf, domComment, AstNode.Roles.Comment);
leaf = domComment;
break;
}
// insert comment at the end
if (nextLeaf == null) { if (nextLeaf == null) {
var node = leaf.Parent ?? conversionVisitor.Unit; var node = leaf.Parent ?? conversionVisitor.Unit;
node.AddChild(domComment, AstNode.Roles.Comment); node.AddChild(domComment, AstNode.Roles.Comment);

1328
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

File diff suppressed because it is too large Load Diff

10
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -543,16 +543,14 @@ namespace_declaration
} }
opt_extern_alias_directives opt_using_directives opt_namespace_or_type_declarations CLOSE_BRACE opt_semicolon opt_extern_alias_directives opt_using_directives opt_namespace_or_type_declarations CLOSE_BRACE opt_semicolon
{ {
if ($11 != null)
lbag.AddLocation (current_namespace, GetLocation ($2), GetLocation ($5), GetLocation ($10), GetLocation ($11));
else
lbag.AddLocation (current_namespace, GetLocation ($2), GetLocation ($5), GetLocation ($10));
current_namespace = current_namespace.Parent; current_namespace = current_namespace.Parent;
current_class = current_namespace.SlaveDeclSpace; current_class = current_namespace.SlaveDeclSpace;
current_container = current_class.PartialContainer; current_container = current_class.PartialContainer;
ubag.CloseNamespace (GetLocation ($10)); ubag.CloseNamespace (GetLocation ($10));
ubag.EndNamespace (GetLocation ($10)); if ($11 != null)
ubag.EndNamespace (GetLocation ($11));
else
ubag.EndNamespace ();
} }
; ;

6
ICSharpCode.NRefactory.CSharp/Parser/mcs/location.cs

@ -897,6 +897,12 @@ if (checkpoints.Length <= CheckpointIndex) throw new Exception (String.Format ("
curNamespace.Pop (); curNamespace.Pop ();
} }
[Conditional ("FULL_AST")]
public void EndNamespace ()
{
curNamespace.Pop ();
}
[Conditional ("FULL_AST")] [Conditional ("FULL_AST")]
public void OpenNamespace (Location bracketLocation) public void OpenNamespace (Location bracketLocation)
{ {

10
ICSharpCode.NRefactory.CSharp/Resolver/Log.cs

@ -37,19 +37,19 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
{ {
const bool logEnabled = false; const bool logEnabled = false;
[Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")] // [Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")]
internal static void WriteLine(string text) internal static void WriteLine(string text)
{ {
Debug.WriteLine(text); Debug.WriteLine(text);
} }
[Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")] // [Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")]
internal static void WriteLine(string format, params object[] args) internal static void WriteLine(string format, params object[] args)
{ {
Debug.WriteLine(format, args); Debug.WriteLine(format, args);
} }
[Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")] // [Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")]
internal static void WriteCollection<T>(string text, IEnumerable<T> lines) internal static void WriteCollection<T>(string text, IEnumerable<T> lines)
{ {
#if DEBUG #if DEBUG
@ -65,13 +65,13 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
#endif #endif
} }
[Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")] // [Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")]
public static void Indent() public static void Indent()
{ {
Debug.Indent(); Debug.Indent();
} }
[Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")] // [Conditional(logEnabled ? "DEBUG" : "LOG_DISABLED")]
public static void Unindent() public static void Unindent()
{ {
Debug.Unindent(); Debug.Unindent();

4
ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</ProjectGuid> <ProjectGuid>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</ProjectGuid>
@ -20,8 +20,6 @@
<AssemblyOriginatorKeyFile>..\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign> <DelaySign>False</DelaySign>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> <AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>

Loading…
Cancel
Save