code: public void scan () throws IOException
    {
      this.includedGrammars.clear ();
      this.scanner.scan ();
  
      final String [] includedFiles = this.scanner.getIncludedFiles ();
      for (final String includedFile : includedFiles)
      {
        final GrammarInfo grammarInfo = new GrammarInfo (this.scanner.getBasedir (), includedFile, this.parserPackage);
        if (this.outputDirectory != null)
        {
          final File sourceFile = grammarInfo.getGrammarFile ();
          final File [] targetFiles = getTargetFiles (this.outputDirectory, includedFile, grammarInfo);
          for (final File targetFile2 : targetFiles)
          {
            final File targetFile = targetFile2;
            if (!targetFile.exists () || targetFile.lastModified () + this.staleMillis < sourceFile.lastModified ())
            {
              this.includedGrammars.add (grammarInfo);
              break;
            }
          }
        }
        else
        {
          this.includedGrammars.add (grammarInfo);
        }
      }
    }
docs: Scans the source directory for grammar files that match at least one
  inclusion pattern but no exclusion pattern, optionally performing timestamp
  checking to exclude grammars whose corresponding parser files are up to date.
  
  @throws IOException
  If a grammar file could not be analyzed for metadata.