MetOffice / MetOffice/SimSys_Scripts

Identification of CPP directives in UMDP3_checker

オープン
#240 コメント 1 件 リアクション 0 件 担当者 1 名 @r-sharp が担当を希望しています GitHub で見る
enhancement
主要言語
Python
スター
9
フォーク
19
平均マージ
5日 48分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。