Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Themes:

Grammars:

- fix(java) prevent false positive variable init on `else` [Josh Goebel][]
- enh(php) named arguments [Wojciech Kania][]
- fix(php) PHP constants [Wojciech Kania][]
- fix(angelscript) incomplete int8, int16, int32, int64 highlighting [Melissa Geels][]
Expand Down
2 changes: 1 addition & 1 deletion src/languages/java.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default function(hljs) {
},
{
begin: [
JAVA_IDENT_RE,
regex.concat(/(?!else)/, JAVA_IDENT_RE),
/\s+/,
JAVA_IDENT_RE,
/\s+/,
Expand Down
6 changes: 6 additions & 0 deletions test/markup/java/bugs.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

<span class="hljs-comment">// `else x =` should not be detected as a variable creation</span>
<span class="hljs-keyword">if</span> ( O == l )
l = O1;
<span class="hljs-keyword">else</span>
a = <span class="hljs-number">01</span>;
6 changes: 6 additions & 0 deletions test/markup/java/bugs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

// `else x =` should not be detected as a variable creation
if ( O == l )
l = O1;
else
a = 01;