-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: issacto <[email protected]>
- Loading branch information
Showing
10 changed files
with
699 additions
and
15 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
33 changes: 33 additions & 0 deletions
33
vs code extension/client/src/services/CobolCheckInputParser.ts
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,33 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
const testCaseRegex = /^\s*(TESTCASE)\s*(.*)/i; | ||
// const testRegex = /^\s*(Expect)\s*(.*)\s*(not?)\s(>|<|to\s*be)\s*(.*)\s*/i; | ||
const testSuiteRegex = /^\s*(TESTSUITE)\s*(.*)/; | ||
|
||
export const parseMarkdown = (text: string, events: { | ||
onTest(range: vscode.Range, name: string): void; | ||
onHeading(range: vscode.Range, name: string, depth: number): void; | ||
}) => { | ||
const lines = text.split('\n'); | ||
|
||
for (let lineNo = 0; lineNo < lines.length; lineNo++) { | ||
const line = lines[lineNo]; | ||
|
||
const testCase = testCaseRegex.exec(line); | ||
if (testCase) { | ||
var [,pounds, name] = testCase; | ||
name = name.replace(/['"]+/g, ''); | ||
const range = new vscode.Range(new vscode.Position(lineNo, 0), new vscode.Position(lineNo, testCase[0].length)); | ||
events.onTest(range, name); | ||
continue; | ||
} | ||
|
||
|
||
const testSuite = testSuiteRegex.exec(line); | ||
if (testSuite) { | ||
var [,pounds, name] = testSuite; | ||
const range = new vscode.Range(new vscode.Position(lineNo, line.indexOf(pounds)), new vscode.Position(lineNo, line.indexOf(name) + name.length)); | ||
events.onHeading(range, name, 1); | ||
} | ||
} | ||
}; |
Oops, something went wrong.