Here is a pseudo example of what I want to achieve:
Parser<GQInlineFragmentDefinition> inlineFragment() {
return seq3(
ref1(token, "..."),
ref1(token, "on"),
seq3(identifier(), directiveValueList(), ref0(() => fragmentBlock(
typeName: null // I want to pass the result of identifier() here
))).map3(
(typeName, directives, block) =>[typeName, GQProjection(
fragmentName: null,
token: null,
alias: null,
block: block,
directives: directives,
),]
),
)
.map3(( _, __, list) {
var typeName = list.first as String;
var projection = list.last as GQProjection;
var def = GQInlineFragmentDefinition(
typeName,
projection.block!,
projection.getDirectives(),
);
step1.addFragmentDefinition(def);
return def;
});
}
Here is a pseudo example of what I want to achieve: