Skip to content

Commit

Permalink
Fixed missing raw property in YAMLPlainScalar.
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Dec 23, 2020
1 parent f84d972 commit 6438d79
Show file tree
Hide file tree
Showing 188 changed files with 836 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/AST.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ This is scalars.
interface YAMLPlainScalar extends YAMLScalar {
style: "plain"
strValue: string
raw: string
}
```

Expand Down
1 change: 1 addition & 0 deletions src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export interface YAMLPlainScalar extends BaseYAMLContentNode {
style: "plain"
strValue: string
value: string | number | boolean | null
raw: string
}

export interface YAMLDoubleQuotedScalar extends BaseYAMLContentNode {
Expand Down
1 change: 1 addition & 0 deletions src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ function convertPlain(
style: "plain",
strValue,
value,
raw: code.slice(...loc.range),
parent,
...loc,
}
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/parser/ast/alias01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"style": "plain",
"strValue": "foo",
"value": "foo",
"raw": "foo",
"range": [
8,
11
Expand Down Expand Up @@ -69,6 +70,7 @@
"style": "plain",
"strValue": "bar",
"value": "bar",
"raw": "bar",
"range": [
14,
17
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/parser/ast/anchor01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
8,
9
Expand Down Expand Up @@ -108,6 +109,7 @@
"style": "plain",
"strValue": "b",
"value": "b",
"raw": "b",
"range": [
26,
27
Expand Down Expand Up @@ -182,6 +184,7 @@
"style": "plain",
"strValue": "c",
"value": "c",
"raw": "c",
"range": [
44,
45
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/parser/ast/block-folded01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
0,
1
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/parser/ast/block-literal01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
0,
1
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/parser/ast/comments01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "foo",
"value": "foo",
"raw": "foo",
"range": [
18,
21
Expand All @@ -35,6 +36,7 @@
"style": "plain",
"strValue": "bar",
"value": "bar",
"raw": "bar",
"range": [
23,
26
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/parser/ast/docs01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "foo",
"value": "foo",
"raw": "foo",
"range": [
4,
7
Expand All @@ -35,6 +36,7 @@
"style": "plain",
"strValue": "123",
"value": 123,
"raw": "123",
"range": [
9,
12
Expand Down Expand Up @@ -104,6 +106,7 @@
"style": "plain",
"strValue": "bar",
"value": "bar",
"raw": "bar",
"range": [
17,
20
Expand Down Expand Up @@ -148,6 +151,7 @@
"style": "plain",
"strValue": "baz",
"value": "baz",
"raw": "baz",
"range": [
25,
28
Expand All @@ -168,6 +172,7 @@
"style": "plain",
"strValue": "456",
"value": 456,
"raw": "456",
"range": [
30,
33
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/parser/ast/empty-pair01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
2,
3
Expand All @@ -54,6 +55,7 @@
"style": "plain",
"strValue": "b",
"value": "b",
"raw": "b",
"range": [
6,
7
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/parser/ast/empty-pair02-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
0,
1
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/parser/ast/empty-pair03-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
2,
3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"style": "plain",
"strValue": "empty-sequence-entries01-input",
"value": "empty-sequence-entries01-input",
"raw": "empty-sequence-entries01-input",
"range": [
2,
32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
4,
5
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/parser/ast/flow01-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
6,
7
Expand All @@ -35,6 +36,7 @@
"style": "plain",
"strValue": "b",
"value": "b",
"raw": "b",
"range": [
9,
10
Expand Down Expand Up @@ -72,6 +74,7 @@
"style": "plain",
"strValue": "c",
"value": "c",
"raw": "c",
"range": [
12,
13
Expand All @@ -92,6 +95,7 @@
"style": "plain",
"strValue": "d",
"value": "d",
"raw": "d",
"range": [
15,
16
Expand Down Expand Up @@ -129,6 +133,7 @@
"style": "plain",
"strValue": "0",
"value": "0",
"raw": "0",
"range": [
18,
19
Expand All @@ -149,6 +154,7 @@
"style": "plain",
"strValue": "1",
"value": 1,
"raw": "1",
"range": [
21,
22
Expand Down Expand Up @@ -222,6 +228,7 @@
"style": "plain",
"strValue": "1",
"value": 1,
"raw": "1",
"range": [
29,
30
Expand All @@ -242,6 +249,7 @@
"style": "plain",
"strValue": "2",
"value": 2,
"raw": "2",
"range": [
32,
33
Expand All @@ -262,6 +270,7 @@
"style": "plain",
"strValue": "3",
"value": 3,
"raw": "3",
"range": [
35,
36
Expand All @@ -288,6 +297,7 @@
"style": "plain",
"strValue": "a",
"value": "a",
"raw": "a",
"range": [
38,
39
Expand All @@ -308,6 +318,7 @@
"style": "plain",
"strValue": "b",
"value": "b",
"raw": "b",
"range": [
41,
42
Expand Down
Loading

0 comments on commit 6438d79

Please sign in to comment.