@@ -282,8 +282,7 @@ void ASTObject::ast_parents(TokenStream &tokens) {
282282 if (token.type != token_type::ID) {
283283 throw ASTError{
284284 " expected inheritance parent identifier, but there is" ,
285- token
286- };
285+ token};
287286 }
288287
289288 this ->parents .emplace_back (token, stream);
@@ -301,9 +300,9 @@ void ASTObject::ast_members(TokenStream &tokens) {
301300 bool object_next = false ;
302301 auto lookahead = tokens.next ();
303302
304- if (lookahead->type == token_type::OPERATOR // value assignment
305- or lookahead->type == token_type::COLON // type declaration
306- or lookahead->type == token_type::DOT) { // inherited member access (e.g. Parent.some_member)
303+ if (lookahead->type == token_type::OPERATOR // value assignment
304+ or lookahead->type == token_type::COLON // type declaration
305+ or lookahead->type == token_type::DOT) { // inherited member access (e.g. Parent.some_member)
307306 object_next = false ;
308307 }
309308 else if (lookahead->type == token_type::LANGLE or lookahead->type == token_type::LBRACKET or lookahead->type == token_type::LPAREN) {
@@ -434,7 +433,6 @@ ASTMember::ASTMember(const Token &name,
434433 name{IDToken{name, tokens}},
435434 type{std::nullopt },
436435 value{std::nullopt } {
437-
438436 auto token = tokens.next ();
439437 bool had_def_or_decl = false ;
440438
@@ -535,7 +533,6 @@ ASTMember::ASTMember(const Token &name,
535533ASTMemberType::ASTMemberType (const Token &name,
536534 TokenStream &tokens) :
537535 name{IDToken{name, tokens}} {
538-
539536 // now there may follow type arguments, e.g.:
540537 // set(arg, key=val)
541538 // optional(dict(ktype, vtype))
@@ -547,7 +544,6 @@ ASTMemberType::ASTMemberType(const Token &name,
547544 size_t num_expected_types = member_type.expected_nested_types ();
548545
549546 if (token->type == token_type::LPAREN) {
550-
551547 // TODO: if we introduce optional arguments for composite types
552548 // we have to adjust the allowed count here.
553549 // or just count the non-kwarg arguments, and ignored the kwarg count.
@@ -561,29 +557,28 @@ ASTMemberType::ASTMemberType(const Token &name,
561557 num_expected_types,
562558 [this ](const Token &token, TokenStream &stream) {
563559 this ->nested_types .emplace_back (token, stream);
564- }
565- );
560+ });
566561
567562 if (unlikely (num_read_types != num_expected_types)) {
568563 throw ASTError (
569564 std::string (" expected " )
570- + std::to_string (num_expected_types)
571- + " arguments for "
572- + composite_type_to_string (member_type.composite_type )
573- + " declaration, but only "
574- + std::to_string (num_read_types)
575- + " could be found" ,
565+ + std::to_string (num_expected_types)
566+ + " arguments for "
567+ + composite_type_to_string (member_type.composite_type )
568+ + " declaration, but only "
569+ + std::to_string (num_read_types)
570+ + " could be found" ,
576571 *token,
577572 false );
578573 }
579574 }
580575 else if (num_expected_types > 0 ) {
581576 throw ASTError (
582577 std::string (" expected " )
583- + std::to_string (num_expected_types)
584- + " arguments for "
585- + composite_type_to_string (member_type.composite_type )
586- + " declaration" ,
578+ + std::to_string (num_expected_types)
579+ + " arguments for "
580+ + composite_type_to_string (member_type.composite_type )
581+ + " declaration" ,
587582 *token,
588583 false );
589584 }
@@ -739,12 +734,11 @@ void ASTObject::strb(std::ostringstream &builder, int indentlevel) const {
739734
740735 // object parents
741736 builder << " (" ;
742- util::strjoin (builder, " , " , this ->parents ,
743- [](auto &stream, auto &elem) {
744- stream << elem.str ();
745- });
737+ util::strjoin (builder, " , " , this ->parents , [](auto &stream, auto &elem) {
738+ stream << elem.str ();
739+ });
746740 builder << " ):"
747- << std::endl;
741+ << std::endl;
748742
749743 if (this ->objects .size () > 0 ) {
750744 for (auto &object : this ->objects ) {
@@ -795,8 +789,8 @@ void ASTMember::strb(std::ostringstream &builder, int indentlevel) const {
795789
796790 if (this ->value .has_value ()) {
797791 builder << " "
798- << op_to_string (this ->operation )
799- << " " ;
792+ << op_to_string (this ->operation )
793+ << " " ;
800794
801795 this ->value ->strb (builder);
802796 }
@@ -810,10 +804,9 @@ void ASTMemberType::strb(std::ostringstream &builder, int /*indentlevel*/) const
810804
811805 if (this ->args .size () > 0 ) {
812806 builder << " (" ;
813- util::strjoin (builder, " , " , this ->args ,
814- [](auto &stream, auto & elem) {
815- elem.strb (stream);
816- });
807+ util::strjoin (builder, " , " , this ->args , [](auto &stream, auto &elem) {
808+ elem.strb (stream);
809+ });
817810 builder << " )" ;
818811 }
819812}
@@ -846,8 +839,7 @@ void ASTMemberValue::strb(std::ostringstream &builder, int /*indentlevel*/) cons
846839 throw InternalError{" unhandled container type" };
847840 }
848841
849- util::strjoin (builder, " , " , this ->values ,
850- [](auto &stream, auto &elem) { stream << elem.str (); });
842+ util::strjoin (builder, " , " , this ->values , [](auto &stream, auto &elem) { stream << elem.str (); });
851843
852844 switch (this ->composite_type ) {
853845 case composite_t ::SET:
@@ -869,7 +861,7 @@ ASTError::ASTError(const std::string &msg,
869861 if (add_token) {
870862 std::ostringstream builder;
871863 builder << msg << " : "
872- << token_type_str (token.type );
864+ << token_type_str (token.type );
873865 this ->msg = std::move (builder).str ();
874866 }
875867 else {
@@ -885,7 +877,7 @@ ASTError::ASTError(const std::string &msg,
885877 if (add_token) {
886878 std::ostringstream builder;
887879 builder << msg << " : "
888- << token_type_str (token.get_type ());
880+ << token_type_str (token.get_type ());
889881 this ->msg = builder.str ();
890882 }
891883 else {
0 commit comments