Esempio n. 1
0
 public void VerifyType(Token2Type type)
 {
     if (CurrentToken.type != type)
     {
         throw new Exception(string.Format("Expected {0}, got {1}", type, CurrentToken));
     }
 }
Esempio n. 2
0
    public void AcceptOrThrow(Token2Type type, string value)
    {
        if (CurrentToken.type != type)
        {
            throw new Exception(string.Format("Expected {0} '{2}', got {1}", type, CurrentToken, value));
        }

        if (CurrentToken.value != value)
        {
            throw new Exception(string.Format("Expected '{0}', not '{1}'", value, CurrentToken.value));
        }

        Advance(true);
    }
Esempio n. 3
0
    public bool Accept(Token2Type type, string value)
    {
        if (CurrentToken.type != type)
        {
            return(false);
        }

        if (CurrentToken.value != value)
        {
            return(false);
        }

        Advance(true);
        return(true);
    }
Esempio n. 4
0
	public void AcceptOrThrow (Token2Type type, string value)
	{
		if (CurrentToken.type != type)
			throw new Exception (string.Format ("Expected {0} '{2}', got {1}", type, CurrentToken, value));

		if (CurrentToken.value != value)
			throw new Exception (string.Format ("Expected '{0}', not '{1}'", value, CurrentToken.value));

		Advance (true);
	}
Esempio n. 5
0
	public bool Accept (Token2Type type, string value)
	{
		if (CurrentToken.type != type)
			return false;

		if (CurrentToken.value != value)
			return false;

		Advance (true);
		return true;
	}
Esempio n. 6
0
	public void VerifyType (Token2Type type)
	{
		if (CurrentToken.type != type)
			throw new Exception (string.Format ("Expected {0}, got {1}", type, CurrentToken));
	}
Esempio n. 7
0
	public Token2 (Token2Type type, char value)
	{
		//Console.WriteLine ("Token2: {0}, '{1}'", type, value);
		this.type = type;
		this.value = value.ToString ();
	}
Esempio n. 8
0
	public Token2 (Token2Type type, string value)
	{
		//Console.WriteLine ("Token2: {0}, '{1}'", type, value);
		this.type = type;
		this.value = value;
	}
Esempio n. 9
0
 public Token2(Token2Type type, char value)
 {
     //Console.WriteLine ("Token2: {0}, '{1}'", type, value);
     this.type  = type;
     this.value = value.ToString();
 }
Esempio n. 10
0
 public Token2(Token2Type type, string value)
 {
     //Console.WriteLine ("Token2: {0}, '{1}'", type, value);
     this.type  = type;
     this.value = value;
 }