Esempio n. 1
0
        public void Consume()
        {
            if (_source.La(1) != '\\')
            {
                _source.Consume();
                _range      = Math.Max(_range, _source.Index);
                _slashCount = 0;
                return;
            }

            // make sure the next character has been processed
            this.La(1);

            if (_escapeListIndex >= _escapeIndexes.Count || _escapeIndexes[_escapeListIndex] != Index)
            {
                _source.Consume();
                _slashCount++;
            }
            else
            {
                for (int i = 0; i < 6; i++)
                {
                    _source.Consume();
                }

                _escapeListIndex++;
                _slashCount = 0;
            }

            Contract.Assert(_range >= Index);
        }
Esempio n. 2
0
        public static string GetTextTillWhitespace(this Antlr4.Runtime.ICharStream stream)
        {
            var builder = new StringBuilder();
            int la;

            for (int i = 1; (la = stream.La(i)) >= 0 && !char.IsWhiteSpace((char)la); i++)
            {
                builder.Append((char)la);
            }
            return(builder.ToString());
        }
 public static int LA(this Antlr4.Runtime.ICharStream cs, int la)
 {
     return(cs.La(la));
 }