File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,17 @@ pub(crate) mod entry {
9494
9595 pub ( crate ) fn source_file ( p : & mut Parser < ' _ > ) {
9696 let m = p. start ( ) ;
97+ // test frontmatter
98+ // #!/usr/bin/env cargo
99+ //
100+ // ---
101+ // [dependencies]
102+ // clap = { version = "4.2", features = ["derive"] }
103+ // ---
104+ //
105+ // fn main() {}
97106 p. eat ( SHEBANG ) ;
107+ p. eat ( FRONTMATTER ) ;
98108 items:: mod_contents ( p, false ) ;
99109 m. complete ( p, SOURCE_FILE ) ;
100110 }
Original file line number Diff line number Diff line change @@ -265,6 +265,8 @@ mod ok {
265265 #[ test]
266266 fn for_type ( ) { run_and_expect_no_errors ( "test_data/parser/inline/ok/for_type.rs" ) ; }
267267 #[ test]
268+ fn frontmatter ( ) { run_and_expect_no_errors ( "test_data/parser/inline/ok/frontmatter.rs" ) ; }
269+ #[ test]
268270 fn full_range_expr ( ) {
269271 run_and_expect_no_errors ( "test_data/parser/inline/ok/full_range_expr.rs" ) ;
270272 }
Original file line number Diff line number Diff line change 1+ SOURCE_FILE
2+ SHEBANG "#!/usr/bin/env cargo\n"
3+ FRONTMATTER "\n---\n[dependencies]\nclap = { version = \"4.2\", features = [\"derive\"] }\n---\n"
4+ WHITESPACE "\n"
5+ FN
6+ FN_KW "fn"
7+ WHITESPACE " "
8+ NAME
9+ IDENT "main"
10+ PARAM_LIST
11+ L_PAREN "("
12+ R_PAREN ")"
13+ WHITESPACE " "
14+ BLOCK_EXPR
15+ STMT_LIST
16+ L_CURLY "{"
17+ R_CURLY "}"
18+ WHITESPACE "\n"
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env cargo
2+
3+ ---
4+ [ dependencies]
5+ clap = { version = "4.2" , features = [ "derive" ] }
6+ ---
7+
8+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments