()
| 412 | } |
| 413 | |
| 414 | private parseElement(): ElementNode { |
| 415 | const nameToken = this.consume( |
| 416 | TokenType.IDENTIFIER, |
| 417 | "Expected element name" |
| 418 | ); |
| 419 | const keyword = this.lookupKeyword(nameToken.value, nameToken.position); |
| 420 | |
| 421 | const blockToken = this.consume( |
| 422 | TokenType.BLOCK, |
| 423 | `Expected block to describe <${keyword!.name}>` |
| 424 | ); |
| 425 | const { attributes, children, cssStates, jsEvents, dataId } = |
| 426 | this.parseElementBlock(keyword, blockToken); |
| 427 | this.verifyAttributes(keyword, attributes, nameToken.position); |
| 428 | |
| 429 | return { |
| 430 | type: "Element", |
| 431 | name: keyword.name, |
| 432 | attributes, |
| 433 | children, |
| 434 | cssStates, |
| 435 | jsEvents, |
| 436 | dataId, |
| 437 | position: nameToken.position, |
| 438 | }; |
| 439 | } |
| 440 | |
| 441 | private parseElementBlock( |
| 442 | keyword: Keyword, |
no test coverage detected