File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,10 @@ fn parse_items(input: Vec<LexItem>) -> Result<Vec<GrammarItem>, ParseError> {
157
157
params,
158
158
tag : content. into ( ) ,
159
159
} ) ;
160
+
161
+ if content == "endcode" {
162
+ grammar_items. push ( GrammarItem :: Text ( "" . into ( ) ) ) ;
163
+ }
160
164
}
161
165
_ => { }
162
166
}
@@ -330,6 +334,7 @@ mod test {
330
334
params: vec![ ] ,
331
335
tag: "endcode" . into( ) ,
332
336
} ,
337
+ GrammarItem :: Text ( "" . into( ) )
333
338
]
334
339
)
335
340
}
@@ -352,6 +357,36 @@ mod test {
352
357
params: vec![ ] ,
353
358
tag: "endcode" . into( ) ,
354
359
} ,
360
+ GrammarItem :: Text ( "" . into( ) )
361
+ ]
362
+ )
363
+ }
364
+
365
+ #[ test]
366
+ pub fn code_with_args ( ) {
367
+ let result = parse ( "@code\n fn main() {}\n @endcode\n \n @param[in] a - a" . into ( ) ) . unwrap ( ) ;
368
+
369
+ assert_eq ! (
370
+ result,
371
+ vec![
372
+ GrammarItem :: Notation {
373
+ meta: vec![ ] ,
374
+ params: vec![ ] ,
375
+ tag: "code" . into( ) ,
376
+ } ,
377
+ GrammarItem :: Text ( "\n fn main() {}\n " . into( ) ) ,
378
+ GrammarItem :: Notation {
379
+ meta: vec![ ] ,
380
+ params: vec![ ] ,
381
+ tag: "endcode" . into( ) ,
382
+ } ,
383
+ GrammarItem :: Text ( "\n \n " . into( ) ) ,
384
+ GrammarItem :: Notation {
385
+ meta: vec![ "in" . into( ) ] ,
386
+ params: vec![ "a" . into( ) ] ,
387
+ tag: "param" . into( )
388
+ } ,
389
+ GrammarItem :: Text ( " - a" . into( ) )
355
390
]
356
391
)
357
392
}
You can’t perform that action at this time.
0 commit comments