MetOffice / MetOffice/SimSys_Scripts

Identification of CPP directives in UMDP3_checker

未关闭
#240 1 条评论 0 个 reaction 已指派 1 人 已被 @r-sharp 认领 在 GitHub 查看
enhancement
主要语言
Python
星标
9
派生
19
平均合并
5 天 48 分钟
30 天内合并 PR
4

描述

The current C pre-processor pattern assumes that there are no spaces between the start of a line and the `#` symbol:

```py
comment_line = re.compile(r"!.*$")
cpp_command_line = re.compile(r"^#.*$")
word_splitter = re.compile(r"\b\w+\b")
```

However, the [GNU C pre-processor manual](https://gcc.gnu.org/onlinedocs/cpp/The-preprocessing-language.html) explicitly says that spaces before the hash symbol are allowed:

> Preprocessing directives are lines in your program that start with ‘#’. Whitespace is allowed before and after the ‘#’. The ‘#’ is followed by an identifier, the directive name. It specifies the operation to perform.

The pattern should probably allow leading whitespace. This doesn't seem to cause problems for the UM, but it may result in unexpected failures in other code bases.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。