| 764 | | * Token initializers. |
| 765 | | */ |
| 766 | | |
| 767 | | #define TOKEN_INIT(token,token_type,token_start_mark,token_end_mark) \ |
| 768 | | (memset(&(token), 0, sizeof(yaml_token_t)), \ |
| 769 | | (token).type = (token_type), \ |
| 770 | | (token).start_mark = (token_start_mark), \ |
| 771 | | (token).end_mark = (token_end_mark)) |
| 772 | | |
| 773 | | #define STREAM_START_TOKEN_INIT(token,token_encoding,start_mark,end_mark) \ |
| 774 | | (TOKEN_INIT((token),YAML_STREAM_START_TOKEN,(start_mark),(end_mark)), \ |
| 775 | | (token).data.stream_start.encoding = (token_encoding)) |
| 776 | | |
| 777 | | #define STREAM_END_TOKEN_INIT(token,start_mark,end_mark) \ |
| 778 | | (TOKEN_INIT((token),YAML_STREAM_END_TOKEN,(start_mark),(end_mark))) |
| 779 | | |
| 780 | | #define ALIAS_TOKEN_INIT(token,token_value,start_mark,end_mark) \ |
| 781 | | (TOKEN_INIT((token),YAML_ALIAS_TOKEN,(start_mark),(end_mark)), \ |
| 782 | | (token).data.alias.value = (token_value)) |
| 783 | | |
| 784 | | #define ANCHOR_TOKEN_INIT(token,token_value,start_mark,end_mark) \ |
| 785 | | (TOKEN_INIT((token),YAML_ANCHOR_TOKEN,(start_mark),(end_mark)), \ |
| 786 | | (token).data.anchor.value = (token_value)) |
| 787 | | |
| 788 | | #define TAG_TOKEN_INIT(token,token_handle,token_suffix,start_mark,end_mark) \ |
| 789 | | (TOKEN_INIT((token),YAML_TAG_TOKEN,(start_mark),(end_mark)), \ |
| 790 | | (token).data.tag.handle = (token_handle), \ |
| 791 | | (token).data.tag.suffix = (token_suffix)) |
| 792 | | |
| 793 | | #define SCALAR_TOKEN_INIT(token,token_value,token_length,token_style,start_mark,end_mark) \ |
| 794 | | (TOKEN_INIT((token),YAML_SCALAR_TOKEN,(start_mark),(end_mark)), \ |
| 795 | | (token).data.scalar.value = (token_value), \ |
| 796 | | (token).data.scalar.length = (token_length), \ |
| 797 | | (token).data.scalar.style = (token_style)) |
| 798 | | |
| 799 | | #define VERSION_DIRECTIVE_TOKEN_INIT(token,token_major,token_minor,start_mark,end_mark) \ |
| 800 | | (TOKEN_INIT((token),YAML_VERSION_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ |
| 801 | | (token).data.version_directive.major = (token_major), \ |
| 802 | | (token).data.version_directive.minor = (token_minor)) |
| 803 | | |
| 804 | | #define TAG_DIRECTIVE_TOKEN_INIT(token,token_handle,token_prefix,start_mark,end_mark) \ |
| 805 | | (TOKEN_INIT((token),YAML_TAG_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ |
| 806 | | (token).data.tag_directive.handle = (token_handle), \ |
| 807 | | (token).data.tag_directive.prefix = (token_prefix)) |
| 808 | | |
| 809 | | /* |