~/bend-docscommunity

main.bend checks

raw source on the hub · import 0x04b9afdd6d6a56039c5ce6dfb1e55294/main.bend as Main

eztoml: the TOML slice for string-valued sectioned docs. A line is blank, a comment, a [section] header, or a key = "value" pair. A header is a dotted path whose segments may be quoted, and a key may be quoted, so a file path can be one. No arrays, no inline tables, no numbers.

parse, render, value, sects, segments, quote, key types: Kv, Sect, Toml

2 imports
import Base
import ./toml.bend as T

Definitions

def Kv source · line 12 · raw

@+key:String -> @+val:String -> 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Kv

a key and the string written for it

def Sect source · line 16 · raw

@+name:String -> @pairs:List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Kv> -> 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Sect

a section header and the pairs under it, in the order they were written

def toml source · line 20 · raw

@bad:String -> @name:String -> @pairs:List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Kv> -> @done:List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Sect> -> 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Toml

the sections read so far, and the first error if there was one

def parse source · line 25 · raw

@text:String -> 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Toml

the sections of a document, and the first error if there was one

def render source · line 29 · raw

@ss:List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Sect> -> String

a document of tables, one blank line between them

def value source · line 33 · raw

@pairs:List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Kv> -> @+key:String -> String

the value written for a key in a table, or "" when it is absent

def sects source · line 37 · raw

@t:0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Toml -> List<&2, 0x04b9afdd6d6a56039c5ce6dfb1e55294/toml.Sect>

the sections a parse found, in the order they were written

def segments source · line 41 · raw

@s:String -> List<&2, String>

a header's segments, unquoted. packages."0x0a".files is three of them

def quote source · line 46 · raw

@+s:String -> String

a string in quotes, which is how a segment or a key that is not bare is written, and how every value is

def key source · line 50 · raw

@+s:String -> String

a key as it is written: bare when it can be, quoted when it must be