asciidoctor / atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
https://atom.io/packages/language-asciidoc
MIT License
42 stars 20 forks source link

correct monospaced phrase matches #84

Closed mojavelinux closed 8 years ago

mojavelinux commented 8 years ago
mojavelinux commented 8 years ago

Syntax example:

(`monospaced`)

\`monospaced

Old screenshot:

old

New screenshot:

new

mojavelinux commented 8 years ago

There are a few things to keep in mind when looking at the regular expressions in Asciidoctor core (asciidoctor.rb):

  1. The regular expressions in core are written for the Ruby 1.8 regexp engine, so they are more primitive than what Oniguruma supports. Most notably, the Ruby 1.8 regexp engine doesn't support look-behind matches (We're going to start using the Oniguruma engine in Asciidoctor 1.6).
  2. The regular expressions in core often capture groups in order to populate the AST node, or to perform more fine-grained parsing. The grammar doesn't need to capture a group unless that span of text is needed for highlighting.
  3. The grammar should skip matching escaped syntax. Core captures it only because the regexp engine doesn't support look-behind matches.
nicorikken commented 8 years ago

@mojavelinux I turned your comment in a PR #86

nicorikken commented 8 years ago

Nice fix, tested, so merge!

mojavelinux commented 8 years ago

:+1: