SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
regex.py
1"""Regex definitions for logging"""
2
3STATE_PASS = r"\" *(\S+.*?) +(?i:state)\s*\"" # TODO: check for state in TAG or SXX check
4
5SPECIAL_PASS = (
6 r"_LogPrebuildString\s*\‍(\s*(\".*?\")\s*\‍)" # _LogPrebuildString("Str") # Special case where we can indirectly allocate a string
7)
8SPECIAL_FAIL = r"_LogPrebuildString\s*\‍(\s*([^\"]*?)\s*\‍)" # TODO: finish coverage on fail regex
9
10TAG_PASS = r"LOG_TAG(?= )\s*[^\"=]+?=\s*(\"\s*\S.*\")\s*;" # LOG_TAG idVar = "ID"; # Where ID cannot be blank
11TAG_FAIL = r"(?:LOG_TAG(?= )\s*[^\"=]+?=\s*)(?:[^\"=]+?|\"\s*\")\s*;" # Implicit, single char, or empty string definition of a tag type
12
13CALL_SS = r"(?:Log\s*\.*\s*([diwefp])?\s*\‍(\s*(\"\s*\S(?:\\.|[^\"])+\")\s*,\s*(\"(\\.|[^\"])*\")\s*\‍)\s*;)" # -> Log("Str", "Str");
14CALL_VS = r"(?:Log\s*\.*\s*([diwefp])?\s*\‍(\s*([^\"]+?)\s*,\s*(\"(?:\\.|[^\"])*\")\s*\‍)\s*;)" # -> Log(Var, "Str");
15CALL_SSV = (
16 r"(?:Log\s*\.*\s*([diwefp])?\s*\‍(\s*(\"\s*\S(?:\\.|[^\"])+\")\s*,\s*(\".*?\")\s*,\s*(.+?)\s*\‍)\s*;)" # -> Log("Str", "Str", Var);
17)
18CALL_VSV = r"(?:Log\s*\.*\s*([diwefp])?\s*\‍(\s*([^\"]+?)\s*,\s*(\".*?\")\s*,\s*(.+?)\s*\‍)\s*;)" # -> Log(Var, "Str", Var);
19CALL_ERR_LITERAL = r"(?:(Log\s*\.*\s*(?:[diwefp])?\s*\‍(\s*(?:[^\"]+?|\"(?:[^\"]|\\\")*?\")\s*,\s*)([^\";]+?)(\s*(?:,\s*(?:.+?))?\s*\‍)\s*;))" # Message string is not a literal string | IDE will warn about numbers but will still compile
20CALL_ERR_BLANK = r"(?:(Log\s*\.*\s*(?:[diwefp])?\s*\‍(\s*)(\"\s*\")(\s*,.*?\‍)\s*;))" # Blank string ID