@mdsvex/parse 1.0.0-next.0 → 1.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +213 -0
- package/WIRE_FORMAT.md +5 -1
- package/dist/buf-utils.js +23 -23
- package/dist/buf_utils.d.ts +1 -1
- package/dist/cursor.d.ts +17 -13
- package/dist/cursor.js +118 -31
- package/dist/main.d.ts +362 -26
- package/dist/main.js +5841 -3420
- package/dist/node_view-bvM0i0-p.js +407 -0
- package/dist/node_view.d.ts +11 -12
- package/dist/opcodes.d.ts +23 -6
- package/dist/plugin_dispatch.d.ts +22 -8
- package/dist/tree-builder.js +185 -66
- package/dist/tree_builder.d.ts +42 -11
- package/dist/undo_log.d.ts +11 -1
- package/dist/utils.d.ts +77 -51
- package/dist/utils.js +687 -209
- package/dist/wire-tree-builder.js +69 -71
- package/dist/wire_tree_builder.d.ts +4 -7
- package/package.json +1 -1
- package/src/buf_utils.ts +10 -14
- package/src/cursor.ts +74 -57
- package/src/main.ts +9898 -5593
- package/src/node_view.ts +159 -140
- package/src/opcodes.ts +39 -7
- package/src/plugin_dispatch.ts +328 -219
- package/src/tree_builder.ts +278 -98
- package/src/undo_log.ts +58 -24
- package/src/utils.spec.ts +86 -9
- package/src/utils.ts +769 -392
- package/src/wire_emitter.ts +6 -0
- package/src/wire_tree_builder.ts +39 -52
- package/test/block_quotes.spec.ts +78 -7
- package/test/code_spans.spec.ts +158 -6
- package/test/crlf.spec.ts +49 -1
- package/test/directives.spec.ts +530 -1
- package/test/emphasis.spec.ts +10 -4
- package/test/fixtures/pfm/block_quotes/pfm_fence_close.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_compact.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_end_quote.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_info.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_longer.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_nested.md +3 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_twice.md +6 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_info_eof.md +1 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_unclosed.md +2 -0
- package/test/fixtures/pfm/code_spans/pfm_328_5.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_6.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_7.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_8.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_9.md +2 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof.md +1 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof_no_lf.md +1 -0
- package/test/fixtures/pfm/generic_directives/106.md +1 -0
- package/test/fixtures/pfm/generic_directives/107.md +3 -0
- package/test/fixtures/pfm/generic_directives/108.md +1 -0
- package/test/fixtures/pfm/generic_directives/109.md +1 -0
- package/test/fixtures/pfm/generic_directives/110.md +1 -0
- package/test/fixtures/pfm/generic_directives/111.md +1 -0
- package/test/fixtures/pfm/generic_directives/112.md +1 -0
- package/test/fixtures/pfm/generic_directives/113.md +1 -0
- package/test/fixtures/pfm/generic_directives/114.md +2 -0
- package/test/fixtures/pfm/generic_directives/115.md +1 -0
- package/test/fixtures/pfm/generic_directives/116.md +6 -0
- package/test/fixtures/pfm/generic_directives/117.md +3 -0
- package/test/fixtures/pfm/generic_directives/118.md +6 -0
- package/test/fixtures/pfm/generic_directives/119.md +3 -0
- package/test/fixtures/pfm/generic_directives/120.md +5 -0
- package/test/fixtures/pfm/generic_directives/121.md +3 -0
- package/test/fixtures/pfm/generic_directives/122.md +4 -0
- package/test/fixtures/pfm/generic_directives/123.md +2 -0
- package/test/html.spec.ts +44 -1
- package/test/html_block_containers.spec.ts +445 -0
- package/test/incremental.spec.ts +271 -0
- package/test/lists.spec.ts +107 -1
- package/test/parser_reuse.spec.ts +40 -0
- package/test/plugins.spec.ts +196 -226
- package/test/print.ts +2 -3
- package/test/run_bytecode.spec.ts +36 -0
- package/test/snapshots/hybrid/component-children.snap.ast +9 -16
- package/test/snapshots/hybrid/component-simple-00.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-01.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-03.snap.ast +13 -13
- package/test/snapshots/hybrid/component-simple-04.snap.ast +1 -2
- package/test/snapshots/hybrid/error.snap.ast +1 -2
- package/test/snapshots/markdown/blockquote-nested-markdown.snap.ast +2 -1
- package/test/snapshots/markdown/emphasis.snap.ast +2 -2
- package/test/snapshots/markdown/encodeHTMLCodeTags.snap.ast +1 -2
- package/test/snapshots/markdown/github-style-codeblock-inside-quote.snap.ast +8 -1
- package/test/snapshots/markdown/html-comments.snap.ast +11 -13
- package/test/snapshots/markdown/html5-strutural-tags.snap.ast +16 -31
- package/test/snapshots/markdown/line-starts-with-html.snap.ast +5 -6
- package/test/snapshots/markdown/literal-html-tags.snap.ast +11 -14
- package/test/snapshots/markdown/nested-blockquote.snap.ast +3 -3
- package/test/snapshots/markdown/pre-code-tags.snap.ast +5 -8
- package/test/snapshots/pfm/block_quotes/237.snap.ast +1 -2
- package/test/snapshots/pfm/block_quotes/251.snap.ast +5 -5
- package/test/snapshots/pfm/block_quotes/pfm_fence_close.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_compact.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_end_quote.snap.ast +8 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_info.snap.ast +4 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_longer.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_nested.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_twice.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_info_eof.snap.ast +3 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_unclosed.snap.ast +3 -0
- package/test/snapshots/pfm/code_spans/344.snap.ast +1 -1
- package/test/snapshots/pfm/code_spans/347.snap.ast +1 -2
- package/test/snapshots/pfm/code_spans/pfm_328_5.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_6.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_7.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_8.snap.ast +8 -0
- package/test/snapshots/pfm/code_spans/pfm_328_9.snap.ast +10 -0
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/417.snap.ast +2 -2
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/438.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/441.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/444.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/445.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/450.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/453.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/456.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/457.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/473.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/475.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/476.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/477.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/478.snap.ast +3 -4
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/479.snap.ast +3 -4
- package/test/snapshots/pfm/fenced_code_blocks/126.snap.ast +1 -2
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof.snap.ast +2 -0
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof_no_lf.snap.ast +2 -0
- package/test/snapshots/pfm/generic_directives/011.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/015.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/016.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/017.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/019.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/020.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/030.snap.ast +4 -6
- package/test/snapshots/pfm/generic_directives/034.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/036.snap.ast +5 -1
- package/test/snapshots/pfm/generic_directives/038.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/039.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/040.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/044.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/046.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/089.snap.ast +1 -1
- package/test/snapshots/pfm/generic_directives/103.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/106.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/107.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/108.snap.ast +5 -0
- package/test/snapshots/pfm/generic_directives/109.snap.ast +4 -0
- package/test/snapshots/pfm/generic_directives/110.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/111.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/112.snap.ast +18 -0
- package/test/snapshots/pfm/generic_directives/113.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/114.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/115.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/116.snap.ast +13 -0
- package/test/snapshots/pfm/generic_directives/117.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/118.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/119.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/120.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/121.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/122.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/123.snap.ast +3 -0
- package/test/snapshots/pfm/hard_line_breaks/642.snap.ast +1 -1
- package/test/snapshots/pfm/hard_line_breaks/643.snap.ast +1 -1
- package/test/snapshots/pfm/html/148.snap.ast +1 -1
- package/test/snapshots/pfm/html/150.snap.ast +1 -1
- package/test/snapshots/pfm/html/159.snap.ast +2 -3
- package/test/snapshots/pfm/html/162.snap.ast +3 -4
- package/test/snapshots/pfm/html/163.snap.ast +1 -1
- package/test/snapshots/pfm/html/164.snap.ast +3 -4
- package/test/snapshots/pfm/html/166.snap.ast +1 -1
- package/test/snapshots/pfm/html/168.snap.ast +2 -3
- package/test/snapshots/pfm/html/169.snap.ast +5 -7
- package/test/snapshots/pfm/html/174.snap.ast +3 -3
- package/test/snapshots/pfm/html/182.snap.ast +1 -1
- package/test/snapshots/pfm/html/613.snap.ast +2 -2
- package/test/snapshots/pfm/html/615.snap.ast +2 -2
- package/test/snapshots/pfm/images/585.snap.ast +1 -1
- package/test/snapshots/pfm/images/589.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/201.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/208.snap.ast +1 -1
- package/test/snapshots/pfm/links/491.snap.ast +1 -1
- package/test/snapshots/pfm/links/494.snap.ast +2 -2
- package/test/snapshots/pfm/links/516.snap.ast +8 -9
- package/test/snapshots/pfm/links/521.snap.ast +1 -1
- package/test/snapshots/pfm/links/530.snap.ast +8 -12
- package/test/snapshots/pfm/links/534.snap.ast +1 -1
- package/test/snapshots/pfm/links/552.snap.ast +2 -2
- package/test/snapshots/pfm/links/559.snap.ast +1 -1
- package/test/snapshots/pfm/links/564.snap.ast +1 -1
- package/test/snapshots/pfm/list_items/260.snap.ast +3 -4
- package/test/snapshots/pfm/list_items/293.snap.ast +2 -2
- package/test/snapshots/pfm/tabs/16.snap.ast +2 -3
- package/test/snapshots/pfm/tabs/4.snap.ast +6 -5
- package/test/snapshots/svelte/00-introduction/00-hello-world/App.snap.ast +3 -4
- package/test/snapshots/svelte/00-introduction/02-styling/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/Nested.snap.ast +1 -2
- package/test/snapshots/svelte/00-introduction/04-html-tags/App.snap.ast +1 -2
- package/test/snapshots/svelte/01-reactivity/00-reactive-assignments/App.snap.ast +5 -6
- package/test/snapshots/svelte/01-reactivity/01-reactive-declarations/App.snap.ast +11 -14
- package/test/snapshots/svelte/01-reactivity/02-reactive-statements/App.snap.ast +5 -6
- package/test/snapshots/svelte/02-props/00-declaring-props/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/01-default-values/App.snap.ast +1 -1
- package/test/snapshots/svelte/02-props/01-default-values/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/02-spread-props/Info.snap.ast +16 -17
- package/test/snapshots/svelte/03-logic/00-if-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/01-else-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/02-else-if-blocks/App.snap.ast +6 -9
- package/test/snapshots/svelte/03-logic/03-each-blocks/App.snap.ast +5 -8
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/App.snap.ast +4 -7
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/Thing.snap.ast +4 -5
- package/test/snapshots/svelte/04-events/02-event-modifiers/App.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/03-component-events/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/04-event-forwarding/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/05-dom-event-forwarding/FancyButton.snap.ast +2 -3
- package/test/snapshots/svelte/05-bindings/00-text-inputs/App.snap.ast +3 -4
- package/test/snapshots/svelte/05-bindings/01-numeric-inputs/App.snap.ast +9 -8
- package/test/snapshots/svelte/05-bindings/02-checkbox-inputs/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/03-group-inputs/App.snap.ast +21 -30
- package/test/snapshots/svelte/05-bindings/04-textarea-inputs/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/05-select-bindings/App.snap.ast +5 -9
- package/test/snapshots/svelte/05-bindings/06-multiple-select-bindings/App.snap.ast +18 -26
- package/test/snapshots/svelte/05-bindings/07-each-block-bindings/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/08-media-elements/App.snap.ast +15 -19
- package/test/snapshots/svelte/05-bindings/09-dimensions/App.snap.ast +7 -9
- package/test/snapshots/svelte/05-bindings/11-component-bindings/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/11-component-bindings/Keypad.snap.ast +32 -34
- package/test/snapshots/svelte/06-lifecycle/00-onmount/App.snap.ast +3 -6
- package/test/snapshots/svelte/06-lifecycle/01-ondestroy/App.snap.ast +6 -7
- package/test/snapshots/svelte/06-lifecycle/02-update/App.snap.ast +2 -4
- package/test/snapshots/svelte/07-stores/00-writable-stores/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/00-writable-stores/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/02-readable-stores/App.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/03-derived-stores/App.snap.ast +8 -10
- package/test/snapshots/svelte/07-stores/04-custom-stores/App.snap.ast +7 -11
- package/test/snapshots/svelte/08-motion/00-tweened/App.snap.ast +10 -15
- package/test/snapshots/svelte/08-motion/01-spring/App.snap.ast +10 -10
- package/test/snapshots/svelte/09-transitions/00-transition/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/01-adding-parameters-to-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/02-in-and-out/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/03-custom-css-transitions/App.snap.ast +4 -6
- package/test/snapshots/svelte/09-transitions/04-custom-js-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/05-transition-events/App.snap.ast +5 -8
- package/test/snapshots/svelte/10-animations/00-animate/App.snap.ast +16 -20
- package/test/snapshots/svelte/11-easing/00-easing/App.snap.ast +16 -11
- package/test/snapshots/svelte/11-easing/00-easing/Controls.snap.ast +11 -16
- package/test/snapshots/svelte/11-easing/00-easing/Grid.snap.ast +2 -2
- package/test/snapshots/svelte/12-svg/01-clock/App.snap.ast +2 -1
- package/test/snapshots/svelte/12-svg/02-bar-chart/App.snap.ast +7 -9
- package/test/snapshots/svelte/12-svg/03-area-chart/App.snap.ast +14 -15
- package/test/snapshots/svelte/12-svg/04-scatterplot/App.snap.ast +7 -5
- package/test/snapshots/svelte/12-svg/04-scatterplot/Scatterplot.snap.ast +6 -6
- package/test/snapshots/svelte/12-svg/05-svg-transitions/App.snap.ast +5 -6
- package/test/snapshots/svelte/13-actions/01-adding-parameters-to-actions/App.snap.ast +2 -3
- package/test/snapshots/svelte/14-classes/00-classes/App.snap.ast +3 -6
- package/test/snapshots/svelte/14-classes/01-class-shorthand/App.snap.ast +2 -3
- package/test/snapshots/svelte/15-composition/00-slots/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/Box.snap.ast +1 -2
- package/test/snapshots/svelte/15-composition/02-named-slots/App.snap.ast +7 -11
- package/test/snapshots/svelte/15-composition/02-named-slots/ContactCard.snap.ast +3 -6
- package/test/snapshots/svelte/15-composition/03-slot-props/App.snap.ast +9 -15
- package/test/snapshots/svelte/15-composition/04-modal/App.snap.ast +17 -26
- package/test/snapshots/svelte/15-composition/04-modal/Modal.snap.ast +3 -3
- package/test/snapshots/svelte/16-context/00-context-api/App.snap.ast +10 -5
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/File.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/Folder.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/App.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/BlueThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/GreenThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/RedThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/02-svelte-window/App.snap.ast +3 -6
- package/test/snapshots/svelte/17-special-elements/03-svelte-window-bindings/App.snap.ast +2 -4
- package/test/snapshots/svelte/17-special-elements/05-svelte-head/App.snap.ast +6 -12
- package/test/snapshots/svelte/18-module-context/01-module-exports/App.snap.ast +2 -3
- package/test/snapshots/svelte/18-module-context/01-module-exports/AudioPlayer.snap.ast +4 -7
- package/test/snapshots/svelte/19-debugging/00-debug/App.snap.ast +5 -7
- package/test/snapshots/svelte/19-debugging/00-debug/Test.snap.ast +7 -11
- package/test/snapshots/svelte/20-7guis/01-7guis-counter/App.snap.ast +2 -3
- package/test/snapshots/svelte/20-7guis/02-7guis-temperature/App.snap.ast +2 -2
- package/test/snapshots/svelte/20-7guis/03-7guis-flight-booker/App.snap.ast +4 -7
- package/test/snapshots/svelte/20-7guis/04-7guis-timer/App.snap.ast +13 -17
- package/test/snapshots/svelte/20-7guis/05-7guis-crud/App.snap.ast +11 -13
- package/test/snapshots/svelte/20-7guis/06-7guis-circles/App.snap.ast +10 -11
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Comment.snap.ast +4 -6
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Item.snap.ast +9 -13
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/List.snap.ast +3 -5
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Summary.snap.ast +7 -11
- package/test/snapshots/svelte/21-miscellaneous/02-immutable-data/App.snap.ast +2 -4
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/App.snap.ast +6 -7
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/Hero.snap.ast +3 -5
- package/test/snapshots/svelte/99-embeds/20190420-blog-write-less-code/App.snap.ast +6 -7
- package/test/svelte_expressions.spec.ts +93 -4
- package/test/svelte_tags.spec.ts +27 -12
- package/test/tables.spec.ts +347 -0
- package/test/tree_builder.spec.ts +286 -1
- package/test/unclosed_delimiters.spec.ts +529 -0
- package/tsc/buf_utils.d.ts +1 -1
- package/tsc/buf_utils.js +9 -9
- package/tsc/cursor.d.ts +17 -13
- package/tsc/cursor.js +60 -43
- package/tsc/main.d.ts +362 -26
- package/tsc/main.js +8955 -4891
- package/tsc/node_view.d.ts +11 -12
- package/tsc/node_view.js +134 -102
- package/tsc/opcodes.d.ts +23 -6
- package/tsc/plugin_dispatch.d.ts +22 -8
- package/tsc/plugin_dispatch.js +292 -170
- package/tsc/tree_builder.d.ts +42 -11
- package/tsc/tree_builder.js +237 -82
- package/tsc/undo_log.d.ts +11 -1
- package/tsc/undo_log.js +54 -19
- package/tsc/utils.d.ts +77 -51
- package/tsc/utils.js +687 -344
- package/tsc/utils.spec.js +83 -9
- package/tsc/wire_emitter.js +6 -0
- package/tsc/wire_tree_builder.d.ts +4 -7
- package/tsc/wire_tree_builder.js +34 -37
- package/dist/node_view-BEh2-H86.js +0 -373
package/dist/main.d.ts
CHANGED
|
@@ -8,6 +8,29 @@ export { PluginDispatcher } from './plugin_dispatch';
|
|
|
8
8
|
export { SourceTextSource, WireTextSource } from './node_view';
|
|
9
9
|
export { WireEmitter, WireOp } from './wire_emitter';
|
|
10
10
|
export type { Emitter } from './opcodes';
|
|
11
|
+
/**
|
|
12
|
+
* normalize line endings to `\n`. per commonmark 2.1, a line ending is
|
|
13
|
+
* `\n`, `\r`, or `\r\n`. the state machine only recognizes `\n`, so we
|
|
14
|
+
* collapse the others at the input boundary. fast path: no allocation
|
|
15
|
+
* when the input has no `\r`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalize_newlines(source: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* collapsed offsets from the lines the last normalize_newlines split, undefined unless that
|
|
20
|
+
* call was for raw and saw no lone \r, clears them so raw is not kept alive
|
|
21
|
+
*/
|
|
22
|
+
export declare function take_collapsed(raw: string): number[] | undefined;
|
|
23
|
+
/** maps parser offsets back to the raw source, a collapsed \n maps to its \r */
|
|
24
|
+
export declare class RawOffsets {
|
|
25
|
+
/** normalized offsets of each \n that was \r\n, ascending */
|
|
26
|
+
readonly collapsed: number[];
|
|
27
|
+
constructor(collapsed: number[]);
|
|
28
|
+
/** collapsed line endings before offset */
|
|
29
|
+
rank(offset: number): number;
|
|
30
|
+
to_raw(offset: number): number;
|
|
31
|
+
}
|
|
32
|
+
/** null when raw has no \r\n */
|
|
33
|
+
export declare function raw_offsets(raw: string): RawOffsets | null;
|
|
11
34
|
export declare const enum StateKind {
|
|
12
35
|
root = 0,
|
|
13
36
|
text = 1,
|
|
@@ -38,29 +61,45 @@ export declare const enum StateKind {
|
|
|
38
61
|
html_block_element = 26,
|
|
39
62
|
svelte_branch = 27,
|
|
40
63
|
directive_container = 28,
|
|
41
|
-
frontmatter = 29
|
|
64
|
+
frontmatter = 29,
|
|
65
|
+
raw_text = 30
|
|
42
66
|
}
|
|
43
67
|
/**
|
|
44
68
|
* pfm parser - state machine that emits opcodes via an emitter interface.
|
|
45
69
|
*/
|
|
46
70
|
export declare class PFMParser {
|
|
47
71
|
private source;
|
|
72
|
+
private source_base;
|
|
73
|
+
private source_end;
|
|
74
|
+
private trim_point;
|
|
75
|
+
private fence_scan;
|
|
76
|
+
private interrupt_pos;
|
|
77
|
+
private interrupt_list_depth;
|
|
78
|
+
private interrupt_marker_pos;
|
|
79
|
+
private interrupt_marker;
|
|
80
|
+
private interrupt_svelte_depth;
|
|
81
|
+
private wait_chunks;
|
|
82
|
+
private cold;
|
|
83
|
+
private wait_kind;
|
|
48
84
|
private cursor;
|
|
49
85
|
private finished;
|
|
86
|
+
private one_shot;
|
|
50
87
|
private pending_cr;
|
|
51
88
|
private states;
|
|
52
89
|
private node_stack;
|
|
53
90
|
private next_id;
|
|
54
91
|
private pending_ids;
|
|
92
|
+
private id_info;
|
|
93
|
+
private id_slots;
|
|
94
|
+
private finalized_below;
|
|
55
95
|
private pending_starts;
|
|
56
96
|
private pending_count;
|
|
57
|
-
private
|
|
58
|
-
private
|
|
59
|
-
private
|
|
60
|
-
private current;
|
|
61
|
-
private next_class;
|
|
97
|
+
private pending_para_count;
|
|
98
|
+
private class_floor;
|
|
99
|
+
private range_next_class;
|
|
62
100
|
private block_quote_depth;
|
|
63
101
|
private emphasis_has_content;
|
|
102
|
+
private tag_wait;
|
|
64
103
|
private list_depth;
|
|
65
104
|
private list_marker;
|
|
66
105
|
private list_ordered;
|
|
@@ -76,12 +115,21 @@ export declare class PFMParser {
|
|
|
76
115
|
private table_row_id;
|
|
77
116
|
private table_cell_id;
|
|
78
117
|
private table_cell_col;
|
|
118
|
+
private table_bound_l;
|
|
119
|
+
private table_bound_r;
|
|
120
|
+
private table_cur;
|
|
79
121
|
private in_table;
|
|
80
122
|
private in_heading;
|
|
81
123
|
private inline_range_parse;
|
|
82
124
|
private table_cell_has_content;
|
|
83
125
|
private html_tag_stack;
|
|
84
126
|
private html_block_depth;
|
|
127
|
+
private spec_para;
|
|
128
|
+
private spec_scan;
|
|
129
|
+
private spec_depth;
|
|
130
|
+
private spec_text;
|
|
131
|
+
private spec_block;
|
|
132
|
+
private spec_never;
|
|
85
133
|
private svelte_block_depth;
|
|
86
134
|
private svelte_block_tag;
|
|
87
135
|
private svelte_branch_id;
|
|
@@ -98,7 +146,9 @@ export declare class PFMParser {
|
|
|
98
146
|
private info_start_pos;
|
|
99
147
|
private info_end_pos;
|
|
100
148
|
private checkpoint_cursor;
|
|
149
|
+
private code_span_open_pos;
|
|
101
150
|
private prev_cursor;
|
|
151
|
+
private prev_depth;
|
|
102
152
|
private loop_without_progress;
|
|
103
153
|
private out;
|
|
104
154
|
private errors;
|
|
@@ -116,6 +166,11 @@ export declare class PFMParser {
|
|
|
116
166
|
parse(source: string): {
|
|
117
167
|
errors: ErrorCollector;
|
|
118
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* parse for a source normalize_newlines already returned, so the input is not scanned for \r twice
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
parse_normalized(src: string): ErrorCollector;
|
|
119
174
|
/**
|
|
120
175
|
* initialize the parser for incremental feeding. must be called
|
|
121
176
|
* before the first feed() call.
|
|
@@ -132,6 +187,59 @@ export declare class PFMParser {
|
|
|
132
187
|
* handled correctly.
|
|
133
188
|
*/
|
|
134
189
|
feed(chunk: string): void;
|
|
190
|
+
/**
|
|
191
|
+
* trim the window to the start of the cursor line when _run stopped in a paragraph
|
|
192
|
+
* with only delimiters open, in a table body row, or at a line start right inside
|
|
193
|
+
* a container, with every ancestor a trim container
|
|
194
|
+
* pending html openers are reread on revoke, trim_keeping_html keeps them
|
|
195
|
+
* an unclosed code span sets a wait instead, a batch parse never calls this
|
|
196
|
+
*/
|
|
197
|
+
private trim_at_stall;
|
|
198
|
+
/** inline delimiters, a revoke needs no source text and nothing rescans from their opener */
|
|
199
|
+
private is_trim_delimiter;
|
|
200
|
+
/**
|
|
201
|
+
* trim at the fence scan line for a fence in html or svelte containers, where can_trim declines
|
|
202
|
+
* no fence wait, its window skip would drop kept html lines
|
|
203
|
+
*/
|
|
204
|
+
private trim_fence;
|
|
205
|
+
/**
|
|
206
|
+
* true when the node stack below top holds only trim containers and every pending node
|
|
207
|
+
* is a paragraph, a delimiter, a revoked link or an open html container whose open tag ends before line
|
|
208
|
+
*/
|
|
209
|
+
private can_trim_to;
|
|
210
|
+
/**
|
|
211
|
+
* an unclosed code span cannot end until a chunk may hold a backtick or a blank line
|
|
212
|
+
* so feed holds chunks back instead of rejoining the window
|
|
213
|
+
*/
|
|
214
|
+
private wait_code_span;
|
|
215
|
+
/** bq_fence_scan for unfinished input, resumes at the first line the last stalled scan of this fence did not pass */
|
|
216
|
+
private bq_fence_feed;
|
|
217
|
+
/** false only when the chunk has no backtick and every line starting in it starts with all the quote markers */
|
|
218
|
+
private bq_fence_may_decide;
|
|
219
|
+
/** false only when the chunk has no backtick and no line starting in it starts with a space, tab or linefeed */
|
|
220
|
+
private code_span_may_end;
|
|
221
|
+
/**
|
|
222
|
+
* revoke pending nodes that will never close, keeping tight list paragraphs and nodes on the node stack
|
|
223
|
+
* slots below np_floor hold only paragraphs while the paragraph count agrees, a swap remove can break that
|
|
224
|
+
*/
|
|
225
|
+
private revoke_stale_pending;
|
|
226
|
+
/** the first pending slot that may hold a non paragraph, feed trims scan pending nodes from it */
|
|
227
|
+
private pending_floor;
|
|
228
|
+
/**
|
|
229
|
+
* move a trim point inside a whitespace run back to keep the char before the run,
|
|
230
|
+
* lead_columns rereads the run and that char
|
|
231
|
+
*/
|
|
232
|
+
private trim_before_indent;
|
|
233
|
+
/**
|
|
234
|
+
* feed window trim when non paragraph nodes are pending, keeps the open tag lines of
|
|
235
|
+
* pending html containers before the cut and moves their pending starts onto them
|
|
236
|
+
* so a revoke repair reads the same open tag
|
|
237
|
+
*/
|
|
238
|
+
private trim_keeping_html;
|
|
239
|
+
private join_held;
|
|
240
|
+
private fence_close_may_start;
|
|
241
|
+
/** leaves scan, trim point and window where _run would, false when the chunk might hold the close */
|
|
242
|
+
private skip_wait;
|
|
135
243
|
/**
|
|
136
244
|
* signal end-of-input. finalizes all open nodes and revokes
|
|
137
245
|
* pending speculation.
|
|
@@ -139,15 +247,53 @@ export declare class PFMParser {
|
|
|
139
247
|
finish(): {
|
|
140
248
|
errors: ErrorCollector;
|
|
141
249
|
};
|
|
250
|
+
/** @internal */
|
|
251
|
+
bind(emitter: Emitter, tab_size?: number): void;
|
|
252
|
+
/** drop strings of the last document so a reused parser does not pin them */
|
|
253
|
+
release(): void;
|
|
142
254
|
private _init;
|
|
255
|
+
/** inlined at every open site, so it stays small, pending opens call their own */
|
|
143
256
|
private emit_open;
|
|
257
|
+
private emit_leaf;
|
|
258
|
+
private emit_bare_leaf;
|
|
259
|
+
private emit_bare_ops;
|
|
260
|
+
private emit_leaf_ops;
|
|
261
|
+
private emit_open_pending;
|
|
144
262
|
private emit_close;
|
|
263
|
+
/** open writes an id state before any read, so spare tables need no clearing */
|
|
264
|
+
private take_ids;
|
|
265
|
+
private grow_ids;
|
|
266
|
+
/**
|
|
267
|
+
* drop the tables here so this parser never writes one another parser took,
|
|
268
|
+
* finalized_below stops a repeated finish closing these ids again
|
|
269
|
+
*/
|
|
270
|
+
private give_back_ids;
|
|
271
|
+
private kind_of;
|
|
272
|
+
private is_closed;
|
|
145
273
|
/** swap-remove an id from the pending_ids array. */
|
|
146
274
|
private pending_remove;
|
|
275
|
+
/**
|
|
276
|
+
* outer was opened at the cursor before another asterisk, a word char after it opens the inner
|
|
277
|
+
* strong and its first run as the states would, false leaves the states as they were
|
|
278
|
+
*/
|
|
279
|
+
private open_inner_strong;
|
|
280
|
+
/** close the strong n_id at the cursor, and the enclosing strong too when its closing asterisk follows */
|
|
281
|
+
private close_strong;
|
|
282
|
+
/**
|
|
283
|
+
* the inline backtick case for a one or two backtick span with plain content closing on its line
|
|
284
|
+
* and the plain run after it, false leaves everything to code_span_start
|
|
285
|
+
*/
|
|
286
|
+
private line_code_span;
|
|
287
|
+
/** reparse a #! with no hint as an ordinary code span from the # */
|
|
288
|
+
private code_span_hint_revert;
|
|
289
|
+
private open_text_run;
|
|
147
290
|
/** check if an id is in the pending_ids array. */
|
|
148
291
|
private pending_has;
|
|
149
|
-
/**
|
|
150
|
-
|
|
292
|
+
/**
|
|
293
|
+
* only containers below depth and only closed tight list paragraphs pending,
|
|
294
|
+
* containers read back one char at most, paragraphs and html revokes reread from their start
|
|
295
|
+
*/
|
|
296
|
+
private can_trim;
|
|
151
297
|
/**
|
|
152
298
|
* check if a character code is valid in a directive name.
|
|
153
299
|
* valid: [a-za-z0-9_-]
|
|
@@ -196,12 +342,24 @@ export declare class PFMParser {
|
|
|
196
342
|
* - `false` if we need more input (stall)
|
|
197
343
|
*/
|
|
198
344
|
private try_parse_block_directive;
|
|
345
|
+
/**
|
|
346
|
+
* the end of the backtick run at pos, past its closing run when one of
|
|
347
|
+
* the same length follows on the line, -2 when the line is not all buffered
|
|
348
|
+
*/
|
|
349
|
+
private label_code_span_end;
|
|
199
350
|
/**
|
|
200
351
|
* open a block directive node from a successful
|
|
201
352
|
* try_parse_block_directive result. leaf directives close
|
|
202
353
|
* immediately, containers push their state and colon count.
|
|
354
|
+
* a nonempty label becomes the first child, a directive_label whose
|
|
355
|
+
* inline content parses as a range so nothing in it reaches past the bracket
|
|
203
356
|
*/
|
|
204
357
|
private start_block_directive;
|
|
358
|
+
/** the label spans its brackets, its value and children the text between */
|
|
359
|
+
private directive_label;
|
|
360
|
+
/** start of the line after a fence lf inside a block quote, or the lf itself when that line is unmarked */
|
|
361
|
+
private bq_line_start;
|
|
362
|
+
private is_directive_close_line;
|
|
205
363
|
/**
|
|
206
364
|
* check if position starts a block directive closing fence.
|
|
207
365
|
* returns the end position (after newline) or -1 if not a closing fence.
|
|
@@ -209,14 +367,20 @@ export declare class PFMParser {
|
|
|
209
367
|
*/
|
|
210
368
|
private try_parse_directive_close;
|
|
211
369
|
private chomp;
|
|
212
|
-
/**
|
|
213
|
-
private
|
|
370
|
+
/** reads outside the window, including a jump to cursor 0, give the nan wildcard mask */
|
|
371
|
+
private prev_class;
|
|
372
|
+
private next_class;
|
|
214
373
|
/**
|
|
215
374
|
* count leading whitespace columns starting at `pos`.
|
|
216
375
|
* spaces count as 1 column, tabs count as `tab_size` columns.
|
|
217
376
|
* returns total columns and the position after the whitespace.
|
|
218
377
|
*/
|
|
219
378
|
private count_indent;
|
|
379
|
+
/**
|
|
380
|
+
* columns of whitespace before pos when it indents its line, counted from the line
|
|
381
|
+
* start or from where skip_bq_markers leaves a block quote line, 0 otherwise
|
|
382
|
+
*/
|
|
383
|
+
private lead_columns;
|
|
220
384
|
/**
|
|
221
385
|
* skip enough whitespace characters starting at `pos` to consume
|
|
222
386
|
* at least `target` columns. returns the position after skipping.
|
|
@@ -234,6 +398,8 @@ export declare class PFMParser {
|
|
|
234
398
|
private can_decide_after_lf;
|
|
235
399
|
private is_heading_start;
|
|
236
400
|
private is_blank_line_after;
|
|
401
|
+
/** in feed mode, true while the line from `pos` holds only its marker and whitespace so far */
|
|
402
|
+
private could_be_thematic_break;
|
|
237
403
|
private is_thematic_break_start;
|
|
238
404
|
private is_ascii_punctuation;
|
|
239
405
|
private skip_bq_markers;
|
|
@@ -268,9 +434,24 @@ export declare class PFMParser {
|
|
|
268
434
|
* a list with an empty item.
|
|
269
435
|
*/
|
|
270
436
|
private marker_line_has_content;
|
|
437
|
+
/**
|
|
438
|
+
* feed mode, the marker at pos is undecided while its prefix or the blank rest of its line arrives
|
|
439
|
+
* a marker line with no content is a paragraph, taking the list early would differ from batch
|
|
440
|
+
*/
|
|
441
|
+
private plus_marker_pending;
|
|
271
442
|
private try_parse_list_marker;
|
|
272
443
|
private is_list_item_start_interrupt;
|
|
273
444
|
private start_list;
|
|
445
|
+
/**
|
|
446
|
+
* a letter or non ascii char can only open a paragraph, so open it and take its plain run here
|
|
447
|
+
* instead of a list_item trip, a feed sets the trim point as that trip would
|
|
448
|
+
*/
|
|
449
|
+
private item_para;
|
|
450
|
+
/**
|
|
451
|
+
* finished parse, item content of one or two asterisks then a word char is no break or marker,
|
|
452
|
+
* open the paragraph, the strongs and the first run as their states would
|
|
453
|
+
*/
|
|
454
|
+
private item_strong;
|
|
274
455
|
/**
|
|
275
456
|
* eegister a pending paragraph that was opened inside a list_item -
|
|
276
457
|
* the wrapper is speculative until the list closes (tight -> unwrap,
|
|
@@ -290,6 +471,8 @@ export declare class PFMParser {
|
|
|
290
471
|
*/
|
|
291
472
|
private finalize_list_pending_paras;
|
|
292
473
|
private end_list;
|
|
474
|
+
private close_list_nodes;
|
|
475
|
+
private leave_svelte_block;
|
|
293
476
|
/**
|
|
294
477
|
* open a svelte_block + first svelte_branch from a {#tag expr} token.
|
|
295
478
|
*/
|
|
@@ -327,16 +510,24 @@ export declare class PFMParser {
|
|
|
327
510
|
* tree that downstream renderers (e.g. svelte) reject.
|
|
328
511
|
*/
|
|
329
512
|
private is_block_html_tag;
|
|
330
|
-
/**
|
|
331
|
-
|
|
332
|
-
* returns the end position (after `>`) or -1 if not found / input incomplete.
|
|
333
|
-
*/
|
|
334
|
-
private find_raw_close_tag;
|
|
513
|
+
/** opens once the open tag is whole so later feeds scan only new chars for the close tag */
|
|
514
|
+
private open_raw_text;
|
|
335
515
|
/**
|
|
336
516
|
* try to parse an html opening tag starting at pos (the char after `<`).
|
|
337
517
|
* returns null if not a valid tag.
|
|
338
518
|
*/
|
|
339
519
|
private try_parse_html_open_tag;
|
|
520
|
+
/**
|
|
521
|
+
* on finished input a scan is a pure function of where each attribute token starts
|
|
522
|
+
* so a later scan reaching a token start a failed one passed through fails too
|
|
523
|
+
* without the memo every stray tag opener in prose rescans to the next close bracket
|
|
524
|
+
*/
|
|
525
|
+
private open_tag_failed;
|
|
526
|
+
/**
|
|
527
|
+
* scan an open tag at pos without allocating, the end or -1 when it does not parse, -2 on a memo hit
|
|
528
|
+
* fills tag_rec, and tag_marks when given a memo
|
|
529
|
+
*/
|
|
530
|
+
private scan_open_tag;
|
|
340
531
|
/**
|
|
341
532
|
* try to parse an html closing tag starting at pos (the char after `<`).
|
|
342
533
|
* pos should point to the `/` in `</tag>`.
|
|
@@ -349,15 +540,60 @@ export declare class PFMParser {
|
|
|
349
540
|
* returns the content start, content end, and end position.
|
|
350
541
|
*/
|
|
351
542
|
private try_parse_html_comment;
|
|
543
|
+
/**
|
|
544
|
+
* whether a close tag named tag closes an html container around the open
|
|
545
|
+
* paragraph, or around the cursor when none is open
|
|
546
|
+
*/
|
|
547
|
+
private closes_container;
|
|
548
|
+
/** open a paragraph at the cursor whose wrapper is decided at its close */
|
|
549
|
+
private open_spec_para;
|
|
550
|
+
/**
|
|
551
|
+
* open a spec paragraph at a tag the caller parsed, whose element closes at
|
|
552
|
+
* close_end on its line, and the tag in it as the inline state would
|
|
553
|
+
*/
|
|
554
|
+
private open_spec_tag;
|
|
555
|
+
/**
|
|
556
|
+
* only whitespace follows pos on its line and the next line is blank, starts a
|
|
557
|
+
* block or is missing, false when that line is not whole yet
|
|
558
|
+
*/
|
|
559
|
+
private line_ends_block;
|
|
560
|
+
/** the paragraph keeps its wrapper only with text outside tags and no block level tag */
|
|
561
|
+
private end_spec_para;
|
|
562
|
+
/**
|
|
563
|
+
* scan the spec paragraph up to limit for text outside tags and block level tags,
|
|
564
|
+
* stopping before a construct that is not whole below limit
|
|
565
|
+
*/
|
|
566
|
+
private spec_scan_to;
|
|
567
|
+
/**
|
|
568
|
+
* the end of a comment or tag at p for spec_scan_to, tracking spec_depth and
|
|
569
|
+
* spec_block, -1 when not whole below limit, -2 when not markup
|
|
570
|
+
*/
|
|
571
|
+
private spec_tag;
|
|
572
|
+
/**
|
|
573
|
+
* the end of the close tag when the element whose open tag ends at from closes on
|
|
574
|
+
* that line, 0 when it stays open past it, -1 when the line is not whole yet
|
|
575
|
+
*/
|
|
576
|
+
private closes_on_line;
|
|
577
|
+
/** whether node is an html element whose content is phrasing only */
|
|
578
|
+
private in_phrasing;
|
|
579
|
+
/** a {@tag at the cursor, structure like an element */
|
|
580
|
+
private at_svelte_tag;
|
|
581
|
+
/** elements whose content is phrasing only, a paragraph inside one keeps no wrapper */
|
|
582
|
+
private is_phrasing_tag;
|
|
352
583
|
/**
|
|
353
584
|
* find the matching html opener on the html_tag_stack for a closing tag.
|
|
354
585
|
* returns the stack index or -1 if not found.
|
|
355
586
|
*/
|
|
356
587
|
private find_html_opener;
|
|
588
|
+
/** open tag source for a revoke, the parsed children stay after it */
|
|
589
|
+
private html_open_tag_text;
|
|
590
|
+
/** end of the text html_open_tag_text takes, a tag may span lines */
|
|
591
|
+
private html_open_tag_end;
|
|
357
592
|
/**
|
|
358
593
|
* close an inline html element by unwinding state/node stacks.
|
|
359
594
|
*/
|
|
360
595
|
private close_html_inline;
|
|
596
|
+
private close_node_inside_html;
|
|
361
597
|
/**
|
|
362
598
|
* try to parse a svelte block token at `pos` (pointing at `{`).
|
|
363
599
|
* returns null if not a svelte block token.
|
|
@@ -375,7 +611,29 @@ export declare class PFMParser {
|
|
|
375
611
|
* tracks nested braces and skips over string literals and template literals.
|
|
376
612
|
* returns the position just past the closing `}`, or -1 if not found.
|
|
377
613
|
*/
|
|
378
|
-
|
|
614
|
+
find_matching_brace(pos: number): number;
|
|
615
|
+
/**
|
|
616
|
+
* on finished input a scan that ran out never closes, later scans go through
|
|
617
|
+
* find_matching_brace_memo so k unclosed braces cost two scans to the end, not k
|
|
618
|
+
*/
|
|
619
|
+
private brace_failed;
|
|
620
|
+
/** a scan from just past a brace this one opened and left open fails too, so those are remembered */
|
|
621
|
+
private find_matching_brace_memo;
|
|
622
|
+
private brace_memo_failed;
|
|
623
|
+
/**
|
|
624
|
+
* find_matching_brace for feed stall checks with the same result, from the second failed
|
|
625
|
+
* scan of a brace on the scan keeps its state and resumes, so a brace open across feeds is scanned once
|
|
626
|
+
*/
|
|
627
|
+
private probe_matching_brace;
|
|
628
|
+
/**
|
|
629
|
+
* nothing _run reads changes until needle appears, so feed holds chunks back until one
|
|
630
|
+
* might hold it instead of rescanning the window every feed
|
|
631
|
+
*/
|
|
632
|
+
private wait_for;
|
|
633
|
+
/** false only when the needle is not in the chunk and not across its start */
|
|
634
|
+
private needle_in;
|
|
635
|
+
/** resume the saved brace scan up to length, true with bp_end set once the brace closes */
|
|
636
|
+
private brace_scan;
|
|
379
637
|
/**
|
|
380
638
|
* try to parse a link reference definition at block level.
|
|
381
639
|
* syntax: [label]: destination "title"
|
|
@@ -401,34 +659,98 @@ export declare class PFMParser {
|
|
|
401
659
|
*/
|
|
402
660
|
private start_heading;
|
|
403
661
|
private _unwind_unterminated_delimiter;
|
|
662
|
+
private lf_ends_inline;
|
|
404
663
|
private _delimiter_lf_close;
|
|
664
|
+
/**
|
|
665
|
+
* outside block quotes, pop inline at a linefeed lf_ends_inline ends and close a paragraph
|
|
666
|
+
* under it here, its own interrupt check would reach the same answer
|
|
667
|
+
*/
|
|
668
|
+
private inline_lf_end;
|
|
405
669
|
private _run;
|
|
670
|
+
/**
|
|
671
|
+
* a finished parse outside block quotes takes a whole fence in one call when fence_whole can
|
|
672
|
+
* else the code fence states run
|
|
673
|
+
*/
|
|
674
|
+
private start_fence;
|
|
675
|
+
/** finished parse, one or two backticks starting a block open a paragraph and take the inline code span step */
|
|
676
|
+
private span_para;
|
|
677
|
+
/** incremental fence opener once the info line and the char after it are visible, emits what the start and info states would */
|
|
678
|
+
private fence_open;
|
|
679
|
+
private fence_whole;
|
|
680
|
+
private _run_code_fence_start;
|
|
681
|
+
private _run_code_fence_info;
|
|
682
|
+
/** finished parse with the info line at eof, the fence is empty */
|
|
683
|
+
private fence_info_eof;
|
|
684
|
+
private _run_code_fence_content;
|
|
685
|
+
private _run_raw_text;
|
|
686
|
+
private _run_code_fence_text_end;
|
|
687
|
+
private _run_emphasis;
|
|
688
|
+
private _run_strikethrough;
|
|
689
|
+
private _run_superscript;
|
|
690
|
+
private _run_subscript;
|
|
691
|
+
private _run_link_text;
|
|
692
|
+
/**
|
|
693
|
+
* true when the paragraph ends at this linefeed, in a block quote a continuation line
|
|
694
|
+
* is taken instead, a heading ends at every linefeed
|
|
695
|
+
*/
|
|
696
|
+
private link_text_lf_ends;
|
|
697
|
+
private is_fence_start;
|
|
698
|
+
/** a list marker on a marked continuation line inside a list in a quote */
|
|
699
|
+
private bq_list_marker;
|
|
700
|
+
private _run_html_element;
|
|
701
|
+
private _run_html_block_element;
|
|
702
|
+
private _run_svelte_branch;
|
|
703
|
+
private _run_block_quote;
|
|
704
|
+
private _run_list_item;
|
|
705
|
+
private _run_directive_container;
|
|
706
|
+
private _run_frontmatter;
|
|
406
707
|
/**
|
|
407
708
|
* try to start a table at the current cursor position.
|
|
408
709
|
* requires seeing the full header row + full delimiter row.
|
|
409
710
|
* @returns true = table started, false = hold back, null = not a table
|
|
410
711
|
*/
|
|
411
712
|
private try_start_table;
|
|
713
|
+
private grow_table_bounds;
|
|
412
714
|
/**
|
|
413
|
-
*
|
|
414
|
-
*
|
|
715
|
+
* sampled every 64 trips, popping below the lowest depth sampled at this cursor is progress
|
|
716
|
+
* since unwinding pending delimiters takes a trip each, depth only falls so far so a real loop still stops
|
|
415
717
|
*/
|
|
416
|
-
private
|
|
718
|
+
private stalled;
|
|
417
719
|
/**
|
|
418
|
-
*
|
|
720
|
+
* a paragraph just opened at a plain char, take the plain run its states would in three trips
|
|
721
|
+
* outside block quotes take the linefeed call too and carry on across soft breaks
|
|
419
722
|
*/
|
|
420
|
-
private
|
|
723
|
+
private para_text;
|
|
421
724
|
/**
|
|
422
|
-
*
|
|
725
|
+
* a data cell just opened, take the table_row_content trips for plain cells in one
|
|
726
|
+
* and leave anything else for that state at the cursor
|
|
423
727
|
*/
|
|
424
|
-
private
|
|
728
|
+
private table_cells;
|
|
729
|
+
/** a row past its last column, moves the cursor to its linefeed or the end of what is fed */
|
|
730
|
+
private skip_extra_cells;
|
|
731
|
+
private wait_table_cell;
|
|
732
|
+
/** reread a cell start a chunk end cut off */
|
|
733
|
+
private table_cell_resume;
|
|
425
734
|
/**
|
|
426
|
-
*
|
|
735
|
+
* the pipe at the cursor ends the open cell and opens the next
|
|
736
|
+
* @returns false to wait for the char after a pipe that may start a ||
|
|
427
737
|
*/
|
|
428
|
-
private
|
|
738
|
+
private table_pipe;
|
|
739
|
+
/** a cell opening with a backtick at start, true when its content ended at a pipe or linefeed, false leaves inline pushed */
|
|
740
|
+
private table_cell_code;
|
|
741
|
+
/**
|
|
742
|
+
* a plain run from the cursor ending at a pipe or linefeed is one text node closed here
|
|
743
|
+
* otherwise inline and text are left pushed past the run as inline would
|
|
744
|
+
*/
|
|
745
|
+
private table_cell_text;
|
|
746
|
+
private blank_run_end;
|
|
747
|
+
/**
|
|
748
|
+
* parse a delimiter row. returns alignment array or null if invalid.
|
|
749
|
+
*/
|
|
750
|
+
private parse_delimiter_row;
|
|
429
751
|
/**
|
|
430
752
|
* parse inline content for a specific byte range. used for header cells
|
|
431
|
-
* where the full content is available atomically.
|
|
753
|
+
* and block directive labels where the full content is available atomically.
|
|
432
754
|
* saves/restores parser state, uses a sentinel state to prevent leaking
|
|
433
755
|
* into block-level parsing.
|
|
434
756
|
*/
|
|
@@ -447,10 +769,24 @@ export declare class PFMParser {
|
|
|
447
769
|
* pad remaining columns with empty cells and close the current row.
|
|
448
770
|
*/
|
|
449
771
|
private pad_and_close_row;
|
|
772
|
+
/**
|
|
773
|
+
* the open cell starts with a > or ^ at the cursor and merges when that is all it holds
|
|
774
|
+
* a > joins the cell to its left, a ^ the cell above, only while the cells stay rectangles
|
|
775
|
+
* @returns 0 when it is content, 1 when merged with the cursor at the pipe or linefeed ending it, 2 to wait for more of the row
|
|
776
|
+
*/
|
|
777
|
+
private table_merge;
|
|
778
|
+
/** the table carries spans once a cell merged */
|
|
779
|
+
private table_spans;
|
|
780
|
+
/**
|
|
781
|
+
* the n cells after the one ending at p are each a lone ^
|
|
782
|
+
* @returns 1 when they are, 0 when not, 2 to wait for more of the row
|
|
783
|
+
*/
|
|
784
|
+
private table_merge_rest;
|
|
450
785
|
/**
|
|
451
786
|
* close the current table and pop state.
|
|
452
787
|
*/
|
|
453
788
|
private end_table;
|
|
789
|
+
private close_table_node;
|
|
454
790
|
private _finalize;
|
|
455
791
|
}
|
|
456
792
|
/**
|