107107 " while"
108108 " enum"
109109 " throw"
110+ " storage"
111+ " memory"
110112 )
111113 " Keywords of the solidity language." )
112114
133135 )
134136 " Constants in the solidity language." )
135137
138+ (defconst solidity-variable-modifier
139+ '(" constant"
140+ " public"
141+ " indexed"
142+ " storage"
143+ " memory"
144+ )
145+ " Modifiers of variables in solidity." )
146+
136147(defconst solidity-builtin-types
137148 '(" address"
138149 " bool"
278289 '(solidity-match-functions (1 font-lock-type-face )
279290 (2 font-lock-function-name-face ))
280291 '(solidity-match-mappings (1 font-lock-type-face )
281- (2 font-lock-function-name-face ))
292+ (3 font-lock-function-name-face ))
282293 '(solidity-match-pragma-stmt (1 font-lock-preprocessor-face )
283294 (2 font-lock-string-face ))
284295 '(solidity-match-library-decl (1 font-lock-keyword-face )
292303 '(solidity-match-event-decl (1 font-lock-keyword-face )
293304 (2 font-lock-variable-name-face ))
294305 '(solidity-match-variable-decls (1 font-lock-keyword-face )
295- (2 font-lock-variable-name-face ))
306+ (4 font-lock-variable-name-face ))
296307 `(,(regexp-opt solidity-constants 'words ) . font-lock-constant-face ))
297308 " The font lock options for solidity." )
298309
310321First match should be a keyword and second an identifier."
311322 (solidity-match-regexp
312323 (concat
313- " *\\ (contract\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
324+ " *\\ (contract\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
314325 limit))
315326
316327(defun solidity-match-library-decl (limit )
@@ -319,7 +330,7 @@ First match should be a keyword and second an identifier."
319330First match should be a keyword and second an identifier."
320331 (solidity-match-regexp
321332 (concat
322- " *\\ (library\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
333+ " *\\ (library\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
323334 limit))
324335
325336(defun solidity-match-pragma-stmt (limit )
@@ -328,7 +339,7 @@ First match should be a keyword and second an identifier."
328339First match should be a keyword and second an identifier."
329340 (solidity-match-regexp
330341 (concat
331- " *\\ (pragma\\ ) * \\ (.*\\ );" )
342+ " *\\ (pragma\\ ) + \\ (.*\\ );" )
332343 limit))
333344
334345(defun solidity-match-struct-decl (limit )
@@ -337,7 +348,7 @@ First match should be a keyword and second an identifier."
337348First match should be a keyword and second an identifier."
338349 (solidity-match-regexp
339350 (concat
340- " *\\ (struct\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
351+ " *\\ (struct\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
341352 limit))
342353
343354(defun solidity-match-functions (limit )
@@ -346,7 +357,7 @@ First match should be a keyword and second an identifier."
346357Highlight the 1st result."
347358 (solidity-match-regexp
348359 (concat
349- " *\\ (function\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
360+ " *\\ (function\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
350361 limit))
351362
352363(defun solidity-match-event-decl (limit )
@@ -355,7 +366,7 @@ Highlight the 1st result."
355366Highlight the 1st result."
356367 (solidity-match-regexp
357368 (concat
358- " *\\ (event\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
369+ " *\\ (event\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
359370 limit))
360371
361372(defun solidity-match-modifier-decl (limit )
@@ -364,7 +375,7 @@ Highlight the 1st result."
364375Highlight the 1st result."
365376 (solidity-match-regexp
366377 (concat
367- " *\\ (modifier\\ ) * \\ (" solidity-identifier-regexp " \\ )" )
378+ " *\\ (modifier\\ ) + \\ (" solidity-identifier-regexp " \\ )" )
368379 limit))
369380
370381(defun solidity-match-mappings (limit )
@@ -373,7 +384,7 @@ Highlight the 1st result."
373384Highlight the 1st result."
374385 (solidity-match-regexp
375386 (concat
376- " *\\ (mapping\\ ) * (.*) *\\ (" solidity-identifier-regexp " \\ )" )
387+ " *\\ (mapping\\ ) + (.*) * \\ ( " ( regexp-opt solidity-variable-modifier) " \\ ) *\\ (" solidity-identifier-regexp " \\ )" )
377388 limit))
378389
379390(defun solidity-match-variable-decls (limit )
@@ -382,7 +393,7 @@ Highlight the 1st result."
382393Highlight the 1st result."
383394 (solidity-match-regexp
384395 (concat
385- " *\\ (" (regexp-opt solidity-builtin-types) " \\ ) *\\ (" solidity-identifier-regexp " \\ )" )
396+ " *\\ (" (regexp-opt solidity-builtin-types) " * \\ ( \\ [ *[0-9]* \\ ] \\ )* * \\ ) " " \\ ( " ( regexp-opt solidity-variable-modifier) " \\ )* *\\ (" solidity-identifier-regexp " \\ )" )
386397 limit))
387398
388399; ; solidity syntax table
0 commit comments