Skip to content

Commit f12f3a4

Browse files
author
Yuichi Murata
committed
Fix typo.
1 parent 7248f40 commit f12f3a4

File tree

2 files changed

+48
-47
lines changed

2 files changed

+48
-47
lines changed

autoload/yaml.vim

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
scriptencoding utf-8
22

3-
let s:tag_regexp = '!\{1,2\}[^! ]\+!\?'
4-
let s:scalar_regexp = '[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\='
5-
let s:tag_and_scalar_regexp = '\(\('. s:tag_regexp .'\)\s\+\)\?'. s:scalar_regexp
3+
let s:tags_regexp = '!\{1,2\}[^! ]\+!\?'
4+
let s:block_scalar_headers_regexp = '[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\='
5+
let s:tags_and_block_scalar_headers_regexp =
6+
\ '\(\('. s:tags_regexp .'\)\s\+\)\?'. s:block_scalar_headers_regexp
67

78
function! yaml#Context(...)
89
let l:obj = {}
@@ -19,71 +20,71 @@ function! yaml#Context(...)
1920
let l:width = self.GetIndentWidth()
2021

2122

22-
" ### structures ###
23-
if a:line =~ '^---\s\+'. s:tag_and_scalar_regexp .'\s*$'
23+
" ### The structures ###
24+
if a:line =~ '^---\s\+'. s:tags_and_block_scalar_headers_regexp .'\s*$'
2425
return a:indent + l:width
2526
endif
2627

2728

28-
" ### scalar start symbols('>' and '|') ###
29-
if a:line =~ '^'. s:tag_and_scalar_regexp .'\s*$'
29+
" ### The block scalar headers('>' and '|') ###
30+
if a:line =~ '^'. s:tags_and_block_scalar_headers_regexp .'\s*$'
3031
return a:indent + l:width
3132
endif
3233

3334

34-
" ### sequence collection ###
35+
" ### The sequences ###
3536
if a:line =~ '^\s*-\s*$'
3637
return a:indent + l:width
3738
end
3839

39-
" tag
40-
if a:line =~ '^\s*-\s\+'. s:tag_regexp .'\s*$'
40+
" with the tags
41+
if a:line =~ '^\s*-\s\+'. s:tags_regexp .'\s*$'
4142
return a:indent + l:width
4243
end
4344

44-
" tag and scalar
45-
if a:line =~ '^\s*-\s\+'. s:tag_and_scalar_regexp .'\s*$'
45+
" with the tags and the block scalar headers
46+
if a:line =~ '^\s*-\s\+'. s:tags_and_block_scalar_headers_regexp .'\s*$'
4647
return a:indent + l:width
4748
end
4849

49-
" mapping
50+
" with the mappings
5051
if a:line =~ '^\s*-\s\+[^:]\+:\s*$'
5152
return a:indent + 2*l:width
5253
end
5354

54-
" mapping and tag
55-
if a:line =~ '^\s*-\s\+[^:]\+:\s*'. s:tag_regexp .'\s*$'
55+
" with the mappings and the tags
56+
if a:line =~ '^\s*-\s\+[^:]\+:\s*'. s:tags_regexp .'\s*$'
5657
return a:indent + 2*l:width
5758
end
5859

59-
" mapping and tag and block scalar
60-
if a:line =~ '^\s*-\s\+[^:]\+:\s*'. s:tag_and_scalar_regexp .'\s*$'
60+
" with the mappings, the tags and the block scalar headers
61+
if a:line =~ '^\s*-\s\+[^:]\+:\s*'. s:tags_and_block_scalar_headers_regexp .'\s*$'
6162
return a:indent + 2*l:width
6263
end
6364

64-
" mapping and flow scalar
65+
" with the mappings and the flow scalars
6566
if a:line =~ '^\s*-\s\+[^:]\+:\s\+.\+$'
6667
return a:indent + l:width
6768
end
6869

6970

70-
" ### mappings collection ###
71+
" ### The mappings ###
7172
if a:line =~ '^\s*[^:]\+:\s*$'
7273
return a:indent + l:width
7374
endif
7475

75-
" tag
76-
if a:line =~ '^\s*[^:]\+:\s\+'. s:tag_regexp .'\s*$'
76+
" with the tags
77+
if a:line =~ '^\s*[^:]\+:\s\+'. s:tags_regexp .'\s*$'
7778
return a:indent + l:width
7879
endif
7980

80-
" tag and block scalar
81-
if a:line =~ '^\s*[^:]\+:\s\+'. s:tag_and_scalar_regexp .'\s*$'
81+
" with the tags and the block scalar headers
82+
if a:line =~ '^\s*[^:]\+:\s\+'. s:tags_and_block_scalar_headers_regexp .'\s*$'
8283
return a:indent + l:width
8384
endif
8485

8586

86-
" ### other ###
87+
" ### others ###
8788
return a:indent
8889
endfunction
8990

t/context_spec.vim

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ describe 'Context'
66
end
77

88
describe '#GetNextIndent(line, indent)'
9-
context 'when the `line` was structures'
9+
context 'when the `line` was the structures'
1010
it 'should do not indent'
1111
Expect copy(b:subject).GetNextIndent('---', 0) == 0
1212
Expect copy(b:subject).GetNextIndent('--- ', 0) == 0
1313
end
1414

15-
context 'with tags'
15+
context 'with the tags'
1616
it 'should do not indent'
1717
Expect copy(b:subject).GetNextIndent('--- !!tag', 0) == 0
1818
Expect copy(b:subject).GetNextIndent('--- !!tag ', 0) == 0
1919
end
2020
end
2121

22-
context 'with scalar start symbols(">" and "|")'
22+
context 'with the block scalar headers(">" and "|")'
2323
it 'should do indent'
2424
Expect copy(b:subject).GetNextIndent("--- \>", 0) == 2
2525
Expect copy(b:subject).GetNextIndent("--- \> ", 0) == 2
@@ -28,7 +28,7 @@ describe 'Context'
2828
Expect copy(b:subject).GetNextIndent('--- | ', 0) == 2
2929
end
3030

31-
context 'when tags existed before it'
31+
context 'when the tags existed before it'
3232
it 'should do indent'
3333
Expect copy(b:subject).GetNextIndent("--- !!tag \>", 0) == 2
3434
Expect copy(b:subject).GetNextIndent("--- !!tag \> ", 0) == 2
@@ -38,7 +38,7 @@ describe 'Context'
3838
end
3939
end
4040

41-
context 'when not existed spaces before the scalar start symbols'
41+
context 'when not existed spaces before the block scalar headers'
4242
it 'should do not indent'
4343
Expect copy(b:subject).GetNextIndent("---\>", 0) == 0
4444
Expect copy(b:subject).GetNextIndent("---\> ", 0) == 0
@@ -50,7 +50,7 @@ describe 'Context'
5050
end
5151
end
5252

53-
context 'when the `line` was scalar start symbols(">" and "|")'
53+
context 'when the `line` was the block scalar headers(">" and "|")'
5454
it 'should do indent'
5555
Expect copy(b:subject).GetNextIndent("\>", 0) == 2
5656
Expect copy(b:subject).GetNextIndent("\> ", 0) == 2
@@ -59,7 +59,7 @@ describe 'Context'
5959
Expect copy(b:subject).GetNextIndent('| ', 0) == 2
6060
end
6161

62-
context 'when tags existed before it'
62+
context 'when the tags existed before it'
6363
it 'should do indent'
6464
Expect copy(b:subject).GetNextIndent("!!tag \>", 0) == 2
6565
Expect copy(b:subject).GetNextIndent("!!tag \> ", 0) == 2
@@ -69,7 +69,7 @@ describe 'Context'
6969
end
7070
end
7171

72-
context 'when existed spaces before the scalar start symbols'
72+
context 'when existed spaces before the block scalar headers'
7373
it 'should do not indent'
7474
Expect copy(b:subject).GetNextIndent(" \>", 0) == 0
7575
Expect copy(b:subject).GetNextIndent(" \> ", 0) == 0
@@ -80,20 +80,20 @@ describe 'Context'
8080
end
8181
end
8282

83-
context 'when the `line` was mappings collection'
83+
context 'when the `line` was the block mappings'
8484
it 'should do indent'
8585
Expect copy(b:subject).GetNextIndent('hoge:', 0) == 2
8686
Expect copy(b:subject).GetNextIndent('hoge: ', 0) == 2
8787
end
8888

89-
context 'with tags'
89+
context 'with the tags'
9090
it 'should do indent'
9191
Expect copy(b:subject).GetNextIndent('hoge: !!tag', 0) == 2
9292
Expect copy(b:subject).GetNextIndent('hoge: !!tag ', 0) == 2
9393
end
9494
end
9595

96-
context 'with scalar start symbols(">" and "|")'
96+
context 'with the block scalar headers(">" and "|")'
9797
it 'should do indent'
9898
Expect copy(b:subject).GetNextIndent("hoge: \>", 0) == 2
9999
Expect copy(b:subject).GetNextIndent("hoge: \> ", 0) == 2
@@ -102,7 +102,7 @@ describe 'Context'
102102
Expect copy(b:subject).GetNextIndent('hoge: | ', 0) == 2
103103
end
104104

105-
context 'when tags existed before it'
105+
context 'when the tags existed before it'
106106
it 'should do indent'
107107
Expect copy(b:subject).GetNextIndent("hoge: !!tag \>", 0) == 2
108108
Expect copy(b:subject).GetNextIndent("hoge: !!tag \> ", 0) == 2
@@ -112,7 +112,7 @@ describe 'Context'
112112
end
113113
end
114114

115-
context 'when not existed spaces between ":" and the scalar start symbols'
115+
context 'when not existed spaces between ":" and the block scalar headers'
116116
it 'should do not indent'
117117
Expect copy(b:subject).GetNextIndent("hoge:\>", 0) == 0
118118
Expect copy(b:subject).GetNextIndent("hoge:\> ", 0) == 0
@@ -124,26 +124,26 @@ describe 'Context'
124124
end
125125
end
126126

127-
context 'when the `line` was sequence collection'
127+
context 'when the `line` was the block sequences'
128128
it 'should do indent'
129129
Expect copy(b:subject).GetNextIndent('-', 0) == 2
130130
Expect copy(b:subject).GetNextIndent('- ', 0) == 2
131131
end
132132

133-
context 'with tags'
133+
context 'with the tags'
134134
it 'should do indent'
135135
Expect copy(b:subject).GetNextIndent('- !!tag', 0) == 2
136136
Expect copy(b:subject).GetNextIndent('- !!tag ', 0) == 2
137137
end
138138
end
139139

140-
context 'with mappings collection'
140+
context 'with the block mappings'
141141
it 'should do double indent'
142142
Expect copy(b:subject).GetNextIndent('- hoge:', 0) == 4
143143
Expect copy(b:subject).GetNextIndent('- hoge: ', 0) == 4
144144
end
145145

146-
context 'with tags'
146+
context 'with the tags'
147147
it 'should do double indent'
148148
Expect copy(b:subject).GetNextIndent('- hoge: !!tag', 0) == 4
149149
Expect copy(b:subject).GetNextIndent('- hoge: !!tag ', 0) == 4
@@ -156,21 +156,21 @@ describe 'Context'
156156
Expect copy(b:subject).GetNextIndent('- hoge: 1 ', 0) == 2
157157
end
158158

159-
context 'with tags'
159+
context 'with the tags'
160160
it 'should do indent'
161161
Expect copy(b:subject).GetNextIndent('- hoge: !!tag 1', 0) == 2
162162
Expect copy(b:subject).GetNextIndent('- hoge: !!tag 1 ', 0) == 2
163163
end
164164
end
165165
end
166166

167-
context 'with scalar start symbols'
167+
context 'with the block scalar headers'
168168
it 'should do double indent'
169169
Expect copy(b:subject).GetNextIndent("- hoge: \>", 0) == 4
170170
Expect copy(b:subject).GetNextIndent("- hoge: \> ", 0) == 4
171171
end
172172

173-
context 'when tags existed before it'
173+
context 'when the tags existed before it'
174174
it 'should do indent'
175175
Expect copy(b:subject).GetNextIndent("- hoge: !!tag \>", 0) == 4
176176
Expect copy(b:subject).GetNextIndent("- hoge: !!tag \> ", 0) == 4
@@ -179,7 +179,7 @@ describe 'Context'
179179
end
180180
end
181181

182-
context 'with scalar start symbols(">" and "|")'
182+
context 'with the block scalar headers(">" and "|")'
183183
it 'should do indent'
184184
Expect copy(b:subject).GetNextIndent("- \>", 0) == 2
185185
Expect copy(b:subject).GetNextIndent("- \> ", 0) == 2
@@ -188,7 +188,7 @@ describe 'Context'
188188
Expect copy(b:subject).GetNextIndent('- | ', 0) == 2
189189
end
190190

191-
context 'when tags existed before it'
191+
context 'when the tags existed before it'
192192
it 'should do indent'
193193
Expect copy(b:subject).GetNextIndent("- !!tag \>", 0) == 2
194194
Expect copy(b:subject).GetNextIndent("- !!tag \> ", 0) == 2
@@ -198,7 +198,7 @@ describe 'Context'
198198
end
199199
end
200200

201-
context 'when not existed spaces between "-" and the scalar start symbols'
201+
context 'when not existed spaces between "-" and the block scalar headers'
202202
it 'should do not indent'
203203
Expect copy(b:subject).GetNextIndent("-\>", 0) == 0
204204
Expect copy(b:subject).GetNextIndent("-\> ", 0) == 0

0 commit comments

Comments
 (0)