From 29da731bb8bee27ed1a1c6493a56861c93383373 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 9 Feb 2010 00:08:12 -0500 Subject: [PATCH] "identifier" shouldn't be a non-terminal. --HG-- branch : calculator-experiment --- calculator.lemon | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/calculator.lemon b/calculator.lemon index 3c2f10f6..e04759eb 100644 --- a/calculator.lemon +++ b/calculator.lemon @@ -72,16 +72,13 @@ // The rules... +%type calculator { int } // !!! FIXME: remove this later. +%destructor calculator { (void) ctx; } // !!! FIXME: remove this later. calculator ::= expression(B). { parse_complete(ctx, B); } -// !!! FIXME: why is this a non-terminal? -%type identifier { TokenData } -%destructor identifier { (void) ctx; } // !!! FIXME: remove this later, it's just to shut up the compiler for now. -identifier(A) ::= IDENTIFIER(B). { A = B; } - // the expression stuff is based on Jeff Lee's ANSI C grammar. %type primary_expr { Expression * } -primary_expr(A) ::= identifier(B). { A = new_identifier_expr(ctx, &B); } +primary_expr(A) ::= IDENTIFIER(B). { A = new_identifier_expr(ctx, &B); } primary_expr(A) ::= INT_CONSTANT(B). { A = new_literal_int_expr(ctx, &B); } primary_expr(A) ::= FLOAT_CONSTANT(B). { A = new_literal_float_expr(ctx, &B); } primary_expr(A) ::= STRING_LITERAL(B). { A = new_literal_string_expr(ctx, &B); } @@ -93,7 +90,7 @@ postfix_expr(A) ::= postfix_expr(B) LBRACKET expression(C) RBRACKET. { A = new_b postfix_expr(A) ::= postfix_expr(B) LPAREN RPAREN. { A = new_binary_expr(ctx, OP_CALLFUNC, B, NULL); } postfix_expr(A) ::= postfix_expr(B) LPAREN argument_expr_list(C) RPAREN. { A = new_binary_expr(ctx, OP_CALLFUNC, B, C); } //postfix_expr(A) ::= datatype(B) LPAREN argument_expr_list(C) RPAREN. { A = new_constructor_expr(ctx, B, C); } // HLSL constructor -postfix_expr(A) ::= postfix_expr(B) DOT identifier(C). { A = new_binary_expr(ctx, OP_DEREF_STRUCT, B, new_identifier_expr(ctx, &C)); } +postfix_expr(A) ::= postfix_expr(B) DOT IDENTIFIER(C). { A = new_binary_expr(ctx, OP_DEREF_STRUCT, B, new_identifier_expr(ctx, &C)); } postfix_expr(A) ::= postfix_expr(B) PLUSPLUS. { A = new_unary_expr(ctx, OP_POSTINCREMENT, B); } postfix_expr(A) ::= postfix_expr(B) MINUSMINUS. { A = new_unary_expr(ctx, OP_POSTDECREMENT, B); }