Ejemplo n.º 1
0
bool ReadString(char *str, int size)
{
	char ch;
	if (bufpoint >= bufsize)
	{
		FillBuf();
	}
	do // remove non symbolic data
	{
		if (PopFromBuf(&ch) == false)
		{
			return false;
		}
	} while (!IsLiteral(ch));
	do
	{
		if (IsLiteral(ch))
		{
			*str = ch;
			str++;
		}
		else // packet end
		{
			*str = 0; //  add end of string
			return true;
		}
	} while (PopFromBuf(&ch) == true);
	return false;
}
Ejemplo n.º 2
0
ExpressionNode* Parser::Factors()
{
    if(currenttoken->type == Id)
            return Variable();
    else if(currenttoken->type == OpenParenthesis){
            ConsumeToken();
            ExpressionNode * value = Expresion();
            if(currenttoken->type != CloseParenthesis)
                throw invalid_argument("Se esperaba ).  Row:"+to_string(currenttoken->row)+"Column:"+to_string(currenttoken->column));
            ConsumeToken();
            return value;
    }
    else if(IsLiteral(currenttoken))
    {
        return Literal();
    }
    else if(currenttoken->type == Verdadero)
    {
        ConsumeToken();
        return new ConstantBooleanNode(true);
    }
    else if(currenttoken->type == Falso)
    {
        ConsumeToken();
        return new ConstantBooleanNode(false);
    }

}
Ejemplo n.º 3
0
vector<CasoLineNode*> Parser::CasoListPrime()
{
    if(IsLiteral(currenttoken))
    {
        return CasoList();
    }
    else
    {
        vector<CasoLineNode*> cases;
        return cases;
    }
}
Ejemplo n.º 4
0
// { dg-options -std=c++11 }

struct IsLiteral {};

constexpr auto ab = IsLiteral();

constexpr IsLiteral bar(IsLiteral x) { return x; }

constexpr auto xy = bar(ab);