From 268cf9905509b87de33a00342ee1cce9a1bdc5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Segersv=C3=A4rd?= <oseg@google.com> Date: Mon, 23 Jan 2017 15:15:31 +0100 Subject: [PATCH] [java mode] Make @interface a defining keyword --- mode/clike/clike.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mode/clike/clike.js b/mode/clike/clike.js index cad2d5145..bba2ec905 100644 --- a/mode/clike/clike.js +++ b/mode/clike/clike.js @@ -425,16 +425,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "do else enum extends final finally float for goto if implements import " + "instanceof interface native new package private protected public " + "return static strictfp super switch synchronized this throw throws transient " + - "try volatile while"), + "try volatile while @interface"), types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + "Integer Long Number Object Short String StringBuffer StringBuilder Void"), blockKeywords: words("catch class do else finally for if switch try while"), - defKeywords: words("class interface package enum"), + defKeywords: words("class interface package enum @interface"), typeFirstDefinitions: true, atoms: words("true false null"), number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i, hooks: { "@": function(stream) { + // Don't match the @interface keyword. + if (stream.match('interface', false)) return false; + stream.eatWhile(/[\w\$_]/); return "meta"; } -- GitLab