Skip to content

Commit 3dbeadf

Browse files
committed
Use YAML version traits for b-char.
1 parent 73a52ff commit 3dbeadf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/scanner.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# YAML 1.1 [27] b-char ::= b-line-feed | b-carriage-return | b-next-line | b-line-separator | b-paragraph-separator
2-
yaml_1_1_is_b_char(c::Char) = c == '\n' || c == '\r' || c == '\u85' || c == '\u2028' || c == '\u2029'
2+
is_b_char(::YAMLV1_1, c::Char) = c == '\n' || c == '\r' || c == '\u85' || c == '\u2028' || c == '\u2029'
33

44
# YAML 1.1 [41] ns-ascii-letter ::= [#x41-#x5A] /*A-Z*/ | [#61-#x7A] /*a-z*/
55
# YAML 1.2 [37] ns-ascii-letter ::= [x41-x5A] | [x61-x7A] # A-Z a-z
@@ -1217,7 +1217,7 @@ function scan_block_scalar_breaks(stream::TokenStream, indent)
12171217
forwardchars!(stream)
12181218
end
12191219

1220-
while yaml_1_1_is_b_char(peek(stream.input))
1220+
while is_b_char(YAMLV1_1(), peek(stream.input))
12211221
push!(chunks, scan_line_break(stream))
12221222
end_mark = get_mark(stream)
12231223
while stream.column < indent && peek(stream.input) == ' '
@@ -1317,7 +1317,7 @@ function scan_flow_scalar_non_spaces(stream::TokenStream, double::Bool,
13171317
end
13181318
push!(chunks, Char(parse(Int, prefix(stream.input, length), base = 16)))
13191319
forwardchars!(stream, length)
1320-
elseif yaml_1_1_is_b_char(c)
1320+
elseif is_b_char(YAMLV1_1(), c)
13211321
scan_line_break(stream)
13221322
append!(chunks, scan_flow_scalar_breaks(stream, double, start_mark))
13231323
else
@@ -1347,7 +1347,7 @@ function scan_flow_scalar_spaces(stream::TokenStream, double::Bool,
13471347
if c == '\0'
13481348
throw(ScannerError("while scanning a quoted scalar", start_mark,
13491349
"found unexpected end of stream", get_mark(stream)))
1350-
elseif yaml_1_1_is_b_char(c)
1350+
elseif is_b_char(YAMLV1_1(), c)
13511351
line_break = scan_line_break(stream)
13521352
breaks = scan_flow_scalar_breaks(stream, double, start_mark)
13531353
if line_break != '\n'
@@ -1380,7 +1380,7 @@ function scan_flow_scalar_breaks(stream::TokenStream, double::Bool,
13801380
forward!(stream.input)
13811381
end
13821382

1383-
if yaml_1_1_is_b_char(peek(stream.input))
1383+
if is_b_char(YAMLV1_1(), peek(stream.input))
13841384
push!(chunks, scan_line_break(stream))
13851385
else
13861386
return chunks
@@ -1464,7 +1464,7 @@ function scan_plain_spaces(stream::TokenStream, indent::Integer,
14641464
whitespaces = prefix(stream.input, length)
14651465
forwardchars!(stream, length)
14661466
c = peek(stream.input)
1467-
if yaml_1_1_is_b_char(c)
1467+
if is_b_char(YAMLV1_1(), c)
14681468
line_break = scan_line_break(stream)
14691469
stream.allow_simple_key = true
14701470
if peek(stream.input) == '\uFEFF'

0 commit comments

Comments
 (0)