@@ -8,14 +8,15 @@ use lazy_static::lazy_static;
88use regex:: Regex ;
99use std:: collections:: HashMap ;
1010use std:: io:: { self , BufRead , BufReader } ;
11- use std:: path:: Path ;
11+ use std:: path:: { Path , PathBuf } ;
1212use std:: process:: Output ;
1313use std:: time:: Duration ;
1414use tmc_langs_framework:: {
1515 command:: TmcCommand ,
1616 domain:: { ExerciseDesc , RunResult , RunStatus , TestDesc , TmcProjectYml } ,
1717 error:: { CommandError , FileIo } ,
1818 io:: file_util,
19+ nom:: { self , IResult } ,
1920 plugin:: LanguagePlugin ,
2021 TmcError ,
2122} ;
@@ -120,6 +121,8 @@ impl MakePlugin {
120121
121122impl LanguagePlugin for MakePlugin {
122123 const PLUGIN_NAME : & ' static str = "make" ;
124+ const LINE_COMMENT : & ' static str = "//" ;
125+ const BLOCK_COMMENT : Option < ( & ' static str , & ' static str ) > = Some ( ( "/*" , "*/" ) ) ;
123126 type StudentFilePolicy = MakeStudentFilePolicy ;
124127
125128 fn scan_exercise ( & self , path : & Path , exercise_name : String ) -> Result < ExerciseDesc , TmcError > {
@@ -299,6 +302,37 @@ impl LanguagePlugin for MakePlugin {
299302
300303 Ok ( ( ) )
301304 }
305+
306+ fn get_default_student_file_paths ( & self ) -> Vec < PathBuf > {
307+ vec ! [ PathBuf :: from( "src" ) ]
308+ }
309+
310+ fn get_default_exercise_file_paths ( & self ) -> Vec < PathBuf > {
311+ vec ! [ PathBuf :: from( "test" ) ]
312+ }
313+
314+ fn points_parser < ' a > ( i : & ' a str ) -> IResult < & ' a str , & ' a str > {
315+ nom:: combinator:: map (
316+ nom:: sequence:: delimited (
317+ nom:: sequence:: tuple ( (
318+ nom:: bytes:: complete:: tag ( "tmc_register_test" ) ,
319+ nom:: character:: complete:: multispace0,
320+ nom:: character:: complete:: char ( '(' ) ,
321+ nom:: bytes:: complete:: is_not ( "\" " ) ,
322+ ) ) ,
323+ nom:: sequence:: delimited (
324+ nom:: character:: complete:: char ( '"' ) ,
325+ nom:: bytes:: complete:: is_not ( "\" " ) ,
326+ nom:: character:: complete:: char ( '"' ) ,
327+ ) ,
328+ nom:: sequence:: tuple ( (
329+ nom:: character:: complete:: multispace0,
330+ nom:: character:: complete:: char ( ')' ) ,
331+ ) ) ,
332+ ) ,
333+ str:: trim,
334+ ) ( i)
335+ }
302336}
303337
304338#[ cfg( test) ]
@@ -439,4 +473,21 @@ mod test {
439473 let dir = MakePlugin :: find_project_dir_in_zip ( & mut zip) ;
440474 assert ! ( dir. is_err( ) ) ;
441475 }
476+
477+ #[ test]
478+ fn parses_points ( ) {
479+ assert ! ( MakePlugin :: points_parser(
480+ "tmc_register_test(s, test_insertion_empty_list, \" dlink_insert);" ,
481+ )
482+ . is_err( ) ) ;
483+
484+ assert_eq ! (
485+ MakePlugin :: points_parser(
486+ "tmc_register_test(s, test_insertion_empty_list, \" dlink_insert\" );" ,
487+ )
488+ . unwrap( )
489+ . 1 ,
490+ "dlink_insert"
491+ ) ;
492+ }
442493}
0 commit comments