This commit is contained in:
2026-03-18 00:39:22 -07:00
commit c699640518
27 changed files with 3576 additions and 0 deletions

23
linter/BreakCheck.java Normal file
View File

@@ -0,0 +1,23 @@
// Nik Johnson
// 2-24-2024
// TA: Andy Ruan
import java.util.*;
// checks Strings for the characters "break" that come BEFORE the characters "//"
public class BreakCheck implements Check {
// if the line being checked has "break" in it
// after removing all single line comments, return a new error (code 2)
// takes line and line number
// returns error inside optional
public Optional<Error> lint(String line, int lineNumber) {
String input = line;
String output = input.replaceAll("//.*", "");
if (output.contains("break")) {
return Optional.of(new Error(2, lineNumber, "we cant use break in this class bro"));
}
return Optional.empty();
}
}