Skip to content
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

Fix HashLink issues related to Parser.hx #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions src/yaml/Parser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,6 @@ class Parser
tagMap.set(handle, prefix);
});

if (validate && PATTERN_NON_PRINTABLE.match(this.input))
{
throwError('the stream contains non-printable characters');
}

while (CHAR_SPACE == character)
{
lineIndent += 1;
Expand Down Expand Up @@ -647,7 +642,7 @@ class Parser

if (result != null)
{
#if sys
#if (sys && !hl)
result = Utf8.decode(result); // convert back into native encoding
#end
return true;
Expand Down Expand Up @@ -689,7 +684,7 @@ class Parser
}
else
{
#if sys
#if (sys && !hl)
result = Utf8.decode(result);
#end
return true;
Expand Down Expand Up @@ -738,7 +733,7 @@ class Parser
captureSegment(captureStart, position, true);
character = Utf8.charCodeAt(input, ++position);

#if sys
#if (sys && !hl)
result = Utf8.decode(result);
#end
return true;
Expand Down Expand Up @@ -973,7 +968,7 @@ class Parser
try
{
_result = type.resolve(result, usingMaps, false);
#if sys
#if (sys && !hl)
if (Std.is(_result, String))
_result = Utf8.decode(_result);
#end
Expand Down Expand Up @@ -1002,7 +997,7 @@ class Parser
try
{
_result = t.resolve(result, usingMaps, true);
#if sys
#if (sys && !hl)
if (Std.is(_result, String))
_result = Utf8.decode(_result);
#end
Expand Down Expand Up @@ -1309,7 +1304,7 @@ class Parser
captureSegment(captureStart, position, false);
}

#if sys
#if (sys && !hl)
result = Utf8.decode(result);
#end

Expand Down Expand Up @@ -1993,21 +1988,11 @@ class Parser
hash.set(CHAR_CAPITAL_U, 8);
hash;
};

#if (eval || neko || cpp || display)
public static var PATTERN_NON_PRINTABLE = ~/[\x{00}-\x{08}\x{0B}\x{0C}\x{0E}-\x{1F}\x{7F}-\x{84}\x{86}-\x{9F}\x{FFFE}\x{FFFF}]/u;
#elseif (js || flash9 || java)
public static var PATTERN_NON_PRINTABLE = ~/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uD800-\uDFFF\uFFFE\uFFFF]/u;
#else
#error "Compilation target not supported due to lack of Unicode RegEx support."
#end

#if (eval || neko || cpp || display)
#if (js || flash9 || java)
public static var PATTERN_NON_ASCII_LINE_BREAKS = ~/[\x{85}\x{2028}\x{2029}]/u;
#elseif (js || flash9 || java)
public static var PATTERN_NON_ASCII_LINE_BREAKS = ~/[\x85\u2028\u2029]/u;
#else
#error "Compilation target not supported due to lack of Unicode RegEx support."
public static var PATTERN_NON_ASCII_LINE_BREAKS = ~/[\x85\u2028\u2029]/u;
#end

public static var PATTERN_FLOW_INDICATORS = ~/[,\[\]\{\}]/u;
Expand Down