Skip to content

Commit

Permalink
Merge 294f3e3 into 7a39b7e
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Aug 1, 2020
2 parents 7a39b7e + 294f3e3 commit 9aeb798
Show file tree
Hide file tree
Showing 238 changed files with 7,433 additions and 7,286 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "yaml-eslint-parser",
"version": "0.0.4",
"version": "0.0.5",
"description": "A YAML parser that produces output compatible with ESLint",
"main": "lib/index.js",
"files": [
Expand Down
39 changes: 24 additions & 15 deletions src/ast.ts
Expand Up @@ -47,6 +47,7 @@ export type YAMLNode =
| YAMLDirective
| YAMLContent
| YAMLPair
| YAMLWithMark
| YAMLAnchor
| YAMLTag
export interface YAMLProgram extends BaseYAMLNode {
Expand All @@ -61,7 +62,7 @@ export interface YAMLProgram extends BaseYAMLNode {
export interface YAMLDocument extends BaseYAMLNode {
type: "YAMLDocument"
directives: YAMLDirective[]
content: YAMLContent | null
content: YAMLContent | YAMLWithMark | null
parent: YAMLProgram
anchors: { [key: string]: YAMLAnchor }
}
Expand All @@ -72,32 +73,38 @@ export interface YAMLDirective extends BaseYAMLNode {
parent: YAMLDocument
}

export interface YAMLWithMark extends BaseYAMLNode {
type: "YAMLWithMark"
anchor: YAMLAnchor | null
tag: YAMLTag | null
value: YAMLContent
parent: YAMLDocument | YAMLPair | YAMLSequence
}

export interface YAMLAnchor extends BaseYAMLNode {
type: "YAMLAnchor"
name: string
parent: YAMLContent
parent: YAMLWithMark
}

export interface YAMLTag extends BaseYAMLNode {
type: "YAMLTag"
tag: string
parent: YAMLContent
parent: YAMLWithMark
}

interface BaseYAMLContentNode extends BaseYAMLNode {
anchor: null | YAMLAnchor
tag: null | YAMLTag
parent: YAMLDocument | YAMLPair | YAMLSequence
parent: YAMLDocument | YAMLPair | YAMLSequence | YAMLWithMark
}

export type YAMLContent = YAMLMapping | YAMLSequence | YAMLScalar | YAMLAlias
export type YAMLMapping = YAMLBlockMapping | YAMLFlowMapping

export interface YAMLBlockMapping extends BaseYAMLContentNode {
type: "YAMLMapping"
style: "block"
pairs: YAMLPair[]
}

export interface YAMLFlowMapping extends BaseYAMLContentNode {
type: "YAMLMapping"
style: "flow"
Expand All @@ -106,21 +113,21 @@ export interface YAMLFlowMapping extends BaseYAMLContentNode {

export interface YAMLPair extends BaseYAMLNode {
type: "YAMLPair"
key: YAMLContent | null
value: YAMLContent | null
key: YAMLContent | YAMLWithMark | null
value: YAMLContent | YAMLWithMark | null
parent: YAMLMapping
}

export type YAMLSequence = YAMLBlockSequence | YAMLFlowSequence
export interface YAMLBlockSequence extends BaseYAMLContentNode {
type: "YAMLSequence"
style: "block"
entries: YAMLContent[]
entries: (YAMLContent | YAMLWithMark)[]
}

export interface YAMLFlowSequence extends BaseYAMLContentNode {
type: "YAMLSequence"
style: "flow"
entries: YAMLContent[]
entries: (YAMLContent | YAMLWithMark)[]
}
export type YAMLScalar =
| YAMLPlainScalar
Expand All @@ -132,21 +139,23 @@ export interface YAMLPlainScalar extends BaseYAMLContentNode {
type: "YAMLScalar"
style: "plain"
strValue: string
readonly value: string | number | boolean | null
value: string | number | boolean | null
}

export interface YAMLDoubleQuotedScalar extends BaseYAMLContentNode {
type: "YAMLScalar"
style: "double-quoted"
strValue: string
readonly value: string | number | boolean | null
value: string
raw: string
}

export interface YAMLSingleQuotedScalar extends BaseYAMLContentNode {
type: "YAMLScalar"
style: "single-quoted"
strValue: string
readonly value: string | number | boolean | null
value: string
raw: string
}

export interface YAMLBlockLiteralScalar extends BaseYAMLContentNode {
Expand Down

0 comments on commit 9aeb798

Please sign in to comment.