diff --git a/src/common/text/elements/code.js b/src/common/text/elements/code.js index 4c074492f..ccca5ab4a 100644 --- a/src/common/text/elements/code.js +++ b/src/common/text/elements/code.js @@ -288,23 +288,6 @@ const elements = [ } }, - // keyword - (code, i, source) => { - const prev = source[i - 1]; - if (prev && /[a-zA-Z]/.test(prev)) return null; - - const match = keywords.filter(k => code.substr(0, k.length) == k)[0]; - if (match) { - if (/^[a-zA-Z]/.test(code.substr(match.length))) return null; - return { - html: `${match}`, - next: match.length - }; - } else { - return null; - } - }, - // method code => { const match = code.match(/^([a-zA-Z_-]+?)\(/); @@ -332,6 +315,23 @@ const elements = [ }; }, + // keyword + (code, i, source) => { + const prev = source[i - 1]; + if (prev && /[a-zA-Z]/.test(prev)) return null; + + const match = keywords.filter(k => code.substr(0, k.length) == k)[0]; + if (match) { + if (/^[a-zA-Z]/.test(code.substr(match.length))) return null; + return { + html: `${match}`, + next: match.length + }; + } else { + return null; + } + }, + // symbol code => { const match = symbols.filter(s => code[0] == s)[0];