File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 11hljs . registerLanguage ( "fram" , function ( hljs ) {
2+ // Based on `hljs.END_SAME_AS_BEGIN`, which is included with highlight.js.
3+ // Here we only require that the opening match group is a suffix of the
4+ // closing one. Used for Fram comments.
5+ function MATCH_BEGIN_END ( mode ) {
6+ return Object . assign ( mode ,
7+ { 'on:begin' : ( m , resp ) =>
8+ { resp . data . _beginMatch = m [ 1 ] ; } ,
9+ 'on:end' : ( m , resp ) =>
10+ { if ( ! m [ 1 ] . endsWith ( resp . data . _beginMatch ) ) resp . ignoreMatch ( ) ; }
11+ } ) ;
12+ }
13+
14+ const COMMENT_NAME = "([\\w'<>&$?!@^+\\-~*%;,=|:./#]*)" ;
15+
216 return {
317 keywords : {
418 keyword :
@@ -10,11 +24,11 @@ hljs.registerLanguage("fram", function (hljs) {
1024 contains : [
1125 hljs . APOS_STRING_MODE ,
1226 hljs . QUOTE_STRING_MODE ,
13- hljs . C_LINE_COMMENT_MODE ,
14- hljs . COMMENT ( "\\(\\*" , "\\*\\)" ) ,
27+ hljs . HASH_COMMENT_MODE ,
28+ MATCH_BEGIN_END ( hljs . COMMENT ( "{#" + COMMENT_NAME , COMMENT_NAME + "#}" ) ) ,
1529 {
1630 className : "type" ,
17- begin : "\\b[A-Z]\\w*" ,
31+ begin : "\\b[A-Z][ \\w'] *" ,
1832 } ,
1933 {
2034 className : "number" ,
You can’t perform that action at this time.
0 commit comments