/// <summary> /// Determines whether the hex literal node is a literal value that overflows/underflows a 32 bit integer. /// </summary> /// <param name="node">The integer hex node to test.</param> /// <returns><see cref="LSLLiteralOverflowType"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="node"/> is <c>null</c>.</exception> public static LSLLiteralOverflowType CheckForOverflow(this ILSLHexLiteralNode node) { if (node == null) { throw new ArgumentNullException("node"); } var hexPart = node.RawText.Substring(2).TrimStart('0'); bool negative = false; switch (char.ToUpper(hexPart[0])) { case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': negative = true; break; } if (hexPart.Length > 8) { return(negative ? LSLLiteralOverflowType.Underflow : LSLLiteralOverflowType.Overflow); } return(LSLLiteralOverflowType.None); }
/// <summary> /// Visits a hex literal token node during a syntax tree traversal. /// </summary> /// <param name="node">The Syntax Tree Node.</param> /// <returns>An object of type (T) from the visitor implementation of this function.</returns> public virtual T VisitHexLiteral(ILSLHexLiteralNode node) { return(default(T)); }