|
wiRedPanda
Logic Circuit Simulator
|
Functions | |
| QString | removeForbiddenChars (const QString &input, const bool stripFirst=false) |
| Converts input into a legal language identifier. | |
| QString | sanitizeComment (const QString &input) |
| Makes input safe to embed in a single-line "//" comment. | |
| QString | stripAccents (const QString &input) |
| Strips Unicode diacritic marks (accents) from input using NFC → NFD decomposition. | |
|
inline |
Converts input into a legal language identifier.
Lowercases, trims whitespace, replaces spaces and dashes with underscores, removes all remaining non-word characters, prepends '_' if the result starts with a digit, and returns "_unnamed" for empty results.
| input | The raw string to sanitise. |
| stripFirst | If true, accent-strips input before processing (required for Arduino C++ identifiers; not needed for SystemVerilog). |
Definition at line 36 of file CodeGenUtils.h.
References stripAccents().
|
inline |
Makes input safe to embed in a single-line "//" comment.
Neutralizes embedded line breaks. Without this, a label containing "\n" (settable via a crafted .panda file's label field, or the MCP create_element/set_element_properties "label" parameter — neither restricts content beyond length) could break out of the comment and inject an arbitrary line into the generated Arduino/SystemVerilog file.
Definition at line 60 of file CodeGenUtils.h.
|
inline |
Strips Unicode diacritic marks (accents) from input using NFC → NFD decomposition.
Definition at line 18 of file CodeGenUtils.h.
Referenced by removeForbiddenChars().