Skip to content

Commit 47f15b2

Browse files
authored
Merge pull request #45 from reserve-protocol/master
Avoid keyword-coloring keywords when they're substrings of tokens
2 parents 0d3cdcd + 719046e commit 47f15b2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

solidity-mode.el

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Possible values are:
344344
First match should be a keyword and second an identifier."
345345
(solidity-match-regexp
346346
(concat
347-
" *\\(contract\\) +\\(" solidity-identifier-regexp "\\)")
347+
" *\\(\\<contract\\>\\) +\\(" solidity-identifier-regexp "\\)")
348348
limit))
349349

350350
(defun solidity-match-library-decl (limit)
@@ -353,7 +353,7 @@ First match should be a keyword and second an identifier."
353353
First match should be a keyword and second an identifier."
354354
(solidity-match-regexp
355355
(concat
356-
" *\\(library\\) +\\(" solidity-identifier-regexp "\\)")
356+
" *\\(\\<library\\>\\) +\\(" solidity-identifier-regexp "\\)")
357357
limit))
358358

359359
(defun solidity-match-pragma-stmt (limit)
@@ -362,7 +362,7 @@ First match should be a keyword and second an identifier."
362362
First match should be a keyword and second an identifier."
363363
(solidity-match-regexp
364364
(concat
365-
" *\\(pragma\\) +\\(.*\\);")
365+
" *\\(\\<pragma\\>\\) +\\(.*\\);")
366366
limit))
367367

368368
(defun solidity-match-struct-decl (limit)
@@ -371,7 +371,7 @@ First match should be a keyword and second an identifier."
371371
First match should be a keyword and second an identifier."
372372
(solidity-match-regexp
373373
(concat
374-
" *\\(struct\\) +\\(" solidity-identifier-regexp "\\)")
374+
" *\\(\\<struct\\>\\) +\\(" solidity-identifier-regexp "\\)")
375375
limit))
376376

377377
(defun solidity-match-functions (limit)
@@ -380,7 +380,7 @@ First match should be a keyword and second an identifier."
380380
Highlight the 1st result."
381381
(solidity-match-regexp
382382
(concat
383-
" *\\(function\\) +\\(" solidity-identifier-regexp "\\)")
383+
" *\\(\\<function\\>\\) +\\(" solidity-identifier-regexp "\\)")
384384
limit))
385385

386386
(defun solidity-match-event-decl (limit)
@@ -389,7 +389,7 @@ Highlight the 1st result."
389389
Highlight the 1st result."
390390
(solidity-match-regexp
391391
(concat
392-
" *\\(event\\) +\\(" solidity-identifier-regexp "\\)")
392+
" *\\(\\<event\\>\\) +\\(" solidity-identifier-regexp "\\)")
393393
limit))
394394

395395
(defun solidity-match-modifier-decl (limit)
@@ -398,7 +398,7 @@ Highlight the 1st result."
398398
Highlight the 1st result."
399399
(solidity-match-regexp
400400
(concat
401-
" *\\(modifier\\) +\\(" solidity-identifier-regexp "\\)")
401+
" *\\(\\<modifier\\>\\) +\\(" solidity-identifier-regexp "\\)")
402402
limit))
403403

404404
(defun solidity-match-mappings (limit)
@@ -407,7 +407,7 @@ Highlight the 1st result."
407407
Highlight the 1st result."
408408
(solidity-match-regexp
409409
(concat
410-
" *\\(mapping\\) *(.*) *\\("(regexp-opt solidity-variable-modifier) " \\)*\\(" solidity-identifier-regexp "\\)")
410+
" *\\(\\<mapping\\>\\) *(.*) *\\("(regexp-opt solidity-variable-modifier) " \\)*\\(" solidity-identifier-regexp "\\)")
411411
limit))
412412

413413
(defun solidity-match-variable-decls (limit)
@@ -416,7 +416,7 @@ Highlight the 1st result."
416416
Highlight the 1st result."
417417
(solidity-match-regexp
418418
(concat
419-
" *\\(" (regexp-opt solidity-builtin-types) " *\\(\\[ *[0-9]*\\]\\)* *\\) " "\\("(regexp-opt solidity-variable-modifier) " \\)* *\\(" solidity-identifier-regexp "\\)")
419+
" *\\(" (regexp-opt solidity-builtin-types 'words) " *\\(\\[ *[0-9]*\\]\\)* *\\) " "\\("(regexp-opt solidity-variable-modifier 'words) " \\)* *\\(" solidity-identifier-regexp "\\)")
420420
limit))
421421

422422
;; solidity syntax table

0 commit comments

Comments
 (0)