p4lang / p4analyzer

A Language Server Protocol (LSP) compliant analyzer for the P4 language
Apache License 2.0
19 stars 3 forks source link

Support both quotation styles on `'#include'` #31

Open timjroberts opened 1 year ago

timjroberts commented 1 year ago

Currently the preprocessor only considers relative paths, and it also doesn't consider the quotation style. As such, an include in the form '#include "core.p4"' will be resolved relative to the file that contains it. This is correct behavior. Future work is required to support the angle bracket quotation style, and in turn, support for multiple paths while resolving. As outlined in the P4_16 specification, the quotation style simply determines the order in which the preprocessor will need to consider these file paths: '"..."' using the relative path ahead of any additional include path list, and '<...>' using the relative path last.