tiny.smg.scan.core.name
Defined in scan.core.
API (7)
Actions
Public operations.
Source
Source: tools/smg/src/scan/core/name.zig
zig
const std = @import("std");const smg = @import("../../root.zig");const identByte = smg.scan.scan_metrics.identByte;pub fn joinDotted(allocator: std.mem.Allocator, parts: []const []const u8) ![]const u8 { var out: std.Io.Writer.Allocating = .init(allocator); errdefer out.deinit(); for (parts, 0..) |part, index| { if (index != 0) try out.writer.writeByte('.'); try out.writer.writeAll(part); } return try out.toOwnedSlice();}pub fn leadingIdentifier(value: []const u8) ?[]const u8 { if (value.len == 0 or !identByte(value[0])) return null; var end: usize = 1; while (end < value.len and identByte(value[end])) end += 1; return value[0..end];}pub fn firstAny(value: []const u8, bytes: []const u8) ?usize { for (value, 0..) |byte, index| { for (bytes) |needle| if (byte == needle) return index; } return null;}pub fn startsUpper(name: []const u8) bool { return name.len != 0 and std.ascii.isUpper(name[0]);}pub fn startsLower(name: []const u8) bool { return name.len != 0 and std.ascii.isLower(name[0]);}pub fn isUpper(value: []const u8) bool { if (value.len == 0) return false; for (value) |byte| { if (byte >= 'a' and byte <= 'z') return false; } return true;}pub fn quoted(value: []const u8) ?[]const u8 { const quote_index = std.mem.indexOfAny(u8, value, "\"'") orelse return null; const quote = value[quote_index]; const rest = value[quote_index + 1 ..]; const end = std.mem.indexOfScalar(u8, rest, quote) orelse return null; return rest[0..end];}Source: tools/smg/src/scan/core/root.zig:3
zig
pub const name = @import("name.zig");Audit
| Definitions | 8 |
|---|---|
| Public names | 15 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |