code: private GrammarInfo [] scanForGrammars () throws MojoExecutionException
    {
      if (!getSourceDirectory ().isDirectory ())
      {
        return null;
      }
  
      GrammarInfo [] grammarInfos;
  
      getLog ().debug ("Scanning for grammars: " + getSourceDirectory ());
      try
      {
        final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner ();
        scanner.setSourceDirectory (getSourceDirectory ());
        scanner.setIncludes (getIncludes ());
        scanner.setExcludes (getExcludes ());
        scanner.setOutputDirectory (getOutputDirectory ());
        scanner.setParserPackage (getParserPackage ());
        scanner.setStaleMillis (getStaleMillis ());
        scanner.scan ();
        grammarInfos = scanner.getIncludedGrammars ();
      }
      catch (final Exception e)
      {
        throw new MojoExecutionException ("Failed to scan for grammars: " + getSourceDirectory (), e);
      }
      getLog ().debug ("Found grammars: " + Arrays.asList (grammarInfos));
  
      return grammarInfos;
    }
docs: Scans the configured source directory for grammar files which need
  processing.
  
  @return An array of grammar infos describing the found grammar files or
  <code>null</code> if the source directory does not exist.
  @throws MojoExecutionException
  If the source directory could not be scanned.