MetOffice / MetOffice/SimSys_Scripts

Identification of CPP directives in UMDP3_checker

Abierto
#240 1 comentario 0 reacciones 1 asignado Reclamado por @r-sharp Ver en GitHub
enhancement
Lenguaje dominante
Python
Estrellas
9
Forks
19
Merge medio
5 d 48 min
PR fusionados (30 d)
4

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.