Skip to content

Commit

Permalink
Fixes comments not being respected some of the time
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Nov 1, 2020
1 parent b2bd010 commit 59f7cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion objects/oTestYAML/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct = {
test2 : "\"Hello world!\"",
url : "https://www.jujuadams.com/",
func : function() {},
//func : function() {},
};

var _string = "{\"hello\" : \"world\", \"more\" : \"data\"}";
Expand Down
7 changes: 6 additions & 1 deletion scripts/snap_from_yaml/snap_from_yaml.gml
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,17 @@ function __snap_from_yaml_tokenizer(_buffer) constructor
}
else if (_next_value == 45) //Two hyphens in a row
{
if ((buffer_tell(_buffer) <= _buffer_size - 4) && (buffer_peek(_buffer, buffer_tell(_buffer), buffer_u32) == ((35 << 24) | (32 << 16) | (45 << 8) | 45)))
if ((buffer_tell(_buffer) <= _buffer_size - 4) && (buffer_peek(_buffer, buffer_tell(_buffer), buffer_u32) == ((35 << 24) | (32 << 16) | (45 << 8) | 45))) //Detect "--- # comment"
{
_in_comment = true;
}
}
}
else if (_scalar_first_character && (_value == 35)) //First character on the line is a hash
{
var _next_value = buffer_peek(_buffer, buffer_tell(_buffer), buffer_u8);
if (_next_value == 32) _in_comment = true; //Detect "# comment" which is different to "--- # comment" because the YAML spec is shit
}
else
{
_scalar_first_character = false;
Expand Down

0 comments on commit 59f7cd7

Please sign in to comment.