/////////////////////////////////////////////////////////////////////////// protected override bool GetMoreInput() { // ****** if( base.GetMoreInput() ) { return true; } else if( savedForLater.Length > 0 ) { current = new Reader( gc, new ParseStringReader( savedForLater.ToString(), string.Empty) ); savedForLater.Length = 0; return true; } // ****** return false; }
/////////////////////////////////////////////////////////////////////////// protected void PreviousState() { // ****** if( ! string.IsNullOrEmpty(current.Source.DefaultPath) ) { // // pop path // dirStack.Pop(); } // ****** current = includeFiles.Pop(); }
/////////////////////////////////////////////////////////////////////////// //public void IncludeFile( string fileNameIn ) //{ // // ****** // string text = null; // string fileName = string.Empty; // // ****** // if( null == (text = FileReader.ReadFile( fileNameIn, out fileName, null )) ) { // ThreadContext.MacroError( "file not found \"{0}\"", fileNameIn ); // return; // } // // ****** // if( string.IsNullOrEmpty( text ) ) { // // // // empty file // // // return; // } // // ****** // int nInstances = includeFiles.Count( item => fileName == item.SourceName ); // if( nInstances >= 20 ) { // ThreadContext.MacroError( "the file \"{0}\" is activly included {1} times, this exceeds the allowed limit, Nmp will terminate", fileName, nInstances ); // } // // ****** // NewState( new Reader(new ParseStringReader( text, fileName)) ); //} /////////////////////////////////////////////////////////////////////////// //[DebuggerStepThrough] public void Initialize( IBaseReader reader, string context ) { // // this is ugly // if( ! string.IsNullOrEmpty(reader.DefaultPath) ) { dirStack.Push( reader.DefaultPath ); initializePushedDirectory = true; } // ****** Context = context; PushbackCalled = false; // ****** current = new Reader( gc, reader ); }
/////////////////////////////////////////////////////////////////////////// protected void NewState( Reader newCurrent ) { // ****** includeFiles.Push( current ); current = newCurrent; // ****** string path = current.Source.DefaultPath; if( ! string.IsNullOrEmpty(path) ) { // // push path // dirStack.Push( path ); } }