From e8bd8e33bd36504ef491566b5d41001d5012fcfc Mon Sep 17 00:00:00 2001 From: zxin <15670465+ichordev@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:08:06 +1000 Subject: [PATCH 1/2] [D] Make `in` a word operator --- D/D.sublime-syntax | 5 ++++- D/tests/syntax_test_d.d | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/D/D.sublime-syntax b/D/D.sublime-syntax index 49fb20387b..2019d476dd 100644 --- a/D/D.sublime-syntax +++ b/D/D.sublime-syntax @@ -1423,7 +1423,10 @@ contexts: - match: '(<<|>>>|>>|\||\^|&)' scope: keyword.operator.bitwise.d set: value - - match: '(==|!=|\bis\b|!is\b|<=|<|>=|>|\bin\b|!in\b)' + - match: '(\bis\b|!is\b|\bin\b|!in\b)' + scope: keyword.operator.word.d keyword.operator.comparison.d + set: value + - match: '(==|!=|<=|<|>=|>)' scope: keyword.operator.comparison.d set: value - match: '=' diff --git a/D/tests/syntax_test_d.d b/D/tests/syntax_test_d.d index 184de94615..878ad3f4e5 100644 --- a/D/tests/syntax_test_d.d +++ b/D/tests/syntax_test_d.d @@ -3181,11 +3181,19 @@ extern(1) // ^ variable.other.d // ^ punctuation.terminator.d + assert(foo is bar); +//^^^^^^ keyword.other.assert.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d variable.other.d +// ^^ keyword.operator.word.d keyword.operator.comparison.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d assert(foo !is bar); //^^^^^^ keyword.other.assert.d // ^ punctuation.section.parens.begin.d // ^^^ meta.path.d variable.other.d -// ^^^ keyword.operator.comparison.d +// ^^^ keyword.operator.word.d keyword.operator.comparison.d // ^^^ meta.path.d variable.other.d // ^ punctuation.section.parens.end.d // ^ punctuation.terminator.d From 4d13331688855e5f3109965cdd4a765ff914fd6d Mon Sep 17 00:00:00 2001 From: zxin <15670465+ichordev@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:21:18 +1000 Subject: [PATCH 2/2] [D] Remove `is`/`in` keyword.operator.comparison.d --- D/D.sublime-syntax | 2 +- D/tests/syntax_test_d.d | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/D/D.sublime-syntax b/D/D.sublime-syntax index 2019d476dd..277925f906 100644 --- a/D/D.sublime-syntax +++ b/D/D.sublime-syntax @@ -1424,7 +1424,7 @@ contexts: scope: keyword.operator.bitwise.d set: value - match: '(\bis\b|!is\b|\bin\b|!in\b)' - scope: keyword.operator.word.d keyword.operator.comparison.d + scope: keyword.operator.word.d set: value - match: '(==|!=|<=|<|>=|>)' scope: keyword.operator.comparison.d diff --git a/D/tests/syntax_test_d.d b/D/tests/syntax_test_d.d index 878ad3f4e5..178c107981 100644 --- a/D/tests/syntax_test_d.d +++ b/D/tests/syntax_test_d.d @@ -1948,7 +1948,7 @@ extern(1) //^^ keyword.control.conditional.d // ^ punctuation.section.parens.begin.d // ^ variable.other.d -// ^^ keyword.operator.comparison.d +// ^^ keyword.operator.word.d // ^ variable.other.d // ^ punctuation.section.parens.end.d // ^^ meta.block.d @@ -1959,7 +1959,7 @@ extern(1) //^^ keyword.control.conditional.d // ^ punctuation.section.parens.begin.d // ^ variable.other.d -// ^^ keyword.operator.comparison.d +// ^^^ keyword.operator.word.d // ^ variable.other.d // ^ punctuation.section.parens.end.d // ^^ meta.block.d @@ -2924,7 +2924,7 @@ extern(1) // ^ meta.number.integer.decimal.d // ^^ keyword.operator.logical.d // ^^^ string.quoted.double.d -// ^^^ keyword.operator.comparison.d +// ^^^ keyword.operator.word.d // ^ punctuation.section.brackets.begin.d // ^ meta.number.integer.decimal.d // ^ punctuation.section.brackets.end.d @@ -3185,7 +3185,7 @@ extern(1) //^^^^^^ keyword.other.assert.d // ^ punctuation.section.parens.begin.d // ^^^ meta.path.d variable.other.d -// ^^ keyword.operator.word.d keyword.operator.comparison.d +// ^^ keyword.operator.word.d // ^^^ meta.path.d variable.other.d // ^ punctuation.section.parens.end.d // ^ punctuation.terminator.d @@ -3193,7 +3193,7 @@ extern(1) //^^^^^^ keyword.other.assert.d // ^ punctuation.section.parens.begin.d // ^^^ meta.path.d variable.other.d -// ^^^ keyword.operator.word.d keyword.operator.comparison.d +// ^^^ keyword.operator.word.d // ^^^ meta.path.d variable.other.d // ^ punctuation.section.parens.end.d // ^ punctuation.terminator.d