本文整理汇总了C++中PEEK_TOKEN函数的典型用法代码示例。如果您正苦于以下问题:C++ PEEK_TOKEN函数的具体用法?C++ PEEK_TOKEN怎么用?C++ PEEK_TOKEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PEEK_TOKEN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:prestocore,项目名称:browser,代码行数:35,代码来源:yaml_parser.c
示例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;
}
开发者ID:gitpan,项目名称:YAML2,代码行数:31,代码来源:parser.c
示例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;
}
}
开发者ID:274914765,项目名称:C,代码行数:35,代码来源:parser.c
示例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);
}
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:35,代码来源:yaml-parser.c
示例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);
}
开发者ID:prestocore,项目名称:browser,代码行数:31,代码来源:yaml_parser.c
示例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);
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:31,代码来源:yaml-parser.c
示例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;
}
开发者ID:274914765,项目名称:C,代码行数:56,代码来源:parser.c
示例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);
}
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:53,代码来源:yaml-parser.c
示例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);
}
}
开发者ID:44670,项目名称:Project_CTR,代码行数:53,代码来源:parser.c
示例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);
}
}
开发者ID:prestocore,项目名称:browser,代码行数:52,代码来源:yaml_parser.c
示例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;
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:29,代码来源:yaml-parser.c
示例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;
}
开发者ID:274914765,项目名称:C,代码行数:13,代码来源:parser.c
示例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;
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:14,代码来源:yaml-parser.c
示例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;
}
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:37,代码来源:yaml-parser.c
示例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;
}
开发者ID:274914765,项目名称:C,代码行数:19,代码来源:parser.c
示例16: yaml_parser_parse_document_content
static int yaml_parser_parse_document_content (yaml_parser_t * parser, yaml_event_t * event)
{
yaml_token_t *token;
token = PEEK_TOKEN (parser);
if (!token)
return 0;
if (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
token->type == YAML_TAG_DIRECTIVE_TOKEN || token->type == YAML_DOCUMENT_START_TOKEN || token->type == YAML_DOCUMENT_END_TOKEN || token->type == YAML_STREAM_END_TOKEN)
{
parser->state = POP (parser, parser->states);
return yaml_parser_process_empty_scalar (parser, event, token->start_mark);
}
else
{
return yaml_parser_parse_node (parser, event, 1, 0);
}
}
开发者ID:274914765,项目名称:C,代码行数:19,代码来源:parser.c
示例17: _ympars_parsestream_start
static int
_ympars_parsestream_start(ym_pars_t *parser, ym_event_t *event)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type != YAML_STREAM_START_TOKEN) {
return _ympars_setparsererr(parser,
"did not find expected <stream-start>", token->soevent);
}
parser->state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
STREAM_START_EVENT_INIT(*event, token->data.stream_start.encoding,
token->soevent, token->soevent);
SKIP_TOKEN(parser);
return 1;
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:20,代码来源:yaml-parser.c
示例18: _ympars_parsedoccontent
static int
_ympars_parsedoccontent(ym_pars_t *parser, ym_event_t *event)
{
ym_token_t *token;
token = PEEK_TOKEN(parser);
if (!token) return 0;
if (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
token->type == YAML_TAG_DIRECTIVE_TOKEN ||
token->type == YAML_DOCUMENT_START_TOKEN ||
token->type == YAML_DOCUMENT_END_TOKEN ||
token->type == YAML_STREAM_END_TOKEN) {
parser->state = POP(parser, parser->states);
return _ympars_processemptyscalar(parser, event,
token->soevent);
}
else {
return _ympars_parsenode(parser, event, 1, 0);
}
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:21,代码来源:yaml-parser.c
示例19: yaml_parser_parse_flow_sequence_entry_mapping_key
static int yaml_parser_parse_flow_sequence_entry_mapping_key (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 && token->type != YAML_FLOW_ENTRY_TOKEN && token->type != YAML_FLOW_SEQUENCE_END_TOKEN)
{
if (!PUSH (parser, parser->states, YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE))
return 0;
return yaml_parser_parse_node (parser, event, 0, 0);
}
else
{
yaml_mark_t mark = token->end_mark;
SKIP_TOKEN (parser);
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE;
return yaml_parser_process_empty_scalar (parser, event, mark);
}
}
开发者ID:274914765,项目名称:C,代码行数:22,代码来源:parser.c
示例20: _ympars_parseflowarykey
static int
_ympars_parseflowarykey(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 && token->type != YAML_FLOW_ENTRY_TOKEN
&& token->type != YAML_FLOW_SEQUENCE_END_TOKEN) {
if (!PUSH(parser, parser->states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE))
return 0;
return _ympars_parsenode(parser, event, 0, 0);
}
else {
ym_mark_t mark = token->eoevent;
SKIP_TOKEN(parser);
parser->state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE;
return _ympars_processemptyscalar(parser, event, mark);
}
}
开发者ID:marcastel,项目名称:dfdoc,代码行数:23,代码来源:yaml-parser.c
注:本文中的PEEK_TOKEN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论