x1
{
#include <stdio.h>
#include <string.h>
typedef struct MyParseNode {
char type;
} MyParseNode;
#undef D_ParseNode_User
#define D_ParseNode_User MyParseNode
#include "d.h"
}
S : 'S' A* 'E' {
printf("[%c/%02X]\n", $1.type, $1.type);
}
;
A : 'A' | 'a' {
$$.type = *$n0.start_loc.s;
}
;
Excuse me, I push the button early.
The Input is: SaAE
The Output is : [ /00]
In this grammar, I set the UserParserNode, and save one char in type, but the printf can output the right result.
It seems DParser drop some UserParserNodes when use syntax "A*"
Another comment, when I use "Stmt*", I can get right node from d_get_child(), when use "( Stmt )*", I will get this bug either.
Sorry for my question, I review the source code, I think I had solved them now.
( Stmt )* get D_ParseNode must use d_get_child(d_get_child(&$n1, 1), 0), and Stmt* use d_get_child only one.