Skip to content

Commit

Permalink
Prop resolution fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Dec 5, 2020
1 parent 49c24e7 commit b62055f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 7 additions & 1 deletion src/compose/compose-node.ts
Expand Up @@ -5,7 +5,13 @@ import { composeBlockMap } from './compose-block-map.js'
import { composeBlockSeq } from './compose-block-seq.js'
import { composeScalar } from './compose-scalar.js'
import { resolveEnd } from './resolve-end.js'
import type { Props } from './resolve-props.js'

export interface Props {
spaceBefore: boolean
comment: string
anchor: string
tagName: string
}

export function composeNode(
doc: Document.Parsed,
Expand Down
12 changes: 3 additions & 9 deletions src/compose/resolve-props.ts
@@ -1,14 +1,5 @@
import { SourceToken } from '../parse/parser'

export interface Props {
found: boolean
spaceBefore: boolean
comment: string
anchor: string
tagName: string
length: number
}

export function resolveProps(
start: SourceToken[],
indicator:
Expand Down Expand Up @@ -45,9 +36,12 @@ export function resolveProps(
sep += token.source
break
case 'anchor':
if (anchor)
onError(offset + length, 'A node can have at most one anchor')
anchor = token.source.substring(1)
break
case 'tag':
if (tagName) onError(offset + length, 'A node can have at most one tag')
tagName = token.source // FIXME
break
case indicator:
Expand Down

0 comments on commit b62055f

Please sign in to comment.