-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use is_whitespace
more
#202
base: master
Are you sure you want to change the base?
Conversation
Here we use abstract type & subtyping because it's common traits pattern in Julia. We do not need to export these objects because we can use strings for versions in user-facing functions like: ```julia function load(str::AbstractString; version::YAMLVersion) # ... end function load(str::AbstractString; version::AbstractString) version == "1.1" ? load(str, version=YAMLV1_1()) : version == "1.2" ? load(str, version=YAMLV1_2()) : throw(ErrorException()) end load(str, version="1.1") ```
yaml_1_1_is_whitespace
more.is_whitespace
more
@@ -13,6 +13,8 @@ is_s_white(c::Char) = c == yaml_1_2_s_space || c == yaml_1_2_s_tab | |||
# YAML 1.2 [37] ns-ascii-letter ::= [x41-x5A] | [x61-x7A] # A-Z a-z | |||
is_ns_ascii_letter(c::Char) = 'A' ≤ c ≤ 'Z' || 'a' ≤ c ≤ 'z' | |||
|
|||
is_whitespace(::YAMLV1_1, c::Char) = c == '\0' || c == ' ' || c == '\t' || is_b_char(YAMLV1_1(), c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Counting \0
as whitespace seems suspicious but maybe that's the best way to make sense of the existing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't understood this whitespace
meaning yet but only mechanically replacing existing code.
This depends on #200. Use
yaml_1_1_is_whitespace
more.