From 902c6926c7f5f9c867d5fddabaf13d7fc475dab6 Mon Sep 17 00:00:00 2001 From: Neko Box Coder Date: Sat, 1 Jun 2024 22:47:50 +0100 Subject: [PATCH] Adding quote separators to number representations --- runtime/syntax/c.yaml | 9 ++++++--- runtime/syntax/cpp.yaml | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/runtime/syntax/c.yaml b/runtime/syntax/c.yaml index be41d1c07b..3a006eab8b 100644 --- a/runtime/syntax/c.yaml +++ b/runtime/syntax/c.yaml @@ -23,11 +23,14 @@ rules: - symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(offsetof|sizeof)\\b" - symbol.brackets: "[(){}]|\\[|\\]" # Integer Constants - - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b([0-9]|0[0-7]|0[Xx][0-9A-Fa-f]|0[Bb][01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b([1-9][0-9']*[0-9]|0[0-7][0-7']*[0-7])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b(0[Xx][0-9A-Fa-f][0-9A-Fa-f']*[0-9A-Fa-f]|0[Bb][01][01']*[01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Decimal Floating Constants - - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)" + - constant.number: "(\\b(([.][0-9']*[0-9]|[0-9][0-9']*[.]|[0-9][0-9']*[.][0-9']*[0-9])([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" # Hexadecimal Floating Constants - - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)" + - constant.number: "(\\b0[Xx]([.][0-9A-Za-z']*[0-9A-Za-z]|[0-9A-Za-z][0-9A-Za-z']*[.])[Pp][+-]?[0-9']+[FfLl]?\\b)" + - constant.number: "(\\b0[Xx]([0-9A-Za-z][0-9A-Za-z']*[.][0-9A-Za-z']*[0-9A-Za-z])[Pp][+-]?[0-9']+[FfLl]?\\b)" - constant.bool: "(\\b(true|false|NULL|nullptr|TRUE|FALSE)\\b)" - constant.string: diff --git a/runtime/syntax/cpp.yaml b/runtime/syntax/cpp.yaml index 0558e2946e..41f6bfff21 100644 --- a/runtime/syntax/cpp.yaml +++ b/runtime/syntax/cpp.yaml @@ -30,13 +30,16 @@ rules: # Parenthetical Color - symbol.brackets: "[(){}]|\\[|\\]" # Integer Literals - - constant.number: "(\\b([1-9][0-9']*|0[0-7']*|0[Xx][0-9a-fA-F']+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b([0-9]|0[0-7]|0[Xx][0-9A-Fa-f]|0[Bb][01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b([1-9][0-9']*[0-9]|0[0-7][0-7']*[0-7])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + - constant.number: "(\\b(0[Xx][0-9A-Fa-f][0-9A-Fa-f']*[0-9A-Fa-f]|0[Bb][01][01']*[01])([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Decimal Floating-point Literals - - constant.number: "(\\b(([0-9']*[.][0-9']+|[0-9']+[.][0-9']*)([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" + - constant.number: "(\\b(([.][0-9']*[0-9]|[0-9][0-9']*[.]|[0-9][0-9']*[.][0-9']*[0-9])([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" # Hexadecimal Floating-point Literals - - constant.number: "(\\b0[Xx]([0-9a-zA-Z']*[.][0-9a-zA-Z']+|[0-9a-zA-Z']+[.][0-9a-zA-Z']*)[Pp][+-]?[0-9']+[FfLl]?\\b)" + - constant.number: "(\\b0[Xx]([.][0-9a-zA-Z']*[0-9a-zA-Z]|[0-9a-zA-Z][0-9a-zA-Z']*[.])[Pp][+-]?[0-9']+[FfLl]?\\b)" + - constant.number: "(\\b0[Xx]([0-9a-zA-Z][0-9a-zA-Z']*[.][0-9a-zA-Z']*[0-9a-zA-Z])[Pp][+-]?[0-9']+[FfLl]?\\b)" - constant.bool: "(\\b(true|false|NULL|nullptr|TRUE|FALSE)\\b)" - + - constant.string: start: "\"" end: "\""