Skip to content

I want the result of parser to be passed to the next parser as an argument. #191

@Oualitsen

Description

@Oualitsen

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;
    });
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions