Esempio n. 1
0
 private void SetTarget(CloneableAntlrFileStream stream)
 {
     if (PRELOAD_SOURCES)
     {
         strongInputStream = stream;
     }
     else
     {
         inputStream = new WeakReference <CloneableAntlrFileStream>(stream);
     }
 }
Esempio n. 2
0
            public ICharStream GetInputStream()
            {
                CloneableAntlrFileStream stream;

                if (!TryGetTarget(out stream))
                {
                    stream = new CloneableAntlrFileStream(source, ENCODING);
                    SetTarget(stream);
                }

                return(new JavaUnicodeInputStream(stream.CreateCopy()));
            }
Esempio n. 3
0
            private bool TryGetTarget(out CloneableAntlrFileStream stream)
            {
                if (PRELOAD_SOURCES)
                {
                    stream = strongInputStream;
                    return(strongInputStream != null);
                }
                else
                {
                    if (inputStream == null)
                    {
                        stream = null;
                        return(false);
                    }

                    return(inputStream.TryGetTarget(out stream));
                }
            }