peta / turtle.tmbundle

Totally awesome Textmate bundle for Turtle – the terse RDF Triple Language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid regexes as detected by GitHub's grammar compiler

lildude opened this issue Β· comments

πŸ‘‹ I'm the lead maintainer of the https://github.com/github/linguist library which is used for language detection and providing the syntax highlighting for languages on GitHub.com, and we use this grammar.

Our grammar compiler has found a problem with your grammar which I thought I'd let you know about.

- [ ] repository `vendor/grammars/turtle.tmbundle` (from https://github.com/peta/turtle.tmbundle) (5 errors)
  - Invalid regex in grammar: `source.turtle` (in `Syntaxes/Turtle.tmLanguage`) contains a malformed regex (regex "`(?x)                        (?<PN_CHARS_U>[\p{L}\p{M`...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 73))
  - Invalid regex in grammar: `source.turtle` (in `Syntaxes/Turtle.tmLanguage`) contains a malformed regex (regex "`(?x)                                (?<PNAME_NS> (?: (?: [\`...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 68))
  - Invalid regex in grammar: `source.turtle` (in `Syntaxes/Turtle.tmLanguage`) contains a malformed regex (regex "`(?x)((?<=\s|^|_)(?:[\p{L}\p{M}] `...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 57))
  - Invalid regex in grammar: `source.turtle` (in `Syntaxes/Turtle.tmLanguage`) contains a malformed regex (regex "`(?x)(                               (?: [\p{L}\p{M}] | [:0`...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 121))
  - Invalid regex in grammar: `source.turtle` (in `Syntaxes/Turtle.tmLanguage`) contains a malformed regex (regex "`\[[\u20\u9\uD\uA]*\]`": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 4))

GitHub uses PCRE instead of Ruby's Oniguruma regex engine for performance reasons which means some of your regexes aren't interpretted, in this case the \u unicode matches. You should be able to switch these out for \x{} equivalents without breaking the Textmate highlighting.