thp-lang.org/lexer/utils.ts

16 lines
391 B
TypeScript
Raw Normal View History

2024-03-26 23:05:58 +00:00
export function is_digit(c: string): boolean {
return c >= '0' && c <= '9';
2024-03-27 13:12:32 +00:00
}
export function is_lowercase(c: string): boolean {
return c >= 'a' && c <= 'z';
}
export function is_uppercase(c: string): boolean {
return c >= 'A' && c <= 'Z';
}
export function is_identifier_char(c: string): boolean {
return is_lowercase(c) || is_uppercase(c) || is_digit(c) || c === '_';
}