-
Parser<Token> expressionStart = ...;
Parser<Token> expressionEnd = ...;
Parser<List<Token>> expressionBody = ...;
Parser<List<Object>> expression = expressionStart & expressionBody & expressionEnd; and unpacking expression value to flat list some thing like Parser<List<Token>> expression = expressionStart & expressionBody.unpack() & expressionEnd; |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Not sure what you expect Parser<List<Token>> expression = (expressionStart & expressionBody & expressionEnd)
.pick(1); |
Beta Was this translation helpful? Give feedback.
-
my task is getting flatten list of tokens (sorry for my poor english ☹) |
Beta Was this translation helpful? Give feedback.
-
This also includes the start and end tokens: Parser<List<Token>> expression = (expressionStart & expressionBody & expressionEnd)
.map((parts) => [parts[0], ...parts[1], parts[2]]); |
Beta Was this translation helpful? Give feedback.
This also includes the start and end tokens: