private GrammarInfo [ ] scanForGrammars ( final File sourceDirectory ) throws MavenReportException { if ( ! sourceDirectory . isDirectory ( ) ) { return null ; } GrammarInfo [ ] grammarInfos ; getLog ( ) . debug ( "Scanning for grammars: " + sourceDirectory ) ; try { final String [ ] includes = { "**/*.jj" , "**/*.JJ" , "**/*.jjt" , "**/*.JJT" , "**/*.jtb" , "**/*.JTB" } ; final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner ( ) ; scanner . setSourceDirectory ( sourceDirectory ) ; scanner . setIncludes ( includes ) ; scanner . scan ( ) ; grammarInfos = scanner . getIncludedGrammars ( ) ; } catch ( final Exception e ) { throw new MavenReportException ( "Failed to scan for grammars: " + sourceDirectory , e ) ; } getLog ( ) . debug ( "Found grammars: " + Arrays . asList ( grammarInfos ) ) ; return grammarInfos ; }
Searches the specified source directory to find grammar files that can be documented .