Scan the directive name. Scope: %YAML 1.1 # a comment \n ^^^^ %TAG !yaml! tag:yaml.org,2002: \n ^^^
(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte)
| 1725 | // ^^^ |
| 1726 | // |
| 1727 | func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { |
| 1728 | // Consume the directive name. |
| 1729 | if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { |
| 1730 | return false |
| 1731 | } |
| 1732 | |
| 1733 | var s []byte |
| 1734 | for is_alpha(parser.buffer, parser.buffer_pos) { |
| 1735 | s = read(parser, s) |
| 1736 | if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { |
| 1737 | return false |
| 1738 | } |
| 1739 | } |
| 1740 | |
| 1741 | // Check if the name is empty. |
| 1742 | if len(s) == 0 { |
| 1743 | yaml_parser_set_scanner_error(parser, "while scanning a directive", |
| 1744 | start_mark, "could not find expected directive name") |
| 1745 | return false |
| 1746 | } |
| 1747 | |
| 1748 | // Check for an blank character after the name. |
| 1749 | if !is_blankz(parser.buffer, parser.buffer_pos) { |
| 1750 | yaml_parser_set_scanner_error(parser, "while scanning a directive", |
| 1751 | start_mark, "found unexpected non-alphabetical character") |
| 1752 | return false |
| 1753 | } |
| 1754 | *name = s |
| 1755 | return true |
| 1756 | } |
| 1757 | |
| 1758 | // Scan the value of VERSION-DIRECTIVE. |
| 1759 | // |
no test coverage detected