diff --git a/AlgebraicDataflowArchitectureModel/src/code/ast/NumberUtil.java b/AlgebraicDataflowArchitectureModel/src/code/ast/NumberUtil.java index dd076e8..c637f00 100644 --- a/AlgebraicDataflowArchitectureModel/src/code/ast/NumberUtil.java +++ b/AlgebraicDataflowArchitectureModel/src/code/ast/NumberUtil.java @@ -15,8 +15,8 @@ * @param token The string to be evaluated as a hexadecimal number. * @return {@code true} if the given string represents a valid hexadecimal number, * {@code false} otherwise. - * @apiNote This method returns {@code true} if the given token is a valid hexadecimal number representaion in Java source code. - * So make sure that the specification of this method is determined by Java language specification. Hexadecimal Floating-Point is not supported yet. + * @apiNote This method returns {@code true} if the given token is a valid hexadecimal number representation in Java source code. + * Therefore, the validation rules strictly adhere to the Java language specification. Hexadecimal floating-point is not supported yet. */ public static boolean isHexNumber(String token) { if (token == null) { @@ -37,29 +37,29 @@ lexer.advance(); // 0 lexer.advance(); // x - // Checks for cases like 0x or 0x_ (Invalid underscore position) + // Check for cases like 0x or 0x_ (Invalid underscore position) if (lexer.peek() == '\0' || lexer.peek() == '_') { return false; } - char prev = 'x'; // Prior character is 'x' + char prev = 'x'; // Initialize the previous character as 'x' boolean hasDigit = false; while (lexer.peek() != '\0') { char c = lexer.advance(); if (c == 'l') { - // Suffix for long literal must be the last character in the literal. + // The suffix for a long literal must be the last character in the literal. if (lexer.peek() != '\0') { return false; } - // Suffix must NOT be located right after an underscore + // The suffix must NOT be placed immediately after an underscore if (prev == '_') { return false; } - // Finish checking the format + // Valid suffix found; finish checking break; } @@ -78,7 +78,7 @@ prev = c; } - // Checks for cases like 0xFFFFF_ (Invalid underscore position) + // Check for cases like 0xFFFFF_ (Invalid trailing underscore) if (prev == '_') { return false; }