Files

68 lines
1.3 KiB
C++
Raw Permalink Normal View History

// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2025 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "util.hpp"
#include <cctype>
bool blitz::utility::is_symbol(int code)
{
2025-02-12 00:03:19 +01:00
switch (code) {
case ';': // Comment
case ':': // Command Separator
case '=': // Equal
case '<': // Less Than
case '>': // Greater Than
case '~': // Bitwise Not
case '^': // Exponential (X ^ Y = pow(X, Y))
case '+': // Plus
case '-': // Minus
case '*': // Multiply
case '/': // Divide
case ',': // Parameter Separation
case '%': // Integer Type
case '#': // Real Type
case '$': // String Type
case '.': // Structured Type
case '\\': // Structured Type Access
case '[': // Blitz Arrays
case ']':
case '(': // Call, Grouping, Dim
case ')':
return true;
default:
return false;
}
return false;
}
bool blitz::utility::is_white_space(int code)
{
2025-02-12 00:03:19 +01:00
switch (code) {
case ' ':
case '\t':
return true;
default:
return false;
}
return false;
}
bool blitz::utility::is_digit(int code)
{
return isdigit(code);
}
bool blitz::utility::is_alpha(int code) {
return isalpha(code);
}
2025-02-12 00:03:19 +01:00
char blitz::utility::utf8_safe_tolower(char code)
{
if (code & 0b10000000) { // Exclude Unicode
return code;
}
return (char)std::tolower(code);
}