~/bend-docscommunity

json/quote.bend checks

raw source on the hub · import cswap-bend-cli@0.1.0.0/json/quote.bend as Quote

2 imports
import Base
import ./lex.bend as Lex

Definitions

def hexd source · line 4 · raw

@+n:U32 -> Char

def uesc source · line 8 · raw

@+n:U32 -> String

\uXXXX, lowercase hex as Python writes it.

def uesc.pair source · line 11 · raw

@+c:U32 -> String

def esc.high source · line 14 · raw

@ascii:Bool -> @+c:U32 -> String

def esc.rest source · line 21 · raw

@ascii:Bool -> @+c:U32 -> String

def esc.char source · line 27 · raw

@+ascii:Bool -> @+c:U32 -> String

One char as Python's encoder writes it inside quotes. ensure_ascii escapes everything above ~ (U+007F included); otherwise only controls.

def quote.body source · line 37 · raw

@s:String -> @+ascii:Bool -> String

def quote source · line 45 · raw

@s:String -> @ascii:Bool -> String

"text" with escapes.

def indent source · line 49 · raw

@d:Nat -> String

style 0: compact , :; 1: Python's default , : ; 2: indent=2.

def nl source · line 52 · raw

@style:U32 -> @d:Nat -> String

def sep source · line 55 · raw

@+style:U32 -> @d:Nat -> String

def colon source · line 58 · raw

@+style:U32 -> String