Say I want to make a parser for a markdown file but it's able to contain tags/annotations like @foo(bar). I want to color the contents of bar but only if there's a @foo before it - so I tried something like this:
var parser = new Parser({
whitespace: /\s+/,
tagKey: /@\w+/,
tagValue: /(?<=@\w+)\([^\)]+\)/,
other: /\S/
});
But this did not work. When I read the api for a parser, I realized that it's probably first breaking them into separate tokens and then applying the regexes to recognize the type of each token.
Is there a way to achieve what I want or does the api not support this? Maybe you could have support for parsers that can do both .tokenize() and .identify() in one go which would allow this?
Say I want to make a parser for a markdown file but it's able to contain tags/annotations like
@foo(bar). I want to color the contents ofbarbut only if there's a@foobefore it - so I tried something like this:But this did not work. When I read the api for a parser, I realized that it's probably first breaking them into separate tokens and then applying the regexes to recognize the type of each token.
Is there a way to achieve what I want or does the api not support this? Maybe you could have support for parsers that can do both
.tokenize()and.identify()in one go which would allow this?