Browse Source

Renamed RawCommentKind to CommentKind.

pull/769/head
Joao Matos 9 years ago
parent
commit
9a4c0bae82
  1. 54
      src/AST/Comment.cs
  2. 2
      src/Generator/Generators/CLI/CLIHeaders.cs
  3. 2
      src/Generator/Generators/CLI/CLISources.cs
  4. 2
      src/Generator/Generators/CSharp/CSharpSources.cs
  5. 4
      src/Generator/Generators/CodeGenerator.cs
  6. 18
      src/Parser/ASTConverter.cs

54
src/AST/Comment.cs

@ -4,9 +4,9 @@ using System.Collections.Generic;
namespace CppSharp.AST namespace CppSharp.AST
{ {
/// <summary> /// <summary>
/// Raw comment kind. /// Comment kind.
/// </summary> /// </summary>
public enum RawCommentKind public enum CommentKind
{ {
// Invalid comment. // Invalid comment.
Invalid, Invalid,
@ -53,7 +53,7 @@ namespace CppSharp.AST
/// <summary> /// <summary>
/// Kind of the comment. /// Kind of the comment.
/// </summary> /// </summary>
public RawCommentKind Kind; public CommentKind Kind;
/// <summary> /// <summary>
/// Raw text of the comment. /// Raw text of the comment.
@ -70,7 +70,7 @@ namespace CppSharp.AST
/// </summary> /// </summary>
public bool IsInvalid public bool IsInvalid
{ {
get { return Kind == RawCommentKind.Invalid; } get { return Kind == CommentKind.Invalid; }
} }
/// <summary> /// <summary>
@ -80,8 +80,8 @@ namespace CppSharp.AST
{ {
get get
{ {
return Kind == RawCommentKind.OrdinaryBCPL || return Kind == CommentKind.OrdinaryBCPL ||
Kind == RawCommentKind.OrdinaryC; Kind == CommentKind.OrdinaryC;
} }
} }
@ -127,55 +127,55 @@ namespace CppSharp.AST
public abstract void Visit<T>(ICommentVisitor<T> visitor); public abstract void Visit<T>(ICommentVisitor<T> visitor);
public static string GetMultiLineCommentPrologue(RawCommentKind kind) public static string GetMultiLineCommentPrologue(CommentKind kind)
{ {
switch (kind) switch (kind)
{ {
case RawCommentKind.OrdinaryBCPL: case CommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLExcl: case CommentKind.BCPLExcl:
return "//"; return "//";
case RawCommentKind.OrdinaryC: case CommentKind.OrdinaryC:
case RawCommentKind.JavaDoc: case CommentKind.JavaDoc:
case RawCommentKind.Qt: case CommentKind.Qt:
return " *"; return " *";
case RawCommentKind.BCPLSlash: case CommentKind.BCPLSlash:
return "///"; return "///";
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
} }
public static string GetLineCommentPrologue(RawCommentKind kind) public static string GetLineCommentPrologue(CommentKind kind)
{ {
switch (kind) switch (kind)
{ {
case RawCommentKind.OrdinaryBCPL: case CommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLSlash: case CommentKind.BCPLSlash:
return string.Empty; return string.Empty;
case RawCommentKind.OrdinaryC: case CommentKind.OrdinaryC:
return "/*"; return "/*";
case RawCommentKind.BCPLExcl: case CommentKind.BCPLExcl:
return "//!"; return "//!";
case RawCommentKind.JavaDoc: case CommentKind.JavaDoc:
return "/**"; return "/**";
case RawCommentKind.Qt: case CommentKind.Qt:
return "/*!"; return "/*!";
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
} }
public static string GetLineCommentEpilogue(RawCommentKind kind) public static string GetLineCommentEpilogue(CommentKind kind)
{ {
switch (kind) switch (kind)
{ {
case RawCommentKind.OrdinaryBCPL: case CommentKind.OrdinaryBCPL:
case RawCommentKind.BCPLSlash: case CommentKind.BCPLSlash:
case RawCommentKind.BCPLExcl: case CommentKind.BCPLExcl:
return string.Empty; return string.Empty;
case RawCommentKind.OrdinaryC: case CommentKind.OrdinaryC:
case RawCommentKind.JavaDoc: case CommentKind.JavaDoc:
case RawCommentKind.Qt: case CommentKind.Qt:
return " */"; return " */";
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();

2
src/Generator/Generators/CLI/CLIHeaders.cs

@ -21,7 +21,7 @@ namespace CppSharp.Generators.CLI
public override void Process() public override void Process()
{ {
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL); GenerateFilePreamble(CommentKind.OrdinaryBCPL);
PushBlock(CLIBlockKind.Includes); PushBlock(CLIBlockKind.Includes);
WriteLine("#pragma once"); WriteLine("#pragma once");

2
src/Generator/Generators/CLI/CLISources.cs

@ -24,7 +24,7 @@ namespace CppSharp.Generators.CLI
public override void Process() public override void Process()
{ {
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL); GenerateFilePreamble(CommentKind.OrdinaryBCPL);
var file = Path.GetFileNameWithoutExtension(TranslationUnit.FileName) var file = Path.GetFileNameWithoutExtension(TranslationUnit.FileName)
.Replace('\\', '/'); .Replace('\\', '/');

2
src/Generator/Generators/CSharp/CSharpSources.cs

@ -144,7 +144,7 @@ namespace CppSharp.Generators.CSharp
public override void Process() public override void Process()
{ {
GenerateFilePreamble(RawCommentKind.OrdinaryBCPL); GenerateFilePreamble(CommentKind.OrdinaryBCPL);
GenerateUsings(); GenerateUsings();

4
src/Generator/Generators/CodeGenerator.cs

@ -40,7 +40,7 @@ namespace CppSharp.Generators
return base.Generate(); return base.Generate();
} }
public void GenerateMultiLineComment(List<string> lines, RawCommentKind kind) public void GenerateMultiLineComment(List<string> lines, CommentKind kind)
{ {
var lineCommentPrologue = Comment.GetLineCommentPrologue(kind); var lineCommentPrologue = Comment.GetLineCommentPrologue(kind);
if (!string.IsNullOrWhiteSpace(lineCommentPrologue)) if (!string.IsNullOrWhiteSpace(lineCommentPrologue))
@ -55,7 +55,7 @@ namespace CppSharp.Generators
WriteLine("{0}", lineCommentEpilogue); WriteLine("{0}", lineCommentEpilogue);
} }
public virtual void GenerateFilePreamble(RawCommentKind kind) public virtual void GenerateFilePreamble(CommentKind kind)
{ {
var lines = new List<string> var lines = new List<string>
{ {

18
src/Parser/ASTConverter.cs

@ -887,26 +887,26 @@ namespace CppSharp
return _rawComment; return _rawComment;
} }
private AST.RawCommentKind ConvertRawCommentKind(RawCommentKind kind) private AST.CommentKind ConvertRawCommentKind(RawCommentKind kind)
{ {
switch (kind) switch (kind)
{ {
case RawCommentKind.Invalid: case RawCommentKind.Invalid:
return AST.RawCommentKind.Invalid; return AST.CommentKind.Invalid;
case RawCommentKind.OrdinaryBCPL: case RawCommentKind.OrdinaryBCPL:
return AST.RawCommentKind.OrdinaryBCPL; return AST.CommentKind.OrdinaryBCPL;
case RawCommentKind.OrdinaryC: case RawCommentKind.OrdinaryC:
return AST.RawCommentKind.OrdinaryC; return AST.CommentKind.OrdinaryC;
case RawCommentKind.BCPLSlash: case RawCommentKind.BCPLSlash:
return AST.RawCommentKind.BCPLSlash; return AST.CommentKind.BCPLSlash;
case RawCommentKind.BCPLExcl: case RawCommentKind.BCPLExcl:
return AST.RawCommentKind.BCPLExcl; return AST.CommentKind.BCPLExcl;
case RawCommentKind.JavaDoc: case RawCommentKind.JavaDoc:
return AST.RawCommentKind.JavaDoc; return AST.CommentKind.JavaDoc;
case RawCommentKind.Qt: case RawCommentKind.Qt:
return AST.RawCommentKind.Qt; return AST.CommentKind.Qt;
case RawCommentKind.Merged: case RawCommentKind.Merged:
return AST.RawCommentKind.Merged; return AST.CommentKind.Merged;
default: default:
throw new ArgumentOutOfRangeException("kind"); throw new ArgumentOutOfRangeException("kind");
} }

Loading…
Cancel
Save