diff --git a/vscode/syntaxes/toit.tmLanguage.json b/vscode/syntaxes/toit.tmLanguage.json index 06ae74e..240b23d 100644 --- a/vscode/syntaxes/toit.tmLanguage.json +++ b/vscode/syntaxes/toit.tmLanguage.json @@ -23,7 +23,7 @@ "repository": { "import-section": { "name": "meta.import.toit", - "begin": "^import\\b", + "begin": "^import(?!-)\\b", "end": "^(?!\\s)", "beginCaptures": { "0": { @@ -36,11 +36,11 @@ }, { "name": "constant.language.import-export-all.show.toit", - "match": "\\bshow\\b" + "match": "\\b(?>>|>>|<=|>=|<|>|\\+|-|\\*|/|%|\\^|&|\\||\\[\\]\\=|\\[\\]|\\[\\.\\.\\])", + "begin": "(?>>|>>|<=|>=|<|>|\\+|-|\\*|/|%|\\^|&|\\||\\[\\]\\=|\\[\\]|\\[\\.\\.\\])", "end": "(?=\\:(?![\\p{L}_])|^\\s{0,4}(?:[^\\s/]|/[^/*]))", "beginCaptures": { "1": { @@ -333,15 +333,15 @@ "patterns": [ { "name": "keyword.control.toit", - "match": "\\b(assert|and|or|not|if|for|else|try|finally|call|while|break|continue|throw|static|abstract|return)\\b" + "match": "\\b(? # followed by any number of letters, digits, underscores or dashes. Toit actually doesn't # allow multiple dashes in a row (or the dash to be the last character), but we don't # enforce that here. The syntax highlighter only needs to render valid code correctly. +# For most `\b` (word-boundary) we use a negative-look-ahead or negative-look-behind +# to ensure that the boundary is not a dash: `(?!-)\b` or `(?>>|>>|<=|>=|<|>|\+|-|\*|/|%|\^|&|\||\[\]\=|\[\]|\[\.\.\]) + begin: (?>>|>>|<=|>=|<|>|\+|-|\*|/|%|\^|&|\||\[\]\=|\[\]|\[\.\.\]) # Ends (and thus starts the body) with a ":" (unless that's for a block), # or something that isn't intended by 4. end: (?=\:(?![\p{L}_])|^\s{0,4}(?:[^\s/]|/[^/*])) @@ -220,20 +222,20 @@ repository: keyword: patterns: - name: keyword.control.toit - match: &keywords \b(assert|and|or|not|if|for|else|try|finally|call|while|break|continue|throw|static|abstract|return)\b + match: &keywords \b(? also a type: `class C1`. # - capitalized identifier with at least on lower-case character: a type. - name: entity.name.type.toit - match: \b_?[A-Z][0-9]*\b[?]? + match: \b(?