surroundedBySquareBrackets method

Parser<T> surroundedBySquareBrackets(
  1. {T defaultValue}
)

Implementation

Parser<T> surroundedBySquareBrackets({T defaultValue}) => opt()
    .surroundedBy(match('[').space(), match(']').space())
    .map((r) => r.value ?? defaultValue);