Remove trailing whitespace

pull/33/head
A. R. Shajii 2022-06-26 17:39:30 -04:00
parent 9e276d8181
commit dc17f46246
8 changed files with 31 additions and 31 deletions

View File

@ -66,7 +66,7 @@ small_stmt <-
/ del_stmt / del_stmt
/ return_stmt &(SPACE / ';' / EOL) / return_stmt &(SPACE / ';' / EOL)
/ raise_stmt &(SPACE / ';' / EOL) / raise_stmt &(SPACE / ';' / EOL)
/ print_stmt / print_stmt
/ import_stmt / import_stmt
/ expressions &(_ ';' / _ EOL) { return any(ast<ExprStmt>(LOC, ac_expr(V0))); } / expressions &(_ ';' / _ EOL) { return any(ast<ExprStmt>(LOC, ac_expr(V0))); }
/ NAME SPACE expressions { / NAME SPACE expressions {
@ -331,7 +331,7 @@ param <-
param_name <- <'**' / '*'>? _ NAME { param_name <- <'**' / '*'>? _ NAME {
return (!VS.tokens.empty() ? VS.token_to_string() : "") + ac<string>(V0); return (!VS.tokens.empty() ? VS.token_to_string() : "") + ac<string>(V0);
} }
generics <- '[' _ tlist(',', param) _ ']' { generics <- '[' _ tlist(',', param) _ ']' {
vector<Param> params; vector<Param> params;
for (auto &p: VS) { for (auto &p: VS) {
auto v = ac<Param>(p); auto v = ac<Param>(p);
@ -339,7 +339,7 @@ generics <- '[' _ tlist(',', param) _ ']' {
if (!v.type) v.type = ast<IdExpr>(LOC, "type"); if (!v.type) v.type = ast<IdExpr>(LOC, "type");
params.push_back(v); params.push_back(v);
} }
return params; return params;
} }
decorators <- decorator+ { decorators <- decorator+ {
return VS.transform<ExprPtr>(); return VS.transform<ExprPtr>();
@ -390,7 +390,7 @@ class_def <- 'class' SPACE NAME _ class_args? _ ':' _ suite {
} }
for (auto &p: generics) for (auto &p: generics)
args.push_back(p); args.push_back(p);
return ast<ClassStmt>(LOC, return ast<ClassStmt>(LOC,
ac<string>(V0), move(args), suite, Attr(), vector<ExprPtr>{}, baseClasses ac<string>(V0), move(args), suite, Attr(), vector<ExprPtr>{}, baseClasses
); );
} }
@ -435,7 +435,7 @@ expression <-
} }
/ pipe { return ac_expr(V0); } / pipe { return ac_expr(V0); }
# TODO: make it more pythonic # TODO: make it more pythonic
lambdef <- lambdef <-
/ 'lambda' SPACE list(',', NAME) _ ':' _ expression { / 'lambda' SPACE list(',', NAME) _ ':' _ expression {
return ast<LambdaExpr>(LOC, return ast<LambdaExpr>(LOC,
VS.transform<string>(0, VS.size() - 1), ac_expr(VS.back()) VS.transform<string>(0, VS.size() - 1), ac_expr(VS.back())

View File

@ -151,7 +151,7 @@ TOML_NAMESPACE_START
{ {
if (elements.empty()) if (elements.empty())
return false; return false;
if (ntype == node_type::none) if (ntype == node_type::none)
ntype = elements[0]->type(); ntype = elements[0]->type();

View File

@ -218,7 +218,7 @@ TOML_NAMESPACE_END;
const char* lpDefaultChar, const char* lpDefaultChar,
int* lpUsedDefaultChar int* lpUsedDefaultChar
); );
__declspec(dllimport) __declspec(dllimport)
int __stdcall MultiByteToWideChar( int __stdcall MultiByteToWideChar(
unsigned int CodePage, unsigned int CodePage,

View File

@ -19,7 +19,7 @@ TOML_NAMESPACE_START
node::node(const node& /*other*/) noexcept node::node(const node& /*other*/) noexcept
{ {
// does not copy source information - this is not an error // does not copy source information - this is not an error
// //
// see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577 // see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577
} }
@ -35,7 +35,7 @@ TOML_NAMESPACE_START
node& node::operator= (const node& /*rhs*/) noexcept node& node::operator= (const node& /*rhs*/) noexcept
{ {
// does not copy source information - this is not an error // does not copy source information - this is not an error
// //
// see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577 // see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-665089577
source_ = {}; source_ = {};
@ -62,7 +62,7 @@ TOML_NAMESPACE_START
TOML_MEMBER_ATTR(const) bool node::is_time() const noexcept { return false; } TOML_MEMBER_ATTR(const) bool node::is_time() const noexcept { return false; }
TOML_MEMBER_ATTR(const) bool node::is_date_time() const noexcept { return false; } TOML_MEMBER_ATTR(const) bool node::is_date_time() const noexcept { return false; }
TOML_MEMBER_ATTR(const) bool node::is_array_of_tables() const noexcept { return false; } TOML_MEMBER_ATTR(const) bool node::is_array_of_tables() const noexcept { return false; }
TOML_MEMBER_ATTR(const) table* node::as_table() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) table* node::as_table() noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) array* node::as_array() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) array* node::as_array() noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) value<std::string>* node::as_string() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) value<std::string>* node::as_string() noexcept { return nullptr; }
@ -72,7 +72,7 @@ TOML_NAMESPACE_START
TOML_MEMBER_ATTR(const) value<date>* node::as_date() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) value<date>* node::as_date() noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) value<time>* node::as_time() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) value<time>* node::as_time() noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) value<date_time>* node::as_date_time() noexcept { return nullptr; } TOML_MEMBER_ATTR(const) value<date_time>* node::as_date_time() noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) const table* node::as_table() const noexcept { return nullptr; } TOML_MEMBER_ATTR(const) const table* node::as_table() const noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) const array* node::as_array() const noexcept { return nullptr; } TOML_MEMBER_ATTR(const) const array* node::as_array() const noexcept { return nullptr; }
TOML_MEMBER_ATTR(const) const value<std::string>* node::as_string() const noexcept { return nullptr; } TOML_MEMBER_ATTR(const) const value<std::string>* node::as_string() const noexcept { return nullptr; }

View File

@ -458,7 +458,7 @@ TOML_IMPL_NAMESPACE_START
std::vector<table*> implicit_tables; std::vector<table*> implicit_tables;
std::vector<table*> dotted_key_tables; std::vector<table*> dotted_key_tables;
std::vector<array*> table_arrays; std::vector<array*> table_arrays;
std::string recording_buffer; //for diagnostics std::string recording_buffer; //for diagnostics
bool recording = false, recording_whitespace = true; bool recording = false, recording_whitespace = true;
std::string_view current_scope; std::string_view current_scope;
size_t nested_values = {}; size_t nested_values = {};
@ -920,7 +920,7 @@ TOML_IMPL_NAMESPACE_START
); );
// handle surrogates in strings (1.0.0 and later) // handle surrogates in strings (1.0.0 and later)
if constexpr (TOML_LANG_AT_LEAST(1, 0, 0)) if constexpr (TOML_LANG_AT_LEAST(1, 0, 0))
{ {
if (is_unicode_surrogate(*cp)) if (is_unicode_surrogate(*cp))
set_error_and_return_default( set_error_and_return_default(
@ -1083,7 +1083,7 @@ TOML_IMPL_NAMESPACE_START
set_error_and_return_default("encountered end-of-file"sv); set_error_and_return_default("encountered end-of-file"sv);
} }
// if the first three characters are all the same string delimiter then // if the first three characters are all the same string delimiter then
// it's a multi-line string. // it's a multi-line string.
else if (first == second && first == third) else if (first == second && first == third)
@ -1514,7 +1514,7 @@ TOML_IMPL_NAMESPACE_START
return (fragments[0].value + fragments[1].value) return (fragments[0].value + fragments[1].value)
* pow(2.0, fragments[2].value * exponent_sign) * pow(2.0, fragments[2].value * exponent_sign)
* sign; * sign;
#else // !TOML_LANG_UNRELEASED #else // !TOML_LANG_UNRELEASED
set_error_and_return_default( set_error_and_return_default(
@ -1570,7 +1570,7 @@ TOML_IMPL_NAMESPACE_START
size_t length = {}; size_t length = {};
const utf8_codepoint* prev = {}; const utf8_codepoint* prev = {};
while (!is_eof() && !is_value_terminator(*cp)) while (!is_eof() && !is_value_terminator(*cp))
{ {
if (*cp == U'_') if (*cp == U'_')
{ {
if (!prev || !traits::is_digit(*prev)) if (!prev || !traits::is_digit(*prev))
@ -1979,7 +1979,7 @@ TOML_IMPL_NAMESPACE_START
// detect the value type and parse accordingly, // detect the value type and parse accordingly,
// starting with value types that can be detected // starting with value types that can be detected
// unambiguously from just one character. // unambiguously from just one character.
val = parse_value_known_prefixes(); val = parse_value_known_prefixes();
return_if_error({}); return_if_error({});
if (val) if (val)
@ -2492,7 +2492,7 @@ TOML_IMPL_NAMESPACE_START
set_error_and_return_default( set_error_and_return_default(
"expected bare key starting character or string delimiter, saw '"sv, to_sv(*cp), "'"sv "expected bare key starting character or string delimiter, saw '"sv, to_sv(*cp), "'"sv
); );
// whitespace following the key segment // whitespace following the key segment
consume_leading_whitespace(); consume_leading_whitespace();
@ -2583,7 +2583,7 @@ TOML_IMPL_NAMESPACE_START
// check for a premature closing ']' // check for a premature closing ']'
if (*cp == U']') if (*cp == U']')
set_error_and_return_default("tables with blank bare keys are explicitly prohibited"sv); set_error_and_return_default("tables with blank bare keys are explicitly prohibited"sv);
// get the actual key // get the actual key
start_recording(); start_recording();
key = parse_key(); key = parse_key();
@ -2672,7 +2672,7 @@ TOML_IMPL_NAMESPACE_START
).first->second->ref_cast<array>(); ).first->second->ref_cast<array>();
table_arrays.push_back(tab_arr); table_arrays.push_back(tab_arr);
tab_arr->source_ = { header_begin_pos, header_end_pos, reader.source_path() }; tab_arr->source_ = { header_begin_pos, header_end_pos, reader.source_path() };
tab_arr->elements.emplace_back(new toml::table{}); tab_arr->elements.emplace_back(new toml::table{});
tab_arr->elements.back()->source_ = { header_begin_pos, header_end_pos, reader.source_path() }; tab_arr->elements.back()->source_ = { header_begin_pos, header_end_pos, reader.source_path() };
return &tab_arr->elements.back()->ref_cast<table>(); return &tab_arr->elements.back()->ref_cast<table>();
@ -2803,7 +2803,7 @@ TOML_IMPL_NAMESPACE_START
assert_not_error(); assert_not_error();
assert_not_eof(); assert_not_eof();
push_parse_scope("root table"sv); push_parse_scope("root table"sv);
table* current_table = &root; table* current_table = &root;
do do

View File

@ -239,7 +239,7 @@
//#==================================================================================================================== //#====================================================================================================================
#if TOML_ICC #if TOML_ICC
#define TOML_PUSH_WARNINGS \ #define TOML_PUSH_WARNINGS \
__pragma(warning(push)) \ __pragma(warning(push)) \
static_assert(true) static_assert(true)
@ -345,7 +345,7 @@
#ifdef TOML_CONFIG_HEADER #ifdef TOML_CONFIG_HEADER
#include TOML_CONFIG_HEADER #include TOML_CONFIG_HEADER
#endif #endif
#ifdef DOXYGEN #ifdef DOXYGEN
#define TOML_HEADER_ONLY 0 #define TOML_HEADER_ONLY 0
#define TOML_WINDOWS_COMPAT 1 #define TOML_WINDOWS_COMPAT 1
@ -803,9 +803,9 @@ TOML_ENABLE_WARNINGS;
/// // global_header_that_includes_toml++.h /// // global_header_that_includes_toml++.h
/// #define TOML_HEADER_ONLY 0 /// #define TOML_HEADER_ONLY 0
/// #include <toml.hpp> /// #include <toml.hpp>
/// ///
/// // some_code_file.cpp /// // some_code_file.cpp
/// #define TOML_IMPLEMENTATION /// #define TOML_IMPLEMENTATION
/// #include "global_header_that_includes_toml++.h" /// #include "global_header_that_includes_toml++.h"
/// \ecpp /// \ecpp

View File

@ -142,7 +142,7 @@ TOML_NAMESPACE_START
{ {
if (map.empty()) if (map.empty())
return false; return false;
if (ntype == node_type::none) if (ntype == node_type::none)
ntype = map.cbegin()->second->type(); ntype = map.cbegin()->second->type();

View File

@ -811,12 +811,12 @@ You can also add methods to types:
Type extensions Type extensions
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Suppose you have a class that lacks a method or an operator that might be really useful. Suppose you have a class that lacks a method or an operator that might be really useful.
Codon provides an ``@extend`` annotation that allows programmers to add and modify Codon provides an ``@extend`` annotation that allows programmers to add and modify
methods of various types at compile time, including built-in types like ``int`` or ``str``. methods of various types at compile time, including built-in types like ``int`` or ``str``.
This actually allows much of the functionality of built-in types to be implemented in This actually allows much of the functionality of built-in types to be implemented in
Codon as type extensions in the standard library. Codon as type extensions in the standard library.
.. code:: python .. code:: python