Skip to content

Commit

Permalink
Removed unnecessary node type
Browse files Browse the repository at this point in the history
  • Loading branch information
hebertialmeida committed May 29, 2020
1 parent 07bc357 commit 479443a
Show file tree
Hide file tree
Showing 33 changed files with 9 additions and 120 deletions.
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Blockquote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Blockquote: BlockContent, Parent {
public let type: NodeType = .blockquote
public let children: [BlockContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Break.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/// Break represents a soft line break, such as in poems or addresses.
public struct Break: StaticPhrasingContent, PhrasingContent {
public let type: NodeType = .break
public let position: Position

public init(position: Position) {
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Code.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Code: BlockContent, Literal {
public let type: NodeType = .code
public let value: String
public let language: String?
public let meta: String?
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Definition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import struct Foundation.URL

public struct Definition: DefinitionContent, Association, Resource {
public let type: NodeType = .definition
public let identifier: String
public let label: String?
public let url: URL
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Delete.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Delete: StaticPhrasingContent, PhrasingContent, Parent {
public let type: NodeType = .delete
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Emphasis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Emphasis: StaticPhrasingContent, PhrasingContent, Parent {
public let type: NodeType = .emphasis
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Footnote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Footnote: StaticPhrasingContent, PhrasingContent, Parent {
public let type: NodeType = .footnote
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/FootnoteDefinition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct FootnoteDefinition: DefinitionContent, Parent, Association {
public let type: NodeType = .footnoteDefinition
public let identifier: String
public let label: String?
public let children: [BlockContent]
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/FootnoteReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct FootnoteReference: StaticPhrasingContent, PhrasingContent, Association {
public let type: NodeType = .footnoteReference
public let identifier: String
public let label: String?
public let position: Position
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/HTML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct HTML: BlockContent, StaticPhrasingContent, PhrasingContent, Literal {
public let type: NodeType = .html
public let value: String
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Heading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Heading: BlockContent, Parent {
public let type: NodeType = .heading
public let children: [PhrasingContent]
public let depth: Depth
public let position: Position
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import struct Foundation.URL

public struct Image: StaticPhrasingContent, PhrasingContent, Parent, Resource, Alternative {
public let type: NodeType = .image
public let url: URL
public let title: String?
public let alt: String?
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/ImageReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct ImageReference: StaticPhrasingContent, PhrasingContent, Parent, Reference, Alternative {
public let type: NodeType = .imageReference
public let referenceType: ReferenceType
public let alt: String?
public let children: [PhrasingContent]
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/InlineCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct InlineCode: StaticPhrasingContent, PhrasingContent, Literal {
public let type: NodeType = .inlineCode
public let value: String
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import struct Foundation.URL

public struct Link: PhrasingContent, Parent, Resource {
public let type: NodeType = .link
public let url: URL
public let title: String?
public let children: [StaticPhrasingContent]
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/LinkReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct LinkReference: PhrasingContent, Parent, Reference {
public let type: NodeType = .linkReference
public let referenceType: ReferenceType
public let children: [StaticPhrasingContent]
public let position: Position
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct List: BlockContent, Parent {
public let type: NodeType = .list
public let ordered: Bool
public let start: Int?
public let spread: Bool?
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/ListItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct ListItem: ListContent, Parent {
public let type: NodeType = .listItem
public let checked: Bool?
public let spread: Bool?
public let children: [BlockContent]
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Paragraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Paragraph: BlockContent, Parent {
public let type: NodeType = .paragraph
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Root.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
/// Root can be used as the root of a tree, never as a child. Its content model is not limited to top-level content,
/// but can contain any content with the restriction that all content must be of the same category.
public struct Root: Parent {
public let type: NodeType = .root
public let children: [Content]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/SoftBreak.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/// SoftBreak represents a hard line break, such as new paragraph.
public struct SoftBreak: StaticPhrasingContent, PhrasingContent {
public let type: NodeType = .softBreak
public let position: Position

public init(position: Position) {
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Strong.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Strong: StaticPhrasingContent, PhrasingContent, Parent {
public let type: NodeType = .strong
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Table.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Table: BlockContent, Parent {
public let type: NodeType = .table
public let align: [AlignType]?
public let children: [TableContent]
public let position: Position
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/TableCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct TableCell: RowContent, Parent {
public let type: NodeType = .tableCell
public let children: [PhrasingContent]
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/TableRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct TableRow: TableContent, Parent {
public let type: NodeType = .tableRow
public let isHeader: Bool
public let children: [RowContent]
public let position: Position
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct Text: StaticPhrasingContent, PhrasingContent, Literal {
public let type: NodeType = .text
public let value: String
public let position: Position

Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/ThematicBreak.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct ThematicBreak: BlockContent {
public let type: NodeType = .thematicBreak
public let position: Position

public init(position: Position) {
Expand Down
1 change: 0 additions & 1 deletion Sources/MarkdownSyntax/Nodes/YAML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

public struct YAML: FrontmatterContent, Literal {
public var type: NodeType = .yaml
public var value: String
public var position: Position

Expand Down
3 changes: 0 additions & 3 deletions Sources/MarkdownSyntax/Types/BaseTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import struct Foundation.URL

/// Syntactic units in unist syntax trees are called nodes.
public protocol Node {
/// The variant of a node.
var type: NodeType { get }

/// Location of a node in a source document.
/// Must not be present if a node is generated.
var position: Position { get }
Expand Down
38 changes: 0 additions & 38 deletions Sources/MarkdownSyntax/Types/NodeType.swift

This file was deleted.

5 changes: 2 additions & 3 deletions Tests/MarkdownSyntaxTests/ContentBlockPositionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ final class ContentBlockPositionTests: XCTestCase {
let codeRange = input.range(0...45)

// then
XCTAssertEqual(code?.type, .code)
XCTAssertEqual(code?.position.range, codeRange)
XCTAssertEqual(tree.position.range, codeRange)
}
Expand All @@ -129,8 +128,8 @@ final class ContentBlockPositionTests: XCTestCase {
let textRange2 = input.range(25...48)

// then
XCTAssertEqual(blockquote?.type, .blockquote)
XCTAssertEqual(softBreak?.type, .softBreak)
XCTAssertNotNil(blockquote)
XCTAssertNotNil(softBreak)
XCTAssertEqual(text?.position.range, textRange)
XCTAssertEqual(text2?.position.range, textRange2)
}
Expand Down
Loading

0 comments on commit 479443a

Please sign in to comment.