Skip to content

Commit

Permalink
1)Adding annotation token for Java
Browse files Browse the repository at this point in the history
2)Aliasing java annotation to punctuation
3)Aliasing grovy annotation to punctuation
  • Loading branch information
desertjim committed Mar 8, 2016
1 parent 9c1a970 commit 99de6c2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions components/prism-groovy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Prism.languages.insertBefore('groovy', 'punctuation', {

Prism.languages.insertBefore('groovy', 'function', {
'annotation': {
alias: 'punctuation',
pattern: /(^|[^.])@\w+/,
lookbehind: true
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-groovy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion components/prism-java.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ Prism.languages.java = Prism.languages.extend('clike', {
pattern: /(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,
lookbehind: true
}
});
});

Prism.languages.insertBefore('java','function', {
'annotation': {
alias: 'punctuation',
pattern: /(^|[^.])@\w+/,
lookbehind: true
}
});
2 changes: 1 addition & 1 deletion components/prism-java.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions examples/prism-java.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ <h2>Full example</h2>
<pre><code>import java.util.Scanner;

public class Life {
public static void show(boolean[][] grid){

@Override @Bind("One")
public void show(boolean[][] grid){
String s = "";
for(boolean[] row : grid){
for(boolean val : row)
Expand Down Expand Up @@ -73,4 +75,4 @@ <h2>Known failures</h2>
</p>

<h3>Comment-like substrings</h3>
<pre><code>"foo /* bar */ baz"; "foo // bar";</code></pre>
<pre><code>"foo /* bar */ baz"; "foo // bar";</code></pre>
2 changes: 1 addition & 1 deletion themes/prism-solarizedlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ pre[class*="language-"] {

.token.entity {
cursor: help;
}
}

0 comments on commit 99de6c2

Please sign in to comment.