Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable whitespace disrupting CUDA chevrons
Previously, fprettify did not understand CUDA fortran's triple-chevron syntax for calling kernel functions, e.g. ```fortran call example_kernel<<<1, 1>>>(args) ``` As a result, each symbol in the chevrons `<<<` would have whitespace added, resulting in the incorrect syntax: ```fortran call example_kernel < < < 1, 1 > > > (args) ``` This problem only occurs when adding whitespace around relational operators is enabled. This commit adds an escape hatch to the function that handles whitespace around operators `add_whitespace_context` which disables the whitespace handling for any line that matches the REGEX "<<<.*>>>": ```python CUDA_CHEVRONS_RE = re.compile(r"<<<.*>>>", RE_FLAGS) ... if not ( ... or CUDA_CHEVRONS_RE.search(line) ): ``` This change should not break any Fortran syntax, however any relational operator that appears in a line that *also* features a triple-chevron will not be formatted, e.g. ```fortran call example_kernel<<<1, 1>>>(3< 4, var1 ==var2) ```
- Loading branch information