diff --git a/src/sdf/sdf-node.c b/src/sdf/sdf-node.c index 951ce860d..1a48ae376 100644 --- a/src/sdf/sdf-node.c +++ b/src/sdf/sdf-node.c @@ -41,7 +41,7 @@ static const imask_t has_map[S_LAST_NODE_KIND] = { (I_IDENT | I_LITERALS | I_FLAGS), // S_COND - (I_VALUE), + (I_IDENT | I_VALUE), // S_PORT (I_SUBKIND | I_IDENT | I_DIMS | I_FLAGS | I_VALUE), diff --git a/src/sdf/sdf-parse.c b/src/sdf/sdf-parse.c index 10848af17..9038fcd30 100644 --- a/src/sdf/sdf-parse.c +++ b/src/sdf/sdf-parse.c @@ -377,7 +377,6 @@ static ident_t p_identifier(void) return error_marker(); } -// TODO: How is it with the surrounding apostrophes ? Are they stripped ? static ident_t p_qstring(void) { // qstring ::= @@ -385,6 +384,9 @@ static ident_t p_qstring(void) BEGIN("qstring"); + // Qstring identifier is stored including the surrounding + // apostrophes. + // TODO: Check how is tSTRING handled in lexer. Right now it re-uses VHDL string. // I am not sure if it is defined equally! consume(tSTRING); @@ -1157,8 +1159,8 @@ static void p_name(sdf_node_t constr) consume(tLPAREN); consume(tNAME); - // TODO: qstring should be optional! - sdf_set_ident(constr, p_qstring()); + if (scan(tSTRING)) + sdf_set_ident(constr, p_qstring()); consume(tRPAREN); } @@ -1929,7 +1931,8 @@ static void p_cond_def(sdf_node_t delay) sdf_node_t cond = sdf_new(S_COND); - // TODO: Add optional qstring here! + if (scan(tSTRING)) + sdf_set_ident(cond, p_qstring()); sdf_set_expr(cond, p_conditional_port_expr()); sdf_add_cond(delay, cond); diff --git a/test/sdf/parse16.sdf b/test/sdf/parse16.sdf index d83943c29..6926201b6 100644 --- a/test/sdf/parse16.sdf +++ b/test/sdf/parse16.sdf @@ -6,7 +6,7 @@ (DELAY (ABSOLUTE (COND i_and.b==1'b0 (IOPATH i_and.a i_and.y (0.5) )) - (COND i_and.b=='b1 (IOPATH i_and.a i_and.y (0.4) )) + (COND "My condition name" i_and.b=='b1 (IOPATH i_and.a i_and.y (0.4) )) ) ) ) diff --git a/test/test_sdf.c b/test/test_sdf.c index 13fe9b4f4..dac78331e 100644 --- a/test/test_sdf.c +++ b/test/test_sdf.c @@ -715,6 +715,8 @@ START_TEST(test_sdf16) fail_unless(icmp(sdf_ident(sdf_port(d_1, 1)), "i_and.y")); sdf_node_t d_1_c_0 = sdf_cond(d_1, 0); + fail_unless(icmp(sdf_ident(d_1_c_0), "\"My condition name\"")); + sdf_node_t d_1_c_0_e_0 = sdf_expr(d_1_c_0); fail_unless(sdf_kind(d_1_c_0_e_0) == S_BINARY); fail_unless(sdf_subkind(d_1_c_0_e_0) == S_BINARY_EXPR_LOGEQ);