Closed Nsidorenco closed 4 months ago
To solve this, more complexity has been moved to the external scanner. The external scanner now keeps a stack of indentations levels where the directive was started. To end a directive scope we then pop dedent tokens until the indentation stack matches the level on the directive stack
Working PR for adding
#if
compiler directive support.Challenges with this feature is dealing with the indentation stack inside the directive block, i.e
In cases like this, we need a dedent token to make the member definition parse, and we need a dedent token to terminate the type declaration. However, the last like of the file is
#endif
, which does not expect a dedent token, so we end up wanting to:#endif
in external scanner and push dedent token#endif
in external scanner and do nothing.#endif
token.The problem is there is no good way to determine how many dedent tokens should be pushed in step 1