Ejemplo n.º 1
0
 /// <summary>
 /// Adds a token to the stream.
 /// </summary>
 /// <param name="token">
 /// A <see cref="IronJSONToken"/>
 /// </param>
 public void Add(IronJSONToken token)
 {
     m_tokens.Add(token);
     m_lineTable.Add(m_line);
 }
Ejemplo n.º 2
0
        private void VerifyToken(IronJSONToken tok, TokenType[] verify)
        {
            StringBuilder errormsg = new StringBuilder("expected ");
            bool verified = false;

            foreach (TokenType t in verify)
            {
                errormsg.Append("'" + IronJSONToken.TokenTypeToString(t) + "' or ");
                if (tok.Type == t)
                    verified = true;
            }

            if (verify.Length > 0)
                errormsg.Remove(errormsg.Length - 4, 4);

            errormsg.Append(" got: " + tok.ToString());

            if (!verified)
                throw ParseError(errormsg.ToString());
        }