@@ -2105,30 +2105,105 @@ impl VerylWalker for Formatter {
21052105 }
21062106 }
21072107
2108+ /// Semantic action for non-terminal 'WithGenericParameter'
2109+ fn with_generic_parameter ( & mut self , arg : & WithGenericParameter ) {
2110+ if arg. colon_colon_l_angle . line ( ) != arg. r_angle . line ( ) {
2111+ self . multi_line_start ( ) ;
2112+ }
2113+ self . colon_colon_l_angle ( & arg. colon_colon_l_angle ) ;
2114+ if self . multi_line ( ) {
2115+ self . newline_push ( ) ;
2116+ }
2117+
2118+ self . with_generic_parameter_list ( & arg. with_generic_parameter_list ) ;
2119+
2120+ if self . multi_line ( ) {
2121+ self . newline_pop ( ) ;
2122+ self . align_reset ( ) ;
2123+ }
2124+ self . r_angle ( & arg. r_angle ) ;
2125+ if arg. colon_colon_l_angle . line ( ) != arg. r_angle . line ( ) {
2126+ self . multi_line_finish ( ) ;
2127+ }
2128+ }
2129+
21082130 /// Semantic action for non-terminal 'WithGenericParameterList'
21092131 fn with_generic_parameter_list ( & mut self , arg : & WithGenericParameterList ) {
21102132 self . with_generic_parameter_item ( & arg. with_generic_parameter_item ) ;
21112133 for x in & arg. with_generic_parameter_list_list {
21122134 self . comma ( & x. comma ) ;
2113- self . space ( 1 ) ;
2135+ if self . multi_line ( ) {
2136+ self . newline ( ) ;
2137+ } else {
2138+ self . space ( 1 ) ;
2139+ }
21142140 self . with_generic_parameter_item ( & x. with_generic_parameter_item ) ;
21152141 }
2116- if let Some ( ref x) = arg. with_generic_parameter_list_opt {
2117- self . comma ( & x. comma ) ;
2142+ if self . multi_line ( ) {
2143+ if let Some ( ref x) = arg. with_generic_parameter_list_opt {
2144+ self . comma ( & x. comma ) ;
2145+ } else {
2146+ self . str ( "," ) ;
2147+ }
21182148 }
21192149 }
21202150
21212151 /// Semantic action for non-terminal 'WithGenericParameterItem'
21222152 fn with_generic_parameter_item ( & mut self , arg : & WithGenericParameterItem ) {
2153+ if self . multi_line ( ) {
2154+ self . align_start ( align_kind:: IDENTIFIER ) ;
2155+ }
21232156 self . identifier ( & arg. identifier ) ;
2157+ if self . multi_line ( ) {
2158+ self . align_finish ( align_kind:: IDENTIFIER ) ;
2159+ }
21242160 self . colon ( & arg. colon ) ;
21252161 self . space ( 1 ) ;
2162+ if self . multi_line ( ) {
2163+ self . align_start ( align_kind:: TYPE ) ;
2164+ }
21262165 self . generic_bound ( & arg. generic_bound ) ;
2166+ if self . multi_line ( ) {
2167+ self . align_finish ( align_kind:: TYPE ) ;
2168+ }
21272169 if let Some ( ref x) = arg. with_generic_parameter_item_opt {
21282170 self . space ( 1 ) ;
21292171 self . equ ( & x. equ ) ;
21302172 self . space ( 1 ) ;
2173+ if self . multi_line ( ) {
2174+ self . align_start ( align_kind:: EXPRESSION ) ;
2175+ }
21312176 self . with_generic_argument_item ( & x. with_generic_argument_item ) ;
2177+ if self . multi_line ( ) {
2178+ self . align_finish ( align_kind:: EXPRESSION ) ;
2179+ }
2180+ }
2181+ }
2182+
2183+ /// Semantic action for non-terminal 'WithGenericArgument'
2184+ fn with_generic_argument ( & mut self , arg : & WithGenericArgument ) {
2185+ let multi_line = arg. with_generic_argument_opt . is_some ( )
2186+ && arg. colon_colon_l_angle . line ( ) != arg. r_angle . line ( ) ;
2187+
2188+ if multi_line {
2189+ self . multi_line_start ( ) ;
2190+ }
2191+ self . colon_colon_l_angle ( & arg. colon_colon_l_angle ) ;
2192+ if self . multi_line ( ) {
2193+ self . newline_push ( ) ;
2194+ }
2195+
2196+ if let Some ( x) = & arg. with_generic_argument_opt {
2197+ self . with_generic_argument_list ( & x. with_generic_argument_list ) ;
2198+ }
2199+
2200+ if self . multi_line ( ) {
2201+ self . newline_pop ( ) ;
2202+ self . align_reset ( ) ;
2203+ }
2204+ self . r_angle ( & arg. r_angle ) ;
2205+ if multi_line {
2206+ self . multi_line_finish ( ) ;
21322207 }
21332208 }
21342209
@@ -2137,11 +2212,43 @@ impl VerylWalker for Formatter {
21372212 self . with_generic_argument_item ( & arg. with_generic_argument_item ) ;
21382213 for x in & arg. with_generic_argument_list_list {
21392214 self . comma ( & x. comma ) ;
2140- self . space ( 1 ) ;
2215+ if self . multi_line ( ) {
2216+ self . newline ( ) ;
2217+ } else {
2218+ self . space ( 1 ) ;
2219+ }
21412220 self . with_generic_argument_item ( & x. with_generic_argument_item ) ;
21422221 }
2143- if let Some ( ref x) = arg. with_generic_argument_list_opt {
2144- self . comma ( & x. comma ) ;
2222+ if self . multi_line ( ) {
2223+ if let Some ( ref x) = arg. with_generic_argument_list_opt {
2224+ self . comma ( & x. comma ) ;
2225+ } else {
2226+ self . str ( "," ) ;
2227+ }
2228+ }
2229+ }
2230+
2231+ /// Semantic action for non-terminal 'WithGenericArgumentItem'
2232+ fn with_generic_argument_item ( & mut self , arg : & WithGenericArgumentItem ) {
2233+ if self . multi_line ( ) {
2234+ self . align_start ( align_kind:: EXPRESSION ) ;
2235+ }
2236+ match arg {
2237+ WithGenericArgumentItem :: GenericArgIdentifier ( x) => {
2238+ self . generic_arg_identifier ( & x. generic_arg_identifier ) ;
2239+ }
2240+ WithGenericArgumentItem :: FixedType ( x) => {
2241+ self . fixed_type ( & x. fixed_type ) ;
2242+ }
2243+ WithGenericArgumentItem :: Number ( x) => {
2244+ self . number ( & x. number ) ;
2245+ }
2246+ WithGenericArgumentItem :: BooleanLiteral ( x) => {
2247+ self . boolean_literal ( & x. boolean_literal ) ;
2248+ }
2249+ }
2250+ if self . multi_line ( ) {
2251+ self . align_finish ( align_kind:: EXPRESSION ) ;
21452252 }
21462253 }
21472254
0 commit comments