Skip to content

Commit

Permalink
Merge pull request kasecato#50 from PJB3005/regression-fixes
Browse files Browse the repository at this point in the history
Fixes kasecato#49 and CRLF issues.
  • Loading branch information
Keisuke KATO authored Jun 30, 2017
2 parents 0092b71 + d2211e2 commit 08044a4
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class SyntacticAnalysisCSharp {
* Public Method: Comment Type
*-----------------------------------------------------------------------*/
public static IsEnterKey(activeChar: string, text: string): boolean {
return (activeChar === '') && text.startsWith('\n');
return (activeChar === '') && (text.startsWith('\n') || text.startsWith("\r\n"));
}

public static IsSlashKey(activeChar: string): boolean {
Expand Down Expand Up @@ -129,18 +129,33 @@ export class SyntacticAnalysisCSharp {
}

public static HasMethodReturn(code: string): boolean {
if (code === null) return false;
if (code === null) {
return false;
}

{
const returns: RegExpMatchArray = code.match(/([\w\S]+)\s+[\w\S]+\s*\(.*\)/);
const isMatched = (returns !== null && returns.length === 2);
const isReserved = (returns[1].match(this.RESERVED_WORDS) !== null);
if (isMatched && !isReserved) return true;
if (isMatched)
{
const isReserved = (returns[1].match(this.RESERVED_WORDS) !== null);
if (!isReserved)
{
return true;
}
}
}
{
const returns: RegExpMatchArray = code.match(/([\w\S]+)\s+[\w\S]+\s+[\w\S]+\s*\(.*\)/);
const isMatched = (returns !== null && returns.length === 2);
const isReserved = (returns[1].match(this.RESERVED_WORDS) !== null);
if (isMatched && !isReserved) return true;
if (isMatched)
{
const isReserved = (returns[1].match(this.RESERVED_WORDS) !== null);
if (!isReserved)
{
return true;
}
}
}

return false;
Expand Down

0 comments on commit 08044a4

Please sign in to comment.