cdiggins / myna-parser

Myna Parsing Library
https://cdiggins.github.io/myna-parser
MIT License
78 stars 15 forks source link

Question: how to check in sequence if there is a whitespace + symbol #26

Open RokasVaitkevicius opened 5 years ago

RokasVaitkevicius commented 5 years ago

Hello, I don't want to capture sequence, when there are no whitespaces: bla+something+bla, I only want to capture, when there are whitespaces: bla +something+ bla. I am having trouble getting this to work.

Catching everything between + is straight forward: m.seq('+', this.plainTextEmphasis, '+').ast, but I wan to parse it only when ther is a space/empty line before and after +.

I've tried just adding space char in the sequence before +, but that doesn't seem to work: m.seq(' ', '+', this.plainTextEmphasis, '+', ' ').ast

I've also tried replacing whitespace with ws, atWs etc., but that didn't help either.

Does anyone know, how to do it properly?