{
  "definitions": [
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "core/factories/grammar.factory.ts",
          "name": "assemble",
          "source": {
            "href": "https://banes-lab.com/anatomy/context#file-context-core-factories-grammar-factory-ts",
            "json": "https://banes-lab.com/json/source/context/core/factories/grammar.factory.ts",
            "label": "core/factories/grammar.factory.ts",
            "markdown": "https://banes-lab.com/source/context/core/factories/grammar.factory.ts.md",
            "ref": "anatomy:file-context-core-factories-grammar-factory-ts"
          }
        }
      ],
      "exported": true,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 203,
      "name": "parse",
      "signature": "export const parse = function parse(text: string): PagDocument {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/parsers/invariant.parser.ts",
          "name": "parseInvariant",
          "source": {
            "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-invariant-parser-ts",
            "json": "https://banes-lab.com/json/source/context/core/parsers/invariant.parser.ts",
            "label": "core/parsers/invariant.parser.ts",
            "markdown": "https://banes-lab.com/source/context/core/parsers/invariant.parser.ts.md",
            "ref": "anatomy:file-context-core-parsers-invariant-parser-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "method_definition",
      "line": 66,
      "name": "flushInvariant",
      "signature": "private flushInvariant(): void {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/parsers/metadata.parser.ts",
          "name": "parseDeclaration",
          "source": {
            "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-metadata-parser-ts",
            "json": "https://banes-lab.com/json/source/context/core/parsers/metadata.parser.ts",
            "label": "core/parsers/metadata.parser.ts",
            "markdown": "https://banes-lab.com/source/context/core/parsers/metadata.parser.ts.md",
            "ref": "anatomy:file-context-core-parsers-metadata-parser-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "method_definition",
      "line": 87,
      "name": "handleDeclaration",
      "signature": "private handleDeclaration(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/parsers/check.parser.ts",
          "name": "gateMarkerOf",
          "source": {
            "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-check-parser-ts",
            "json": "https://banes-lab.com/json/source/context/core/parsers/check.parser.ts",
            "label": "core/parsers/check.parser.ts",
            "markdown": "https://banes-lab.com/source/context/core/parsers/check.parser.ts.md",
            "ref": "anatomy:file-context-core-parsers-check-parser-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "method_definition",
      "line": 95,
      "name": "handleHeader",
      "signature": "private handleHeader(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/parsers/node.parser.ts",
          "name": "nodeOf",
          "source": {
            "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-node-parser-ts",
            "json": "https://banes-lab.com/json/source/context/core/parsers/node.parser.ts",
            "label": "core/parsers/node.parser.ts",
            "markdown": "https://banes-lab.com/source/context/core/parsers/node.parser.ts.md",
            "ref": "anatomy:file-context-core-parsers-node-parser-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "method_definition",
      "line": 108,
      "name": "openHeader",
      "signature": "private openHeader(header: ParsedHeader, trimmed: string, lineNo: number): void {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 17,
      "name": "WORD_SEPARATOR",
      "signature": "const WORD_SEPARATOR = \" \";"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "type_alias_declaration",
      "line": 19,
      "name": "Mode",
      "signature": "type Mode = \"bare\" | \"body\" | \"gate\" | \"invariants\" | \"repair\" | \"report\";"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "class_declaration",
      "line": 21,
      "name": "ParseState",
      "signature": "class ParseState {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 22,
      "name": "doc",
      "signature": "public doc: PagDocument;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 23,
      "name": "node",
      "signature": "private node: PagNode | null = null;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 24,
      "name": "gate",
      "signature": "private gate: PagGate | null = null;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 25,
      "name": "invariant",
      "signature": "private invariant: { text: string; line: number } | null = null;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 26,
      "name": "mode",
      "signature": "private mode: Mode = \"body\";"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 27,
      "name": "inMeta",
      "signature": "private inMeta = false;"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 29,
      "name": "constructor",
      "signature": "public constructor(frontmatter: string | null) {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 33,
      "name": "finish",
      "signature": "public finish(): void {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 38,
      "name": "consume",
      "signature": "public consume(trimmed: string, lineNo: number): void {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 44,
      "name": "handlers",
      "signature": "const handlers = ["
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 57,
      "name": "flushNode",
      "signature": "private flushNode(): void {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 73,
      "name": "handleMeta",
      "signature": "private handleMeta(trimmed: string): boolean {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 99,
      "name": "header",
      "signature": "const header = parseHeader(trimmed.slice(HEADER_PREFIX.length));"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 120,
      "name": "handleBareHead",
      "signature": "private handleBareHead(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 130,
      "name": "handleReportHead",
      "signature": "private handleReportHead(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 140,
      "name": "handleMode",
      "signature": "private handleMode(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 155,
      "name": "consumeInvariantLine",
      "signature": "private consumeInvariantLine(trimmed: string, lineNo: number): void {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 166,
      "name": "handleGateLine",
      "signature": "private handleGateLine(trimmed: string, lineNo: number): boolean {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 167,
      "name": "marker",
      "signature": "const marker = gateMarkerOf(trimmed);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 179,
      "name": "step",
      "signature": "const step = stepGate(this.gate, trimmed, lineNo);"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 188,
      "name": "handleNodeLine",
      "signature": "private handleNodeLine(trimmed: string): boolean {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 189,
      "name": "{ node }",
      "signature": "const { node } = this;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 193,
      "name": "field",
      "signature": "const field = nodeFieldOf(trimmed);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 204,
      "name": "lines",
      "signature": "const lines = splitLines(text);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 205,
      "name": "front",
      "signature": "const front = readFrontmatter(lines);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 206,
      "name": "state",
      "signature": "const state = new ParseState(front.frontmatter);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 207,
      "name": "index",
      "signature": "for (let index = front.end; index < lines.length; index += 1) {"
    }
  ],
  "document": null,
  "findings": [],
  "generated": false,
  "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-document-parser-ts",
  "language": "typescript",
  "layer": "processing",
  "name": "document.parser.ts",
  "path": "core/parsers/document.parser.ts",
  "ref": "anatomy:file-context-core-parsers-document-parser-ts",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/context#folder-context-core-parsers",
          "json": "https://banes-lab.com/json/anatomy/context/folder-context-core-parsers",
          "label": "core/parsers",
          "markdown": "https://banes-lab.com/anatomy/context/folder-context-core-parsers.md",
          "ref": "chapter:/anatomy/context#folder-context-core-parsers"
        }
      ],
      "relation": "contained-in"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-check-parser-ts",
          "json": "https://banes-lab.com/json/source/context/core/parsers/check.parser.ts",
          "label": "core/parsers/check.parser.ts",
          "markdown": "https://banes-lab.com/source/context/core/parsers/check.parser.ts.md",
          "ref": "anatomy:file-context-core-parsers-check-parser-ts"
        },
        {
          "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-invariant-parser-ts",
          "json": "https://banes-lab.com/json/source/context/core/parsers/invariant.parser.ts",
          "label": "core/parsers/invariant.parser.ts",
          "markdown": "https://banes-lab.com/source/context/core/parsers/invariant.parser.ts.md",
          "ref": "anatomy:file-context-core-parsers-invariant-parser-ts"
        },
        {
          "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-metadata-parser-ts",
          "json": "https://banes-lab.com/json/source/context/core/parsers/metadata.parser.ts",
          "label": "core/parsers/metadata.parser.ts",
          "markdown": "https://banes-lab.com/source/context/core/parsers/metadata.parser.ts.md",
          "ref": "anatomy:file-context-core-parsers-metadata-parser-ts"
        },
        {
          "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-node-parser-ts",
          "json": "https://banes-lab.com/json/source/context/core/parsers/node.parser.ts",
          "label": "core/parsers/node.parser.ts",
          "markdown": "https://banes-lab.com/source/context/core/parsers/node.parser.ts.md",
          "ref": "anatomy:file-context-core-parsers-node-parser-ts"
        }
      ],
      "relation": "uses"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/context#file-context-core-factories-grammar-factory-ts",
          "json": "https://banes-lab.com/json/source/context/core/factories/grammar.factory.ts",
          "label": "core/factories/grammar.factory.ts",
          "markdown": "https://banes-lab.com/source/context/core/factories/grammar.factory.ts.md",
          "ref": "anatomy:file-context-core-factories-grammar-factory-ts"
        }
      ],
      "relation": "used-by"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/context#folder-context-core-factories",
          "json": "https://banes-lab.com/json/anatomy/context/folder-context-core-factories",
          "label": "core/factories",
          "markdown": "https://banes-lab.com/anatomy/context/folder-context-core-factories.md",
          "ref": "chapter:/anatomy/context#folder-context-core-factories"
        },
        {
          "href": "https://banes-lab.com/anatomy/context#folder-context-core-parsers",
          "json": "https://banes-lab.com/json/anatomy/context/folder-context-core-parsers",
          "label": "core/parsers",
          "markdown": "https://banes-lab.com/anatomy/context/folder-context-core-parsers.md",
          "ref": "chapter:/anatomy/context#folder-context-core-parsers"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "slots": {
    "concern": "parser",
    "subject": "document",
    "variant": null
  },
  "stats": {
    "bytes": 7297,
    "callable": 16,
    "definitions": 35,
    "edges": 4,
    "exported": 5,
    "files": 1,
    "findings": {},
    "flows": {
      "leaf": 1,
      "entry": 4,
      "isolated": 30
    },
    "lines": {
      "blank": 19,
      "code": 193,
      "total": 212
    }
  },
  "summary": "193 lines of code and 35 definitions.",
  "text": "https://banes-lab.com/source/context/core/parsers/document.parser.ts.txt",
  "tree": "context",
  "siblings": {
    "next": {
      "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-invariant-parser-ts",
      "json": "https://banes-lab.com/json/source/context/core/parsers/invariant.parser.ts",
      "label": "core/parsers/invariant.parser.ts",
      "markdown": "https://banes-lab.com/source/context/core/parsers/invariant.parser.ts.md",
      "ref": "anatomy:file-context-core-parsers-invariant-parser-ts"
    },
    "previous": {
      "href": "https://banes-lab.com/anatomy/context#file-context-core-parsers-check-parser-ts",
      "json": "https://banes-lab.com/json/source/context/core/parsers/check.parser.ts",
      "label": "core/parsers/check.parser.ts",
      "markdown": "https://banes-lab.com/source/context/core/parsers/check.parser.ts.md",
      "ref": "anatomy:file-context-core-parsers-check-parser-ts"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/source/context/core/parsers",
    "label": "core/parsers",
    "markdown": "https://banes-lab.com/api/source/context/core/parsers.md",
    "ref": "api:source/context/core/parsers"
  }
}
