private Token TestToken(string text, LexicalRule rule)
		{
			TokenSequence tokens = new TokenSequence();
			foreach (char c in  text)
			{
				tokens.Append(new Token(c.ToString(), 0,0, new FloatBitmap(2,2)));
			}
			
			Token res;
			if(!rule.Match(tokens, out res))
				return null;
			
			return res;
		}
		public void MatchTextTest()			
		{	
			LexicalRule rule = new LexicalRule();
			rule.Name = "NUMBER";
			rule.LexicalExpressions.Add(@"[0-9]+");
			rule.LexicalExpressions.Add(@"[0-9]+\.[0-9]+");
			
			// Should accept
			string number= "290";
			
			Token token = TestToken(number, rule);
			
			Assert.IsNotNull(token, "El token es nulo para {0}",number);
			Assert.AreEqual("NUMBER", token.Type, 
			                "El tipo del token no es correcto para {0}",number);
			Assert.AreEqual(number, token.Text, 
			                "El texto del token no es correcto para {0}",number); 
			
			// Should accept
			number= "290.23";
			
			token = TestToken(number, rule);
			
			Assert.IsNotNull(token, "El token es nulo para {0}",number);
			Assert.AreEqual("NUMBER", token.Type, 
			                "El tipo del token no es correcto para {0}",number);
			Assert.AreEqual(number, token.Text, 
			                "El texto del token no es correcto para {0}",number); 
			
			// Should fail
			number= "2fdsf90.23";
			
			token = TestToken(number, rule);
			
			Assert.IsNull(token, "El token no es nulo para {0}",number);
			
		}
		/// <summary>
		/// <see cref="SequenceBeingMatcchedArgs"/>'s contructor.
		/// </summary>
		/// <param name="joinedToken">
		/// A <see cref="Token"/>
		/// </param>
		/// <param name="matchingRule">
		/// A <see cref="LexicalRule"/>
		/// </param>
		/// <param name="found">
		/// A <see cref="System.Boolean"/>
		/// </param>
		public SequenceBeingMatchedArgs(Token joinedToken, 
		                                LexicalRule matchingRule,
		                                bool found)
		{
			this.joinedToken = joinedToken;
			this.matchingRule = matchingRule;
			this.found = found;
		}
		/// <summary>
		/// Launches the <see cref="SequenceBeingMatched"/> event.
		/// </summary>
		/// <param name="joinedToken">
		/// A <see cref="Token"/>
		/// </param>
		/// <param name="matcherRule">
		/// A <see cref="LexicalRule"/>
		/// </param>
		/// <param name="found">
		/// If the token is a valid token.
		/// </param>
		protected void SequenceBeingMatchedInvoker(Token joinedToken,
		                                         LexicalRule matcherRule,
		                                         bool found)
		{
			if(this.SequenceBeingMatched !=null)
			{
				SequenceBeingMatchedArgs args = 
					new SequenceBeingMatchedArgs(joinedToken, matcherRule, found);
				
				SequenceBeingMatched(this, args);
			}
		}
		/// <summary>
		/// Adds a new rule to the list.
		/// </summary>
		/// <param name="rule">
		/// The rule which will be added.
		/// </param>
		private void AddRule(LexicalRule rule)
		{
			string expression =  
				String.Join(" | ", rule.LexicalExpressions.ToArray());
			
			TreeIter newIter = 	rulesStore.AppendValues(rule.Name,
			                                            expression,
			                                            rule);
			
			// We select the new row and scroll to it.
			rulesTV.Selection.SelectIter(newIter);
			rulesTV.ScrollToCell(rulesTV.Selection.GetSelectedRows()[0],
			                     rulesTV.Columns[0],
			                     true, 1.0f, 0);
		}