Utility for checking the encoding and line ending of source files (#5188)

* Add utility for checking the encoding of source files

- accept source files with ASCII or UTF-8 without BOM
- accept only CRLF line ending

* Fix non-ascii symbol in idl_parcer.cpp

* Remove BOM from test.cpp
This commit is contained in:
Vladimir Glavnyy
2019-02-20 02:22:25 +07:00
committed by Wouter van Oortmerssen
parent 957d167199
commit 0eaaf18192
5 changed files with 72 additions and 2 deletions

View File

@@ -428,7 +428,7 @@ CheckedError Parser::Next() {
auto dot_lvl = (c == '.') ? 0 : 1; // dot_lvl==0 <=> exactly one '.' seen
if (!dot_lvl && !is_digit(*cursor_)) return NoError(); // enum?
// Parser accepts hexadecimal-oating-literal (see C++ 5.13.4).
// Parser accepts hexadecimal-floating-literal (see C++ 5.13.4).
if (is_digit(c) || has_sign || !dot_lvl) {
const auto start = cursor_ - 1;
auto start_digits = !is_digit(c) ? cursor_ : cursor_ - 1;