/// <summary>
        /// Consumes a token or throws an exception
        /// </summary>
        /// <param name="token">token which must be consumed</param>
        /// <param name="errStr">message of the exception to throw</param>
        /// <exception cref="ImportException">Thrown if the token has the wrong type</exception>
        public void ConsumeToken(AssemblyTokenType token, string errStr = "Syntax error")
        {
            // Test if it is actually that token
            if (Current.Type != token)
                throw new ImportException(errStr);

            // Consume token
            ConsumeToken();
        }
Example #2
0
 /// <summary>
 /// Creates a new AssemblyToken
 /// </summary>
 /// <param name="type">type of the token</param>
 /// <param name="line">line number</param>
 /// <param name="data">any extra data</param>
 public AssemblyToken(AssemblyTokenType type, int line, string data = null)
 {
     this.Type = type;
     this.LineNumber = line;
     this.Data = data;
 }