File tree Expand file tree Collapse file tree 3 files changed +28
-17
lines changed Expand file tree Collapse file tree 3 files changed +28
-17
lines changed Original file line number Diff line number Diff line change @@ -100,19 +100,6 @@ function baseAssembly(hljs) {
100100 //in assembly, identifiers can contain periods (but may not start with them)
101101 var SOL_ASSEMBLY_LEXEMES_RE = / [ A - Z a - z _ $ ] [ A - Z a - z _ $ 0 - 9 . ] * / ;
102102
103- var SOL_ASSEMBLY_VERBATIM_RE = / \b v e r b a t i m _ [ 1 - 9 ] ? [ 0 - 9 ] i _ [ 1 - 9 ] ? [ 0 - 9 ] o \b (? ! \$ ) / ;
104- if ( isNegativeLookbehindAvailable ( ) ) {
105- //replace just first \b
106- SOL_ASSEMBLY_VERBATIM_RE = SOL_ASSEMBLY_VERBATIM_RE . source . replace ( / \\ b / , '(?<!\\$)\\b' ) ;
107- }
108-
109- //highlights the "verbatim" builtin. making a separate mode for this due to
110- //its variability.
111- var SOL_ASSEMBLY_VERBATIM_MODE = {
112- className : "built_in" ,
113- begin : SOL_ASSEMBLY_VERBATIM_RE
114- } ;
115-
116103 var SOL_ASSEMBLY_TITLE_MODE =
117104 hljs . inherit ( hljs . TITLE_MODE , {
118105 begin : / [ A - Z a - z $ _ ] [ 0 - 9 A - Z a - z $ _ ] * / ,
@@ -153,7 +140,6 @@ function baseAssembly(hljs) {
153140 HEX_QUOTE_STRING_MODE ,
154141 hljs . C_LINE_COMMENT_MODE ,
155142 hljs . C_BLOCK_COMMENT_MODE ,
156- SOL_ASSEMBLY_VERBATIM_MODE ,
157143 SOL_NUMBER ,
158144 SOL_ASSEMBLY_OPERATORS ,
159145 { // functions
Original file line number Diff line number Diff line change 88 * @since : 2016-07-01
99 */
1010
11- const { SOL_ASSEMBLY_KEYWORDS , baseAssembly } = require ( "../common.js" ) ;
11+ const {
12+ SOL_ASSEMBLY_KEYWORDS ,
13+ baseAssembly,
14+ isNegativeLookbehindAvailable
15+ } = require ( "../common.js" ) ;
1216
1317function hljsDefineYul ( hljs ) {
1418
@@ -22,9 +26,29 @@ function hljsDefineYul(hljs) {
2226 literal : SOL_ASSEMBLY_KEYWORDS . literal
2327 } ;
2428
29+ var YUL_VERBATIM_RE = / \b v e r b a t i m _ [ 1 - 9 ] ? [ 0 - 9 ] i _ [ 1 - 9 ] ? [ 0 - 9 ] o \b (? ! \$ ) / ;
30+ if ( isNegativeLookbehindAvailable ( ) ) {
31+ //replace just first \b
32+ YUL_VERBATIM_RE = YUL_VERBATIM_RE . source . replace ( / \\ b / , '(?<!\\$)\\b' ) ;
33+ }
34+
35+ //highlights the "verbatim" builtin. making a separate mode for this due to
36+ //its variability.
37+ var YUL_VERBATIM_MODE = {
38+ className : "built_in" ,
39+ begin : YUL_VERBATIM_RE
40+ } ;
41+
42+ var BASE_ASSEMBLY_ENVIRONMENT = baseAssembly ( hljs ) ;
43+
2544 return hljs . inherit (
26- baseAssembly ( hljs ) ,
27- { keywords : YUL_KEYWORDS }
45+ BASE_ASSEMBLY_ENVIRONMENT ,
46+ {
47+ keywords : YUL_KEYWORDS ,
48+ contains : BASE_ASSEMBLY_ENVIRONMENT . contains . concat ( [
49+ YUL_VERBATIM_MODE
50+ ] )
51+ }
2852 ) ;
2953}
3054
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ it('yul operators', function () {
102102} ) ;
103103
104104it ( 'verbatim' , function ( ) {
105+ this . timeout ( 4000 ) ;
105106 for ( let inArgs = 0 ; inArgs < 100 ; inArgs ++ ) {
106107 for ( let outArgs = 0 ; outArgs < 100 ; outArgs ++ ) {
107108 const verbatim = `verbatim_${ inArgs } i_${ outArgs } o` ;
You can’t perform that action at this time.
0 commit comments