In a run command action, the basename specified for an input might not match the actual pathname of the source file. Thus, any diagnostics produced by a compiler would reference the wrong pathname.
For example, an action like the following:
let action = RunCommand{
inputs: ["source.cpp"],
...
};
graph.actions.insert(label, (action, [StaticFile("my/package/main.cpp")]));
Might produce a build log like this:
source.cpp: In function 'int f(int)':
source.cpp:3:12: error: 'y' was not declared in this scope
3 | return y;
| ^
If the user could specify a regular expression that matches input pathnames, such as ^[^:]+(?=:) in this case, then Snowflake could substitute the pathname for the basename in the build log, making it more useful and integrate better with text editors that scan for diagnostics. The build log would be transformed into this:
my/package/main.cpp: In function 'int f(int)':
my/package/main.cpp:3:12: error: 'y' was not declared in this scope
3 | return y;
| ^
Now I imagine that these sorts of patterns often need lookahead, which the regex crate does not support. Either we must switch to PCRE or have Snowflake look for the basename as a substring of the matched text.