Antlr3.AntlrTool.GetImportedVocabFile C# (CSharp) Method

GetImportedVocabFile() public method

public GetImportedVocabFile ( string vocabName ) : string
vocabName string
return string
        public virtual string GetImportedVocabFile( string vocabName )
        {
            // first look at files we're generating
            string path = (from file in GeneratedFiles
                           where Path.GetFileName(file).Equals(vocabName + CodeGenerator.VocabFileExtension)
                             && File.Exists(file)
                           select file)
                          .FirstOrDefault();
            if (path != null)
                return path;

            path = Path.Combine( LibraryDirectory, vocabName + CodeGenerator.VocabFileExtension );
            if ( File.Exists( path ) )
                return path;

            // We did not find the vocab file in the lib directory, so we need
            // to look for it in the output directory which is where .tokens
            // files are generated (in the base, not relative to the input
            // location.)
            //
            if ( haveOutputDir )
            {
                path = Path.Combine( OutputDirectory, vocabName + CodeGenerator.VocabFileExtension );
            }
            else
            {
                path = vocabName + CodeGenerator.VocabFileExtension;
            }
            return path;
        }