-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,981 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { CommentSyntax } from "../Entity/Config/Contributes/Configuration"; | ||
import { SyntacticAnalysisCSharp } from "../SyntacticAnalysis/SyntacticAnalysisCSharp"; | ||
|
||
export class FormatterCSharp { | ||
|
||
/*------------------------------------------------------------------------- | ||
* Public Method: Formatter | ||
*-----------------------------------------------------------------------*/ | ||
public static Format(docommentList: string[], indent: string, syntax: CommentSyntax) { | ||
switch (syntax) { | ||
case CommentSyntax.single: | ||
return FormatterCSharp.FormatAsSingle(docommentList, indent, syntax); | ||
case CommentSyntax.delimited: | ||
return FormatterCSharp.FormatAsDelimited(docommentList, indent, syntax); | ||
} | ||
} | ||
|
||
/*------------------------------------------------------------------------- | ||
* Private Method: Formatter | ||
*-----------------------------------------------------------------------*/ | ||
private static FormatAsSingle(docommentList: string[], indent: string, syntax: CommentSyntax) { | ||
let docomment = ' ' + docommentList[0] + '\n'; | ||
for (let i = 1; i < docommentList.length; i++) { | ||
docomment += indent + SyntacticAnalysisCSharp.GetCommentSyntax(syntax) + ' ' + docommentList[i]; | ||
if (i !== docommentList.length - 1) { | ||
docomment += '\n'; | ||
} | ||
} | ||
return docomment; | ||
} | ||
|
||
private static FormatAsDelimited(docommentList: string[], indent: string, syntax: CommentSyntax) { | ||
let docomment = '\n'; | ||
for (let i = 0; i < docommentList.length; i++) { | ||
docomment += indent + ' ' + SyntacticAnalysisCSharp.GetCommentSyntax(syntax) + ' ' + docommentList[i]; | ||
if (i !== docommentList.length - 1) { | ||
docomment += '\n'; | ||
} | ||
} | ||
docomment += '\n'; | ||
docomment += indent; | ||
return docomment; | ||
} | ||
|
||
} |
Oops, something went wrong.