]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/scala.js
1 /*! `scala` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= ( function () {
8 Author: Jan Berkel <jan.berkel@gmail.com>
9 Contributors: Erik Osheim <d_m@plastic-idolatry.com>
10 Website: https://www.scala-lang.org
13 function scala ( hljs
) {
14 const regex
= hljs
. regex
;
20 // used in strings for escaping/interpolation/substitution
24 { begin : ' \\ $[A-Za-z0-9_]+' },
43 contains : [ hljs
. BACKSLASH_ESCAPE
]
50 hljs
. BACKSLASH_ESCAPE
,
67 begin : ' \\ b[A-Z][A-Za-z0-9_]*' ,
73 begin : /[^ 0 - 9 \n\t "'(),.`{}\[\]:;][^ \n\t " '(),.`{}\[\]:;]+|[^0-9 \n\t "' (),. `{}\[\]:;=]/,
79 beginKeywords: 'class object trait type',
83 hljs.C_LINE_COMMENT_MODE,
84 hljs.C_BLOCK_COMMENT_MODE,
86 beginKeywords: 'extends with',
97 hljs.C_LINE_COMMENT_MODE,
98 hljs.C_BLOCK_COMMENT_MODE,
110 hljs.C_LINE_COMMENT_MODE,
111 hljs.C_BLOCK_COMMENT_MODE,
119 className: 'function',
120 beginKeywords: 'def',
121 end: regex.lookahead(/[:={\[( \n ;]/),
127 /^\s*/, // Is first token on the line
129 /\s+(?=[[(])/, // followed by at least one space and ` [ ` or ` ( `
131 beginScope: { 2: "keyword", }
136 /^\s*/, // Is first token on the line
139 /(extension \b )?/, // ` extension
` is the only marker that follows an ` end
` that cannot be captured by another rule.
147 // TODO: use negative look-behind in future
148 // /(?<!\.) \b inline(?=\s)/
149 const INLINE_MODES = [
150 { match: /\.inline \b / },
152 begin: / \b inline(?=\s)/,
157 const USING_PARAM_CLAUSE = {
159 /\(\s*/, // Opening ` ( ` of a parameter or argument list
161 /\s+(?!\))/, // Spaces not followed by ` ) `
163 beginScope: { 2: "keyword", }
166 // glob all non-whitespace characters as a "string"
167 // sourced from https://github.com/scala/docs.scala-lang/pull/2845
168 const DIRECTIVE_VALUE = {
174 // sourced from https://github.com/scala/docs.scala-lang/pull/2845
175 const USING_DIRECTIVE = {
197 literal: 'true false null',
198 keyword: 'type yield lazy override def with val var sealed abstract private trait object if then forSome for while do throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit export enum given transparent'
202 hljs.C_LINE_COMMENT_MODE,
203 hljs.C_BLOCK_COMMENT_MODE,
222 export default hljsGrammar;