Exemplo n.º 1
0
 /// <summary>
 /// Creates an <see cref="TypeAssignment"/>.
 /// </summary>
 /// <param name="module"></param>
 /// <param name="name"></param>
 /// <param name="lexer"></param>
 /// <param name="last"></param>
 public TypeAssignment(string module, string name, Symbol last, Lexer lexer)
 {
     _module = module;
     _name = name;
     Value = last.ToString();
     
     Symbol temp;
     Symbol veryPrevious = null;
     Symbol previous = last;
     while ((temp = lexer.CheckNextSymbol()) != null)
     {
         if (veryPrevious == Symbol.EOL && previous == Symbol.EOL && temp.ValidateType())
         {
             return;
         }
             
         veryPrevious = previous;
         temp = lexer.GetNextSymbol();
         previous = temp;
     }
     
     previous.Throw("end of file reached");
 }
        /// <summary>
        /// Creates an <see cref="TypeAssignment"/>.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="name"></param>
        /// <param name="lexer"></param>
        /// <param name="last"></param>
        public TypeAssignment(string module, string name, Symbol last, Lexer lexer)
        {
            _module = module;
            _name   = name;
            Value   = last.ToString();

            Symbol temp;
            Symbol veryPrevious = null;
            Symbol previous     = last;

            while ((temp = lexer.CheckNextSymbol()) != null)
            {
                if (veryPrevious == Symbol.EOL && previous == Symbol.EOL && temp.ValidateType())
                {
                    return;
                }

                veryPrevious = previous;
                temp         = lexer.GetNextSymbol();
                previous     = temp;
            }

            previous.Throw("end of file reached");
        }