本文整理汇总了C++中PEEK_TOKEN函数的典型用法代码示例。如果您正苦于以下问题:C++ PEEK_TOKEN函数的具体用法?C++ PEEK_TOKEN怎么用?C++ PEEK_TOKEN使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PEEK_TOKEN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: yaml_parser_parse_block_mapping_value
static int
yaml_parser_parse_block_mapping_value(yaml_parser_t *parser,
yaml_event_t *event)
{
yaml_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_VALUE_TOKEN)
{
yaml_mark_t mark = token->end_mark;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_KEY_TOKEN &&
token->type != YAML_VALUE_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_BLOCK_MAPPING_KEY_STATE))
return 0;
return yaml_parser_parse_node(parser, event, 1, 1);
}
else {
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
return yaml_parser_process_empty_scalar(parser, event, mark);
}
}
else
{
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
}
}
示例2: yaml_parser_parse_document_end
static int
yaml_parser_parse_document_end(yaml_parser_t *parser, yaml_event_t *event)
{
yaml_token_t *token;
yaml_mark_t start_mark, end_mark;
int implicit = 1;
token = PEEK_TOKEN(parser);
if (!token) return 0;
start_mark = end_mark = token->start_mark;
while (token->type == YAML_DOCUMENT_END_TOKEN) {
end_mark = token->end_mark;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
implicit = 0;
}
while (!STACK_EMPTY(parser, parser->tag_directives)) {
yaml_tag_directive_t tag_directive = POP(parser, parser->tag_directives);
yaml_free(tag_directive.handle);
yaml_free(tag_directive.prefix);
}
parser->state = YAML_PARSE_DOCUMENT_START_STATE;
DOCUMENT_END_EVENT_INIT(*event, implicit, start_mark, end_mark);
return 1;
}
示例3: yaml_parser_parse_indentless_sequence_entry
static int yaml_parser_parse_indentless_sequence_entry (yaml_parser_t * parser, yaml_event_t * event)
{
yaml_token_t *token;
token = PEEK_TOKEN (parser);
if (!token)
return 0;
if (token->type == YAML_BLOCK_ENTRY_TOKEN)
{
yaml_mark_t mark = token->end_mark;
SKIP_TOKEN (parser);
token = PEEK_TOKEN (parser);
if (!token)
return 0;
if (token->type != YAML_BLOCK_ENTRY_TOKEN && token->type != YAML_KEY_TOKEN && token->type != YAML_VALUE_TOKEN && token->type != YAML_BLOCK_END_TOKEN)
{
if (!PUSH (parser, parser->states, YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE))
return 0;
return yaml_parser_parse_node (parser, event, 1, 0);
}
else
{
parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
return yaml_parser_process_empty_scalar (parser, event, mark);
}
}
else
{
parser->state = POP (parser, parser->states);
SEQUENCE_END_EVENT_INIT (*event, token->start_mark, token->start_mark);
return 1;
}
}
示例4: _ympars_parseblockvalue
static int
_ympars_parseblockvalue(ym_pars_t *parser,
ym_event_t *event)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_VALUE_TOKEN)
{
ym_mark_t mark = token->eoevent;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_KEY_TOKEN &&
token->type != YAML_VALUE_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_BLOCK_MAPPING_KEY_STATE))
return 0;
return _ympars_parsenode(parser, event, 1, 1);
}
else {
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
return _ympars_processemptyscalar(parser, event, mark);
}
}
else
{
parser->state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
return _ympars_processemptyscalar(parser, event, token->soevent);
}
}
示例5: yaml_parser_parse_flow_mapping_value
static int
yaml_parser_parse_flow_mapping_value(yaml_parser_t *parser,
yaml_event_t *event, int empty)
{
yaml_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (empty) {
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
return yaml_parser_process_empty_scalar(parser, event,
token->start_mark);
}
if (token->type == YAML_VALUE_TOKEN) {
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_FLOW_ENTRY_TOKEN
&& token->type != YAML_FLOW_MAPPING_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_FLOW_MAPPING_KEY_STATE))
return 0;
return yaml_parser_parse_node(parser, event, 0, 0);
}
}
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
return yaml_parser_process_empty_scalar(parser, event, token->start_mark);
}
示例6: _ympars_parseflowvalue
static int
_ympars_parseflowvalue(ym_pars_t *parser,
ym_event_t *event, int empty)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (empty) {
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
return _ympars_processemptyscalar(parser, event,
token->soevent);
}
if (token->type == YAML_VALUE_TOKEN) {
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_FLOW_ENTRY_TOKEN
&& token->type != YAML_FLOW_MAPPING_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_FLOW_MAPPING_KEY_STATE))
return 0;
return _ympars_parsenode(parser, event, 0, 0);
}
}
parser->state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
return _ympars_processemptyscalar(parser, event, token->soevent);
}
示例7: yaml_parser_parse_flow_sequence_entry
static int yaml_parser_parse_flow_sequence_entry (yaml_parser_t * parser, yaml_event_t * event, int first)
{
yaml_token_t *token;
yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
if (first)
{
token = PEEK_TOKEN (parser);
if (!PUSH (parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN (parser);
}
token = PEEK_TOKEN (parser);
if (!token)
return 0;
if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
{
if (!first)
{
if (token->type == YAML_FLOW_ENTRY_TOKEN)
{
SKIP_TOKEN (parser);
token = PEEK_TOKEN (parser);
if (!token)
return 0;
}
else
{
return yaml_parser_set_parser_error_context (parser, "while parsing a flow sequence", POP (parser, parser->marks), "did not find expected ',' or ']'", token->start_mark);
}
}
if (token->type == YAML_KEY_TOKEN)
{
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE;
MAPPING_START_EVENT_INIT (*event, NULL, NULL, 1, YAML_FLOW_MAPPING_STYLE, token->start_mark, token->end_mark);
SKIP_TOKEN (parser);
return 1;
}
else if (token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
{
if (!PUSH (parser, parser->states, YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE))
return 0;
return yaml_parser_parse_node (parser, event, 0, 0);
}
}
parser->state = POP (parser, parser->states);
dummy_mark = POP (parser, parser->marks);
SEQUENCE_END_EVENT_INIT (*event, token->start_mark, token->end_mark);
SKIP_TOKEN (parser);
return 1;
}
示例8: _ympars_parseblockkey
static int
_ympars_parseblockkey(ym_pars_t *parser,
ym_event_t *event, int first)
{
ym_token_t *token;
if (first) {
token = PEEK_TOKEN(parser);
if (!PUSH(parser, parser->marks, token->soevent))
return 0;
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_KEY_TOKEN)
{
ym_mark_t mark = token->eoevent;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_KEY_TOKEN &&
token->type != YAML_VALUE_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE))
return 0;
return _ympars_parsenode(parser, event, 1, 1);
}
else {
parser->state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
return _ympars_processemptyscalar(parser, event, mark);
}
}
else if (token->type == YAML_BLOCK_END_TOKEN)
{
ym_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
parser->state = POP(parser, parser->states);
dummy_mark = POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->soevent, token->eoevent);
SKIP_TOKEN(parser);
return 1;
}
else
{
return _ympars_setparsererrcontext(parser,
"while parsing a block mapping", POP(parser, parser->marks),
"did not find expected key", token->soevent);
}
}
示例9: yaml_parser_parse_block_mapping_key
static int
yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
yaml_event_t *event, int first)
{
yaml_token_t *token;
if (first) {
token = PEEK_TOKEN(parser);
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_KEY_TOKEN)
{
yaml_mark_t mark = token->end_mark;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_KEY_TOKEN &&
token->type != YAML_VALUE_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE))
return 0;
return yaml_parser_parse_node(parser, event, 1, 1);
}
else {
parser->state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
return yaml_parser_process_empty_scalar(parser, event, mark);
}
}
else if (token->type == YAML_BLOCK_END_TOKEN)
{
yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
parser->state = POP(parser, parser->states);
dummy_mark = POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
}
else
{
return yaml_parser_set_parser_error_context(parser,
"while parsing a block mapping", POP(parser, parser->marks),
"did not find expected key", token->start_mark);
}
}
示例10: yaml_parser_parse_block_sequence_entry
static int
yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
yaml_event_t *event, int first)
{
yaml_token_t *token;
if (first) {
token = PEEK_TOKEN(parser);
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_BLOCK_ENTRY_TOKEN)
{
yaml_mark_t mark = token->end_mark;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE))
return 0;
return yaml_parser_parse_node(parser, event, 1, 0);
}
else {
parser->state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
return yaml_parser_process_empty_scalar(parser, event, mark);
}
}
else if (token->type == YAML_BLOCK_END_TOKEN)
{
yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
parser->state = POP(parser, parser->states);
dummy_mark = POP(parser, parser->marks);
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
}
else
{
return yaml_parser_set_parser_error_context(parser,
"while parsing a block collection", POP(parser, parser->marks),
"did not find expected '-' indicator", token->start_mark);
}
}
示例11: _ympars_parsedocend
static int
_ympars_parsedocend(ym_pars_t *parser, ym_event_t *event)
{
ym_token_t *token;
ym_mark_t soevent, eoevent;
int implicit = 1;
token = PEEK_TOKEN(parser);
if (!token) return 0;
soevent = eoevent = token->soevent;
if (token->type == YAML_DOCUMENT_END_TOKEN) {
eoevent = token->eoevent;
SKIP_TOKEN(parser);
implicit = 0;
}
while (!STACK_EMPTY(parser, parser->tag_directives)) {
ym_ytag_t ytag = POP(parser, parser->tag_directives);
ym_free(ytag.handle);
ym_free(ytag.prefix);
}
parser->state = YAML_PARSE_DOCUMENT_START_STATE;
DOCUMENT_END_EVENT_INIT(*event, implicit, soevent, eoevent);
return 1;
}
示例12: yaml_parser_parse_flow_sequence_entry_mapping_end
static int yaml_parser_parse_flow_sequence_entry_mapping_end (yaml_parser_t * parser, yaml_event_t * event)
{
yaml_token_t *token;
token = PEEK_TOKEN (parser);
if (!token)
return 0;
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE;
MAPPING_END_EVENT_INIT (*event, token->start_mark, token->start_mark);
return 1;
}
示例13: _ympars_parseflowaryhashend
static int
_ympars_parseflowaryhashend(ym_pars_t *parser,
ym_event_t *event)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE;
MAPPING_END_EVENT_INIT(*event, token->soevent, token->soevent);
return 1;
}
示例14: _ympars_parseindentlessitem
static int
_ympars_parseindentlessitem(ym_pars_t *parser,
ym_event_t *event)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_BLOCK_ENTRY_TOKEN)
{
ym_mark_t mark = token->eoevent;
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
token->type != YAML_KEY_TOKEN &&
token->type != YAML_VALUE_TOKEN &&
token->type != YAML_BLOCK_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE))
return 0;
return _ympars_parsenode(parser, event, 1, 0);
}
else {
parser->state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
return _ympars_processemptyscalar(parser, event, mark);
}
}
else
{
parser->state = POP(parser, parser->states);
SEQUENCE_END_EVENT_INIT(*event, token->soevent, token->soevent);
return 1;
}
}
示例15: yaml_parser_parse_stream_start
static int yaml_parser_parse_stream_start (yaml_parser_t * parser, yaml_event_t * event)
{
yaml_token_t *token;
token = PEEK_TOKEN (parser);
if (!token)
return 0;
if (token->type != YAML_STREAM_START_TOKEN)
{
return yaml_parser_set_parser_error (parser, "did not find expected <stream-start>", token->start_mark);
}
parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
STREAM_START_EVENT_INIT (*event, token->data.stream_start.encoding, token->start_mark, token->start_mark);
SKIP_TOKEN (parser);
return 1;
}