Esempio n. 1
0
        private void Advance(bool throwOnEnd = true)
        {
            var last = _enumerator.Current;

            if (!_enumerator.MoveNext() && throwOnEnd)
            {
                throw RecipeCompilerException.UnexpectedEndAt(last);
            }
        }
Esempio n. 2
0
        private string ReadUntil(Func <IEnumerator <Token>, bool> condition, bool throwOnEnd = false)
        {
            var value = new StringBuilder();

            while (!condition(_enumerator))
            {
                value.Append(_enumerator.Current.Value);
                if (!_enumerator.MoveNext())
                {
                    if (throwOnEnd)
                    {
                        throw RecipeCompilerException.UnexpectedEndAt(_enumerator.Current);
                    }
                    break;
                }
            }
            return(value.ToString());
        }