Compare commits
2 Commits
95a15adad7
...
314969ec92
Author | SHA1 | Date | |
---|---|---|---|
314969ec92 | |||
1113550b5f |
@ -430,7 +430,7 @@ pub fn LineTokenizer(comptime Buffer: type) type {
|
||||
|
||||
pub const Value = union(enum) {
|
||||
pub const String = std.ArrayList(u8);
|
||||
pub const Map = std.StringHashMap(Value);
|
||||
pub const Map = std.StringArrayHashMap(Value);
|
||||
pub const List = std.ArrayList(Value);
|
||||
pub const TagType = @typeInfo(Value).Union.tag_type.?;
|
||||
|
||||
@ -727,7 +727,7 @@ pub const Parser = struct {
|
||||
// key somewhere until we can consume the
|
||||
// value. More parser state to lug along.
|
||||
|
||||
dangling_key = pair.key;
|
||||
dangling_key = try arena_alloc.dupe(u8, pair.key);
|
||||
state = .value;
|
||||
},
|
||||
.scalar => |str| {
|
||||
@ -897,7 +897,7 @@ pub const Parser = struct {
|
||||
|
||||
switch (pair.val) {
|
||||
.empty => {
|
||||
dangling_key = pair.key;
|
||||
dangling_key = try arena_alloc.dupe(u8, pair.key);
|
||||
expect_shift = .indent;
|
||||
},
|
||||
.scalar => |str| try new_map.map.put(pair.key, try Value.fromScalar(arena_alloc, str)),
|
||||
@ -995,7 +995,7 @@ pub const Parser = struct {
|
||||
.none, .dedent => switch (pair.val) {
|
||||
.empty => {
|
||||
expect_shift = .indent;
|
||||
dangling_key = pair.key;
|
||||
dangling_key = try arena_alloc.dupe(u8, pair.key);
|
||||
},
|
||||
.scalar => |str| try putMap(map, pair.key, try Value.fromScalar(arena_alloc, str), self.dupe_behavior),
|
||||
.line_string, .space_string => |str| try putMap(map, pair.key, try Value.fromString(arena_alloc, str), self.dupe_behavior),
|
||||
@ -1013,7 +1013,7 @@ pub const Parser = struct {
|
||||
switch (pair.val) {
|
||||
.empty => {
|
||||
expect_shift = .indent;
|
||||
dangling_key = pair.key;
|
||||
dangling_key = try arena_alloc.dupe(u8, pair.key);
|
||||
},
|
||||
.scalar => |str| try new_map.map.put(pair.key, try Value.fromScalar(arena_alloc, str)),
|
||||
.line_string, .space_string => |str| try new_map.map.put(pair.key, try Value.fromString(arena_alloc, str)),
|
||||
@ -1334,7 +1334,7 @@ pub const FlowParser = struct {
|
||||
.consuming_map_key => switch (char) {
|
||||
':' => {
|
||||
const tip = try getStackTip(self.stack);
|
||||
dangling_key = self.buffer[tip.item_start..idx];
|
||||
dangling_key = try self.alloc.dupe(u8, self.buffer[tip.item_start..idx]);
|
||||
|
||||
self.state = .want_map_value;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user