Skip to content

Commit

Permalink
Support value modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
taku0 committed Jul 10, 2022
1 parent dc26ac6 commit 3dc0718
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kotlin-mode-lexer.el
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ expression as a token with one of the following types:
'("vararg" "crossinline" "noinline"))

(defconst kotlin-mode--function-modifier-keywords
'("tailrec" "operator" "infix" "inline" "external" "suspend"))
'("tailrec" "operator" "infix" "inline" "value" "external" "suspend"))

(defconst kotlin-mode--modifier-keywords
(append kotlin-mode--inheritance-modifier-keywords
Expand Down Expand Up @@ -644,8 +644,9 @@ expression as a token with one of the following types:
;; Labels
(eq (kotlin-mode--token-type previous-token) 'label)
;; Modifiers
(member (kotlin-mode--token-text previous-token)
kotlin-mode--modifier-keywords))
(and (member (kotlin-mode--token-text previous-token)
kotlin-mode--modifier-keywords)
(not (equal (kotlin-mode--token-text previous-token) "value"))))
nil)

;; Tokens that cannot end a statement
Expand Down
7 changes: 7 additions & 0 deletions test/pathological.kt
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,15 @@ public
)
->
C

// value class

value
class Foo { // KNOWN_BUG
} // KNOWN_BUG
}


// statements
fun foo() {
//explicit semicolons
Expand Down

0 comments on commit 3dc0718

Please sign in to comment.