Make helper functions public
This commit is contained in:
parent
7f689c7030
commit
b0db514adc
1 changed files with 3 additions and 3 deletions
|
@ -277,7 +277,7 @@ fn isTokenChar(ch: u8) bool {
|
||||||
|
|
||||||
// Parses a quoted-string (rfc 9110) off the stream. Backslash-tokens are unescaped.
|
// Parses a quoted-string (rfc 9110) off the stream. Backslash-tokens are unescaped.
|
||||||
// The caller takes responsibility for deallocating the memory returned.
|
// The caller takes responsibility for deallocating the memory returned.
|
||||||
fn parseQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
pub fn parseQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
||||||
const reader = peek_stream.reader();
|
const reader = peek_stream.reader();
|
||||||
|
|
||||||
var data = std.ArrayList(u8).init(alloc);
|
var data = std.ArrayList(u8).init(alloc);
|
||||||
|
@ -345,7 +345,7 @@ test "parseQuotedString" {
|
||||||
// Attempts to parse a token (rfc 9110) off the stream. It stops at the first non-token
|
// Attempts to parse a token (rfc 9110) off the stream. It stops at the first non-token
|
||||||
// char. Said char reamins on the stream. If the token is empty, returns error.EmptyToken;
|
// char. Said char reamins on the stream. If the token is empty, returns error.EmptyToken;
|
||||||
// The caller takes responsibility for deallocating the memory returned.
|
// The caller takes responsibility for deallocating the memory returned.
|
||||||
fn parseToken(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
pub fn parseToken(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
||||||
var data = std.ArrayList(u8).init(alloc);
|
var data = std.ArrayList(u8).init(alloc);
|
||||||
errdefer data.deinit();
|
errdefer data.deinit();
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ test "parseToken" {
|
||||||
|
|
||||||
// Parses a token or quoted string (rfc 9110) off the stream, as appropriate.
|
// Parses a token or quoted string (rfc 9110) off the stream, as appropriate.
|
||||||
// The caller takes responsibility for deallocating the memory returned.
|
// The caller takes responsibility for deallocating the memory returned.
|
||||||
fn parseTokenOrQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
pub fn parseTokenOrQuotedString(alloc: std.mem.Allocator, peek_stream: anytype) ![]const u8 {
|
||||||
return parseToken(alloc, peek_stream) catch |err| switch (err) {
|
return parseToken(alloc, peek_stream) catch |err| switch (err) {
|
||||||
error.EmptyToken => return try parseQuotedString(alloc, peek_stream),
|
error.EmptyToken => return try parseQuotedString(alloc, peek_stream),
|
||||||
else => |e| return e,
|
else => |e| return e,
|
||||||
|
|
Loading…
Reference in a new issue