compiler: Reworked Preprocessor To Support Better Error Messages

Can now support showing the trail of includes in an error
message.

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-22 20:40:49 -04:00
parent 041009a22e
commit bc51b4e280
8 changed files with 79 additions and 41 deletions
@@ -0,0 +1,9 @@
state start {
Testing ts;
ts.yesno = true;
ts.count = 5;
transition select (ts.yesno == "testing") {
true: accept;
false: reject;
};
}
@@ -0,0 +1,3 @@
parser main_parser() {
#include <file-loc-error-parser-state.p4>
};
+5
View File
@@ -0,0 +1,5 @@
struct Testing {
bool yesno;
int count;
};
#include <file-loc-error-parser.p4>
@@ -0,0 +1,3 @@
Error: In file-loc-error-parser-state.p4 included at position 23 in file-loc-error-parser.p4 included at position 51 in file-loc-error.p4, there was an error:
...ect (ts.yesno == "testing") {...
Could not parse transition select expression selector expression: Types of values used with binary expression are not the same