Skip to content

Commit

Permalink
Allow dots and slashes in anchor names (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpunk authored Mar 29, 2020
1 parent e0b9e42 commit 7e3cea3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/emitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,11 @@ yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
}

while (string.pointer != string.end) {
if (!IS_ALPHA(string)) {
if (
!IS_ALPHA(string)
&& !CHECK(string, '.')
&& !CHECK(string, '/')
) {
return yaml_emitter_set_emitter_error(emitter, alias ?
"alias value must contain alphanumerical characters only" :
"anchor value must contain alphanumerical characters only");
Expand Down
6 changes: 5 additions & 1 deletion src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,11 @@ yaml_parser_scan_anchor(yaml_parser_t *parser, yaml_token_t *token,

if (!CACHE(parser, 1)) goto error;

while (IS_ALPHA(parser->buffer)) {
while (
IS_ALPHA(parser->buffer)
|| CHECK(parser->buffer, '.')
|| CHECK(parser->buffer, '/')
) {
if (!READ(parser, string)) goto error;
if (!CACHE(parser, 1)) goto error;
length ++;
Expand Down

0 comments on commit 7e3cea3

Please sign in to comment.