Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 74x 74x 72x 72x 79x 79x 72x 72x 71x 71x 71x 58x | import type { ParserMessage } from "./schema";
import { stripComments } from "@shared/parser-patterns";
import { SerialConfigurationParser } from "./parsers/serial-configuration-parser";
import { StructureParser } from "./parsers/structure-parser";
import { PerformanceParser } from "./parsers/performance-parser";
import { HardwareCompatibilityParser } from "./parsers/hardware-compatibility-parser";
import { PinConflictsParser } from "./parsers/pin-conflicts-parser";
export class CodeParser {
/**
* Parse Serial configuration issues
*/
parseSerialConfiguration(code: string): ParserMessage[] {
const parser = new SerialConfigurationParser(code);
return parser.parse();
}
/**
* Parse structure issues (setup/loop)
*/
parseStructure(code: string): ParserMessage[] {
const parser = new StructureParser(code);
return parser.parse();
}
/**
* Parse hardware compatibility issues
*/
parseHardwareCompatibility(code: string): ParserMessage[] {
const parser = new HardwareCompatibilityParser(code);
return parser.parse();
}
/**
* Parse pin conflicts (same pin used as digital and analog)
*/
parsePinConflicts(code: string): ParserMessage[] {
const parser = new PinConflictsParser(code);
return parser.parse();
}
/**
* Parse performance issues
*/
parsePerformance(code: string): ParserMessage[] {
const uncommentedCode = stripComments(code);
const parser = new PerformanceParser(uncommentedCode, code);
return [
...parser.analyzeComplexity(),
...parser.analyzeLargeArraysAndRecursion(),
];
}
/**
* Parse all categories and combine results
*/
parseAll(code: string): ParserMessage[] {
return [
...this.parseSerialConfiguration(code),
...this.parseStructure(code),
...this.parseHardwareCompatibility(code),
...this.parsePinConflicts(code),
...this.parsePerformance(code),
];
}
}
|