From fcd667a0ebe73a7868e93232faea36d56535be18 Mon Sep 17 00:00:00 2001 From: eudoxia Date: Mon, 2 May 2022 12:37:11 -0400 Subject: reorganised docs locations (doc/* -> doc/online/*, doc/freestanding/* -> doc/*) --- doc/data.html | 126 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 61 deletions(-) mode change 100755 => 100644 doc/data.html (limited to 'doc/data.html') diff --git a/doc/data.html b/doc/data.html old mode 100755 new mode 100644 index 9fddef4..05bc7cf --- a/doc/data.html +++ b/doc/data.html @@ -3,57 +3,69 @@ - - - - - - -data.lp — DistressNetwork° - + + -
-
-
data.lp
-
+

data.lp

This file contains the various data processing-related constants and functions referenced by the tangling and weaving processes.

*:

-
(License)
+
(License)
 
-(Imports)
+(Imports)
 
-(Processing limits)
+(Processing limits)
 
-(Formatting keywords)
+(Formatting keywords)
 
-(Configuration keywords)
+(Configuration keywords)
 
-(Data structure types)
+(Data structure types)
 
-(Error set)
+(Error set)
 
-(Line splitting function)
+(Line splitting function)
 
-(Configuration searching function)
+(Configuration searching function)
 
-(Section searching function)
+(Section searching function)
 
-(Command type detection function)
+(Command type detection function)
 
-(Parsing functions)
+(Parsing functions)
 
-(Code generation functions)
+(Code generation functions)
 
-(Text generation function)
+(Text generation function)
 

License:

-
// Copyright 2022 DistressNetwork° <uplink@distress.network>
-// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
// Copyright 2022 DistressNetwork° <uplink@distress.network>
+// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
 

Constants

@@ -173,7 +185,7 @@ pub const LineRange = struct { var buffer = std.ArrayList([]const u8).init(alloc); defer buffer.deinit(); - (Split file at each newline) + (Split file at each newline) return buffer.toOwnedSlice(); } @@ -208,11 +220,11 @@ while (iterator.next()) |line| { return try fmt_conf(line, key, alloc); } } - log(.err, "config declaration '{s}' not found", .{std.mem.trimRight(u8, key, " \t")}); + log(.err, "config declaration '{s}' not found", .{std.mem.trimRight(u8, key, " \t")}); return error.NotFound; } -(Auxiliary formatting function) +(Auxiliary formatting function)

If the declaration is found, its contained format string is split along instances of the section name escape sequence, and each substring has its instances of the newline escape sequence replaced with a literal newline.

@@ -240,7 +252,7 @@ while (iterator.next()) |line| { for (list) |section, index| { if (std.mem.eql(u8, section.name, name)) return index; } - log(.err, "section '{s}' not found", .{name}); + log(.err, "section '{s}' not found", .{name}); return error.NotFound; }
@@ -276,7 +288,7 @@ fn command_type(line: []const u8) CommandType { var sections = std.ArrayList(Section).init(alloc); defer sections.deinit(); - (Main parsing routine) + (Main parsing routine) return sections.toOwnedSlice(); } @@ -285,7 +297,7 @@ fn parse_code(lines: [][]const u8, index: u32, alloc: Allocator) !CodeReturn { var content = std.ArrayList(Content).init(alloc); defer content.deinit(); - (Code parsing subroutine) + (Code parsing subroutine) return CodeReturn{ .content = content.toOwnedSlice(), .index = i + 1 }; } @@ -310,10 +322,10 @@ while (i < lines.len) { const line = lines[i]; switch (command_type(line)) { .start => { - (Add new section) + (Add new section) }, .add => { - (Append to section) + (Append to section) }, .end => { log(.err, "line {d}: unexpected section end", .{i + 1}); @@ -331,12 +343,12 @@ while (i < lines.len) {

Add new section:

const name = line[(k_start.len)..];
-log(.debug, "({d}) starting section '{s}'", .{ i + 1, name });
+log(.debug, "({d}) starting section '{s}'", .{ i + 1, name });
 
 const section = try parse_code(lines, i + 1, alloc);
 try sections.append(.{ .name = name, .content = section.content });
 
-log(.debug, "({d}) ending section '{s}'", .{ section.index, name });
+log(.debug, "({d}) ending section '{s}'", .{ section.index, name });
 i = section.index;
 
@@ -345,7 +357,7 @@ i = section.index;

Append to section:

const name = line[(k_add.len)..];
-log(.debug, "({d}) appending to section '{s}'", .{ i + 1, name });
+log(.debug, "({d}) appending to section '{s}'", .{ i + 1, name });
 
 const section = try parse_code(lines, i + 1, alloc);
 const index = try search(sections.items, name);
@@ -353,7 +365,7 @@ const old = &sections.items[index];
 const new = try std.mem.concat(alloc, Content, &[_][]const Content{ old.*.content, section.content });
 old.*.content = new;
 
-log(.debug, "({d}) ending section '{s}'", .{ section.index, name });
+log(.debug, "({d}) ending section '{s}'", .{ section.index, name });
 i = section.index;
 
@@ -370,13 +382,13 @@ while (i < lines.len) { return error.UnexpectedStart; }, .ref => { - (Add reference) + (Add reference) }, .end => { break; }, else => { - (Add literal range) + (Add literal range) }, } } @@ -388,7 +400,7 @@ while (i < lines.len) {
const ref_name = std.mem.trimLeft(u8, line, " \t")[(k_ref.len)..];
 try content.append(.{ .reference = ref_name });
-log(.debug, "({d}) \tappended reference '{s}'", .{ i + 1, ref_name });
+log(.debug, "({d}) \tappended reference '{s}'", .{ i + 1, ref_name });
 i += 1;
 
@@ -429,17 +441,17 @@ fn codegen_main(lines: [][]const u8, list: []Section, index: usize, depth: u8, a defer buffer.deinit(); const section = list[index]; - log(.debug, "generating section '{s}'", .{section.name}); + log(.debug, "generating section '{s}'", .{section.name}); for (section.content) |content| switch (content) { .literal => |range| { - (Append literal range) + (Append literal range) }, .reference => |name| { - (Resolve reference) + (Resolve reference) }, }; - log(.debug, "ending section '{s}'", .{section.name}); + log(.debug, "ending section '{s}'", .{section.name}); return buffer.toOwnedSlice(); } @@ -475,7 +487,7 @@ try buffer.appendSlice(code); var buffer = std.ArrayList([]const u8).init(alloc); defer buffer.deinit(); - (Process configuration declarations) + (Process configuration declarations) var current_name: []const u8 = undefined; for (lines) |line| { @@ -486,16 +498,16 @@ try buffer.appendSlice(code); continue; } else switch (command_type(line)) { .start => { - (Format starting command) + (Format starting command) }, .add => { - (Format appending command) + (Format appending command) }, .ref => { - (Format reference command) + (Format reference command) }, .end => { - (Format ending command) + (Format ending command) }, else => { try buffer.append(line); @@ -548,13 +560,5 @@ try buffer.append(try std.mem.concat(alloc, u8, &[_][]const u8{ line[0..star
try buffer.append(try std.mem.join(alloc, current_name, conf_end));
 
-
- -
- - + \ No newline at end of file -- cgit v1.2.3