Class ValidationUtil

java.lang.Object
uk.co.real_logic.sbe.ValidationUtil

public class ValidationUtil extends Object
Various validation utilities used across parser, IR, and generator
  • Constructor Details

    • ValidationUtil

      public ValidationUtil()
  • Method Details

    • isSbeCName

      public static boolean isSbeCName(String value)
      Check value for validity of usage as a C identifier. A programmatic variable must have all elements be a letter or digit or '_'. The first character must not be a digit. And must not be a C keyword.

      C keywords

      Parameters:
      value - to check
      Returns:
      true for validity as a C name. false if not.
    • isCKeyword

      public static boolean isCKeyword(String token)
      Is the token a C language keyword?
      Parameters:
      token - to be checked.
      Returns:
      true if the token a C language keyword.
    • isSbeCppName

      public static boolean isSbeCppName(String value)
      Check value for validity of usage as a C++ identifier. A programmatic variable must have all elements be a letter or digit or '_'. The first character must not be a digit. And must not be a C++ keyword.

      C++ keywords

      Parameters:
      value - to check
      Returns:
      true for validity as a C++ name. false if not.
    • isCppKeyword

      public static boolean isCppKeyword(String token)
      Is the token a C++ language keyword?
      Parameters:
      token - to be checked.
      Returns:
      true if the token a C++ language keyword.
    • isSbeJavaName

      public static boolean isSbeJavaName(String value)
      Check string for validity of usage as a Java identifier. Avoiding keywords.

      Java JLS

      Parameters:
      value - to check
      Returns:
      true for validity as a Java name. false if not.
    • isJavaKeyword

      public static boolean isJavaKeyword(String token)
      Is this token a Java keyword?
      Parameters:
      token - to be tested.
      Returns:
      true if a Java keyword otherwise false.
    • isSbeGolangName

      public static boolean isSbeGolangName(String value)
      "Check" value for validity of usage as a golang identifier. From: Golang identifiers

      identifier = letter { letter | unicode_digit } letter = unicode_letter | "_" .

      unicode_letter and unicode_digit are defined in section 4.5 of the unicode standard at Unicode 8.0.0 and the Java Character and Digit functions are unicode friendly

      Parameters:
      value - to check
      Returns:
      true for validity as a golang name. false if not.
    • isGolangKeyword

      public static boolean isGolangKeyword(String token)
      Is the token a Go language keyword?
      Parameters:
      token - to be checked.
      Returns:
      true if the token a Go language keyword.
    • isSbeCSharpName

      public static boolean isSbeCSharpName(String value)
      "Check" value for validity of usage as a csharp identifier. C# identifiers Which basically boils down to

      first subsequent* first is { @ | letter | underscore } subsequent is { first | digit | connecting | combining | formatting }*

      letter is Lu, Ll, Lt, Lm, Lo, or Nl (possibly escaped) digit is Nd (possibly escaped) connecting is Pc (possibly escaped) combining is Mn or Mc (possibly escaped) formatting is Cf (possibly escaped)

      so that all becomes: { @ | _ | Lu | Ll | Lt | Lm | Lo | Nl } { @ | _ | Lu | Ll | Lt | Lm | Lo | Nl | Nd | Pc | Mn | Mc | Cf}*

      Parameters:
      value - to check
      Returns:
      true for validity as a csharp name. false if not.
    • isCSharpKeyword

      public static boolean isCSharpKeyword(String token)
      Is the token a C# language keyword?
      Parameters:
      token - to be checked.
      Returns:
      true if the token a C# language keyword.
    • possibleCSharpKeyword

      public static boolean possibleCSharpKeyword(String value)
      Is the value a possible C# language keyword?
      Parameters:
      value - to be checked.
      Returns:
      true if the value is a possible C# language keyword.