Ejemplo n.º 1
0
        /// <summary>
        /// Identifies whether all variables in this context are
        /// registered in the other context
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsSubsetOf(VariableContext other)
        {
            foreach (var variableName in _initMap.Keys)
            {
                if (!other.IsRegistered(variableName))
                {
                    return(false);
                }
            }

            return(true);
        }
        private void ParseString(string s)
        {
            if (_ctx.IsRegistered(s))
            {
                Output(_ctx.GetToken(s));
                return;
            }

            SymbolToken token;
            var         parsed = SymbolToken.TryParse(s, out token);
            var         pos    = _charsParsed - _recentWhitespace;
            var         len    = s.Length;

            _charsParsed     += len;
            _recentWhitespace = 0;
            if (parsed)
            {
                Output(token.SetPosition(pos, len));
            }
            else
            {
                throw new UnrecognizedTokenException(pos, len, s);
            }
        }