From 87d504883299af1bb5bd9ac39988773c620df95f Mon Sep 17 00:00:00 2001 From: TollyH Date: Mon, 6 Nov 2023 19:54:47 +0000 Subject: [PATCH] Add checks for additional numeric literal syntax error edge cases --- Assembler.cs | 17 +++-- Resources/Localization/Strings.Designer.cs | 84 +++++++++++++--------- Resources/Localization/Strings.resx | 12 +++- 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/Assembler.cs b/Assembler.cs index 7d8bbcc..13c1c1a 100644 --- a/Assembler.cs +++ b/Assembler.cs @@ -786,15 +786,24 @@ public static OperandType DetermineOperandType(string operand) : Regex.Match(operand, @"[^0-9_\.](? - /// Looks up a localized string similar to Floating point numeric literals must contain a digit on at least one side of the decimal point.. - /// - internal static string Assembler_Error_Floating_Point_Decimal_Only { - get { - return ResourceManager.GetString("Assembler_Error_Floating_Point_Decimal_Only", resourceCulture); - } - } - /// /// Looks up a localized string similar to The file "{0}" given to the IMP mnemonic could not be found.. /// @@ -281,7 +272,7 @@ internal static string Assembler_Error_Label_Already_Defined { } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to Label names cannot be empty. Did you mean to include a colon here?. /// internal static string Assembler_Error_Label_Empty_Name { get { @@ -321,6 +312,56 @@ internal static string Assembler_Error_Label_Spaces_Contained { } } + /// + /// Looks up a localized string similar to Numeric literals with a base prefix (0x or 0b) must contain at least one digit after the prefix.. + /// + internal static string Assembler_Error_Literal_Base_Prefix_Only { + get { + return ResourceManager.GetString("Assembler_Error_Literal_Base_Prefix_Only", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Floating point numeric literals must contain a digit on at least one side of the decimal point.. + /// + internal static string Assembler_Error_Literal_Floating_Point_Decimal_Only { + get { + return ResourceManager.GetString("Assembler_Error_Literal_Floating_Point_Decimal_Only", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid character in numeric literal: + /// {0} + /// {1}^ + ///Did you forget a '0x' prefix before a hexadecimal number or put a digit other than 1 or 0 in a binary number?. + /// + internal static string Assembler_Error_Literal_Invalid_Character { + get { + return ResourceManager.GetString("Assembler_Error_Literal_Invalid_Character", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Negative numeric literals must contain at least one digit.. + /// + internal static string Assembler_Error_Literal_Negative_Dash_Only { + get { + return ResourceManager.GetString("Assembler_Error_Literal_Negative_Dash_Only", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Numeric literal contains more than one decimal point: + /// {0} + /// {1}^. + /// + internal static string Assembler_Error_Literal_Too_Many_Points { + get { + return ResourceManager.GetString("Assembler_Error_Literal_Too_Many_Points", resourceCulture); + } + } + /// /// Looks up a localized string similar to The MAC mnemonic requires two operands. {0} were given.. /// @@ -411,29 +452,6 @@ internal static string Assembler_Error_NUM_Operand_Type { } } - /// - /// Looks up a localized string similar to Invalid character in numeric literal: - /// {0} - /// {1}^ - ///Did you forget a '0x' prefix before a hexadecimal number or put a digit other than 1 or 0 in a binary number?. - /// - internal static string Assembler_Error_Numeric_Invalid_Character { - get { - return ResourceManager.GetString("Assembler_Error_Numeric_Invalid_Character", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Numeric literal contains more than one decimal point: - /// {0} - /// {1}^. - /// - internal static string Assembler_Error_Numeric_Too_Many_Points { - get { - return ResourceManager.GetString("Assembler_Error_Numeric_Too_Many_Points", resourceCulture); - } - } - /// /// Looks up a localized string similar to Error on line {0} in {1} /// diff --git a/Resources/Localization/Strings.resx b/Resources/Localization/Strings.resx index 520cd8b..cefba8a 100644 --- a/Resources/Localization/Strings.resx +++ b/Resources/Localization/Strings.resx @@ -820,16 +820,16 @@ Consult the language reference for a list of all valid mnemonic/operand combinat {1}^ Label names may not contain symbols other than underscores, and cannot start with a numeral. - + Invalid character in numeric literal: {0} {1}^ Did you forget a '0x' prefix before a hexadecimal number or put a digit other than 1 or 0 in a binary number? - + Floating point numeric literals must contain a digit on at least one side of the decimal point. - + Numeric literal contains more than one decimal point: {0} {1}^ @@ -1018,4 +1018,10 @@ Press ENTER to continue, or type a command ('help' for command list): Label names cannot be empty. Did you mean to include a colon here? + + Negative numeric literals must contain at least one digit. + + + Numeric literals with a base prefix (0x or 0b) must contain at least one digit after the prefix. + \ No newline at end of file