parse.bend checks
raw source on the hub · import element-html@0.1.0.0/parse.bend as Parse
3 imports
import Base import ./dom.bend as Dom import ./tokenize.bend as Tk
Types
type Frame source · line 21 · raw
Data
Frame@tag:String -> @attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> @kids:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node> -> @head:Bool -> Frame
type B source · line 29 · raw
Data
stack: open elements, top first; the body frame is always at the bottom. cm: where a comment goes (13.2.6: the insertion mode's "comment token"): 0 before head, 4 after head and 3 after body: the document or <html>, which this DOM does not keep, so it is dropped; 1 in head: into head (or the open head element); 2 in body: the open element.
B@stack:List<&2, Frame> -> @head:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node> -> @body_attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> @in_body:Bool -> @html_attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> @cm:U32 -> B
type SK source · line 227 · raw
Data
SHtmlSK
SIgnoreSK
SBodySK
SHeadVoidSK
SHeadOpenSK
SVoidSK
SOpenSK
Definitions
def is_one_of source · line 32 · raw
@+s:String -> @xs:List<&2, String> -> Bool
def void_tags source · line 39 · raw
List<&2, String>
def head_tags source · line 42 · raw
List<&2, String>
def closes_p source · line 45 · raw
List<&2, String>
def headings source · line 50 · raw
List<&2, String>
def scope_tags source · line 54 · raw
List<&2, String>
Scope boundaries: an open element below one of these is out of reach.
def is_ws_text source · line 57 · raw
@s:String -> Bool
def frame_tag source · line 66 · raw
@f:Frame -> String
def top_tag source · line 71 · raw
@xs:List<&2, Frame> -> String
def add_kid source · line 78 · raw
@f:Frame -> @+n:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> Frame
def append_node source · line 83 · raw
@xs:List<&2, Frame> -> @+n:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> List<&2, Frame>
def node_of source · line 90 · raw
@f:Frame -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
def frame_head source · line 95 · raw
@f:Frame -> Bool
def pop1 source · line 102 · raw
@b:B -> B
Close the top frame: its element joins the frame below it, or <head> if it was opened there. The body frame (last) is never closed here.
def stack_of source · line 117 · raw
@b:B -> List<&2, Frame>
def open_in source · line 123 · raw
@xs:List<&2, Frame> -> @+name:String -> @+stop:List<&2, String> -> Bool
Is name open, above any scope boundary in stop?
def close_go source · line 134 · raw
@fuel:Nat -> @+b:B -> @+name:String -> @top:Bool -> B
Pop frames until one named name has been popped (the caller checked it is
open). top says whether the top frame is name.
def close_to source · line 145 · raw
@+b:B -> @+name:String -> B
def close_if source · line 148 · raw
@open:Bool -> @+b:B -> @+name:String -> B
def close_if_open source · line 155 · raw
@+b:B -> @+name:String -> @+stop:List<&2, String> -> B
def implied_closes source · line 160 · raw
@+b:B -> @+name:String -> B
def push source · line 172 · raw
@b:B -> @+f:Frame -> B
def append source · line 177 · raw
@b:B -> @+n:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> B
def to_head source · line 182 · raw
@b:B -> @+n:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> B
def enter_body source · line 187 · raw
@b:B -> B
def has_name source · line 192 · raw
@xs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> @+n:String -> Bool
def add_new source · line 201 · raw
@xs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> @+acc:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr>
def set_html_attrs source · line 212 · raw
@b:B -> @+attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> B
<html>'s attributes go to the root element (HTML 13.2.6.4.7: an attribute the element already has is kept).
def set_body_attrs source · line 217 · raw
@b:B -> @+attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> B
def in_body_of source · line 222 · raw
@b:B -> Bool
def start_kind source · line 236 · raw
@+name:String -> @+in_body:Bool -> SK
def cm_of source · line 244 · raw
@b:B -> U32
def set_cm source · line 249 · raw
@b:B -> @+v:U32 -> B
def into_head source · line 255 · raw
@+b:B -> B
<head>, or a head element before the body (an implied head), is "in head"
def on_start source · line 258 · raw
@k:SK -> @+b:B -> @+name:String -> @+attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> B
def on_end source · line 277 · raw
@+b:B -> @+name:String -> B
def after_text source · line 286 · raw
@+b:B -> @+s:String -> B
Text: whitespace before the body is dropped; text in an open head element (title, style, script) stays there; anything else starts the body. text that is not white space after the body puts the parser back in body
def text_in source · line 289 · raw
@+b:B -> @+s:String -> B
def frame_fresh source · line 298 · raw
@xs:List<&2, Frame> -> Bool
A newline right after <pre>, <listing> or <textarea>'s start tag is not text (13.2.6.4.7: "if the next token is a U+000A LINE FEED, ignore it"): the text is that element's first child. It was kept, and innerText of <pre>\nline</pre> read "\nline" (Chrome: "line").
def lf_dropped source · line 307 · raw
@drop:Bool -> @+s:String -> String
def on_text source · line 314 · raw
@+b:B -> @+s0:String -> B
def comment_node source · line 320 · raw
@+s:String -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
A comment goes where the parser is (see cm): the open element in body, head in head; one at document or <html> level is dropped.
def on_comment source · line 323 · raw
@+b:B -> @+s:String -> B
def on_token source · line 330 · raw
@t:0x3f7d6a337c19dca90be0905f33ec406a/tokenize.Tok -> @+b:B -> B
def build source · line 341 · raw
@toks:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/tokenize.Tok> -> @+b:B -> B
def close_all source · line 349 · raw
@fuel:Nat -> @+b:B -> B
Close everything down to the body frame.
def body_of source · line 356 · raw
@xs:List<&2, Frame> -> @attrs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Attr> -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
def finish source · line 365 · raw
@b:B -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
def empty source · line 373 · raw
B
def parse source · line 377 · raw
@s:String -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
Parse a document. Always succeeds: html > (head, body).
def first_or source · line 381 · raw
@xs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node> -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
def body source · line 389 · raw
@+doc:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
The body element of a parsed document.
def head source · line 392 · raw
@+doc:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node
def dump_list source · line 397 · raw
@xs:List<&2, 0x3f7d6a337c19dca90be0905f33ec406a/dom.Node> -> String
def dump source · line 408 · raw
@n:0x3f7d6a337c19dca90be0905f33ec406a/dom.Node -> String