Skip to content

Commit

Permalink
Merge pull request #7 from Senior-Capstone-2024/exportFunc
Browse files Browse the repository at this point in the history
This code prints exported line information with error code at indicat…
  • Loading branch information
willeand authored Mar 13, 2024
2 parents d698d2d + cd35e15 commit b68ebc6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/findCapitalizedPrimitiveTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ export function findCapitalizedPrimitiveTypes() {

const pattern = /\b(?:int|double|Boolean|char|byte|long|String)\s+([A-Z])(\w*)\b/g;

const errorLines = []; // Array to store line numbers with errors
const errorLines: string[] = [];
// Array to store line numbers with errors
// Find matches
let match;
while ((match = pattern.exec(text)) !== null) {
// Get the matched variable name

const lineNumber = document.positionAt(match.index).line;
errorLines.push(lineNumber+1);
let lineNumber = document.positionAt(match.index).line;
lineNumber = lineNumber+1;
let myString: string = lineNumber.toString();
myString = "Improper Capitalized Primitive Type on line: " + myString;
errorLines.push(myString);

const variableName = match[0]; // Entire matched variable name
const firstLetterIndex = match.index + match[0].indexOf(match[1]); // Index of the first letter after the primitive data type
Expand Down

0 comments on commit b68ebc6

Please sign in to comment.