compassPt method

Parser<CompassPt> compassPt()

A complete compass_pt.

Implementation

Parser<CompassPt> compassPt() => [
      // First try to match longer points, to avoid matching just the `n` in `ne` for example.
      ref1(token, 'ne'),
      ref1(token, 'se'),
      ref1(token, 'sw'),
      ref1(token, 'nw'),
      ref1(token, 'n'),
      ref1(token, 'e'),
      ref1(token, 's'),
      ref1(token, 'w'),
      ref1(token, 'c'),
      ref1(token, '_'),
    ].toChoiceParser().map((token) => CompassPt.fromValue(token.value));