• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ skip_ws函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中skip_ws函数的典型用法代码示例。如果您正苦于以下问题:C++ skip_ws函数的具体用法?C++ skip_ws怎么用?C++ skip_ws使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了skip_ws函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: step_predicate_parser

static void step_predicate_parser(parser_context *context)
{
    enter_state(context, ST_PREDICATE);

    skip_ws(context);
    if('[' == get_char(context))
    {
        consume_char(context);
        if(!look_for(context, "]"))
        {
            context->result.code = ERR_UNBALANCED_PRED_DELIM;
            return;
        }
        skip_ws(context);
        if(']' == get_char(context))
        {
            context->result.code = ERR_EMPTY_PREDICATE;
            return;
        }

        try_predicate_parser(wildcard_predicate);
        try_predicate_parser(subscript_predicate);
        try_predicate_parser(slice_predicate);

        if(JSONPATH_SUCCESS != context->result.code && ERR_PARSER_OUT_OF_MEMORY != context->result.code)
        {
            context->result.code = ERR_UNSUPPORTED_PRED_TYPE;
        }
    }
    else
    {
        unexpected_value(context, '[');
    }
}
开发者ID:kazufusa,项目名称:kanabo,代码行数:34,代码来源:core.c


示例2: parse_shop

/*
 * shop = addop << addop
 *      | addop >> addop
 *      | addop
 */
int
parse_shop(char **p)
{
    int val1, val2;
    int done = 0;

    skip_ws(p);
    
    val1 = parse_addop(p);

    do {
	skip_ws(p);

	if (*(*p) == '>' && *(*p+1) == '>') {
      (*p) += 2;	/* skip >> */
	    val2 = parse_addop(p);
	    if (val2 < 0)
		error("negative shift count");
	    val1 = val1 >> val2;

	} else if (*(*p) == '<' && *(*p+1) == '<') {
      (*p) += 2;	/* skip >> */
	    val2 = parse_addop(p);
	    if (val2 < 0)
		error("negative shift count");
	    val1 = val1 << val2;

	} else
	    done = 1;

    } while (!done);
开发者ID:Reedgarden,项目名称:bcm-sdk-xgs,代码行数:36,代码来源:ledasm.c


示例3: bibtex_tag

static char *
bibtex_tag( char *p, newstr *tag )
{
	p = newstr_cpytodelim( tag, skip_ws( p ), "= \t\r\n", 0 );
	if ( newstr_memerr( tag ) ) return NULL;
	return skip_ws( p );
}
开发者ID:jayvdb,项目名称:bibutils-archive,代码行数:7,代码来源:bibtexin.c


示例4: medin_medlinedate

/*            <MedlineDate>2003 Jan-Feb</MedlineDate> */
static int
medin_medlinedate( fields *info, char *p, int level )
{
	int fstatus;
	newstr tmp;

	newstr_init( &tmp );

	p = newstr_cpytodelim( &tmp, skip_ws( p ), " \t\n\r", 0 );
	if ( newstr_memerr( &tmp ) ) return BIBL_ERR_MEMERR;
	if ( tmp.len > 0 ) {
		fstatus = fields_add( info, "PARTYEAR", tmp.data, level );
		if ( fstatus!=FIELDS_OK ) return BIBL_ERR_MEMERR;
	}

	p = newstr_cpytodelim( &tmp, skip_ws( p ), " \t\n\r", 0 );
	if ( newstr_memerr( &tmp ) ) return BIBL_ERR_MEMERR;
	if ( tmp.len > 0 ) {
		newstr_findreplace( &tmp, "-", "/" );
		fstatus = fields_add( info, "PARTMONTH", tmp.data, level );
		if ( fstatus!=FIELDS_OK ) return BIBL_ERR_MEMERR;
	}

	p = newstr_cpytodelim( &tmp, skip_ws( p ), " \t\n\r", 0 );
	if ( newstr_memerr( &tmp ) ) return BIBL_ERR_MEMERR;
	if ( tmp.len > 0 ) {
		fstatus = fields_add( info, "PARTDAY", tmp.data, level );
		if ( fstatus!=FIELDS_OK ) return BIBL_ERR_MEMERR;
	}

	newstr_free( &tmp );

	return BIBL_OK;
}
开发者ID:jayvdb,项目名称:bibutils-archive,代码行数:35,代码来源:medin.c


示例5: parse_comp

static int
parse_comp(const char *s, int strict,
	   VALUE *num)
{
    char *buf, *b;
    VALUE tmp;
    int ret = 1;

    buf = ALLOCV_N(char, tmp, strlen(s) + 1);
    b = buf;

    skip_ws(&s);
    if (!read_comp(&s, strict, num, &b)) {
	ret = 0;
    }
    else {
	skip_ws(&s);

	if (strict)
	    if (*s != '\0')
		ret = 0;
    }
    ALLOCV_END(tmp);

    return ret;
}
开发者ID:gogotanaka,项目名称:ruby_svn,代码行数:26,代码来源:complex.c


示例6: while

static char *get_value(char **pos, config_file_t *cf, char *skipped)
{
	char *p = *pos;
	char *q;
	char *start;

	*skipped = '\0';
	if (*p == '"')
	{
		p++;
		start = p;
		q = p;
		while (*p != '\0' && *p != '\r' && *p != '\n' && *p != '"')
		{
			if (*p == '\\' && (p[1] == '"' || p[1] == '\\'))
				p++;
			*q++ = *p++;
		}
		if (*p == '\0')
		{
			config_file_error(cf, "File ends inside quoted string");
			return NULL;
		}
		if (*p == '\r' || *p == '\n')
		{
			config_file_error(cf, "Newline inside quoted string");
			return NULL;
		}
		if (*p != '"')
		{
			config_file_error(cf, "Weird character terminating quoted string (BUG)");
			return NULL;
		}
		p++;
		*q = '\0';
		*pos = p;
		skip_ws(pos, cf);
		return start;
	}
	else
	{
		start = p;
		while (*p != '\0' && *p != '\t' && *p != '\r' && *p != '\n' &&
				*p != ' ' && *p != '/' && *p != '#' &&
				*p != ';' && *p != '{' && *p != '}')
			p++;
		if (p == start)
			return NULL;
		*pos = p;
		skip_ws(pos, cf);
		if (p == *pos)
			*skipped = *p;
		*p = '\0';
		if (p == *pos)
			(*pos)++;
		return start;
	}
}
开发者ID:123457890b,项目名称:opensn0w,代码行数:58,代码来源:config_file.c


示例7: read_reg

static const gchar* read_reg(const gchar *s, guint8 *r, int *line, GError **error)
{
	guint num = 0;

	s = skip_ws(s, line);
	if (!s || !*s) {
		g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Waiting for register name at line %d", *line);
		return NULL;
	}

	/* Special case: const */
	if (g_ascii_isxdigit(*s) && g_ascii_isxdigit(s[1]) && (s[2] == 0 || g_ascii_isspace(s[2]))) {
		num = g_ascii_xdigit_value(s[0]) * 16 + g_ascii_xdigit_value(s[1]);
		*r = num;
		s += 2;

		return skip_ws(s, line);
	}

	if (*s != 'r' && *s != 'R') {
		g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Waiting for register name at line %d", *line);
		return NULL;
	}

	++s;
	if (!g_ascii_isdigit(*s)) {
		g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Waiting for register name at line %d", *line);
		return NULL;
	}

	num = g_ascii_digit_value(*s);
	++s;
	if (g_ascii_isdigit(*s)) {
		num = num * 10 + g_ascii_digit_value(*s);
		++s;
		if (!*s || g_ascii_isspace(*s)) {
			*r = num;
			if (num > 31) {
				g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "We've got only 32 registers (at line %d)", *line);
				return NULL;
			}
			return skip_ws(s, line);
		} else {
			g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Waiting for register name at line %d", *line);
			return NULL;
		}
	} else if (!*s || g_ascii_isspace(*s)) {
		*r = num;
		return skip_ws(s, line);
	} else {
		g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Waiting for register name at line %d", *line);
		return NULL;
	}

	return NULL;
}
开发者ID:rymis,项目名称:robolang,代码行数:56,代码来源:robot_obj_file.c


示例8: next_id

/** suche den beginn des nächsten wortes 
 */
int next_id( int line, int *p)
{
  if( skip_ws(line,p) ) return -1;
  while( *p < m_len(line) )
    {
      if( isspace( CHAR(line,*p)) ) return skip_ws(line,p);
      (*p)++;
    }
  return -1;
}
开发者ID:xtforever,项目名称:xtcw,代码行数:12,代码来源:util.c


示例9: parse_header_line

static int parse_header_line( char* line, char** pkey, char** pvalue )
{
	char* s;
	char* end;
	char* key_end;
	char c;

	s = prepare_line( line, &end );
	if( *s == '\0' )
	{
		return 1;
	}

	*pkey = s;
	while( ( c = *s ) != '=' && c != ' ' && c != '\t' )
	{
		if( c == '\0' )
		{
			fprintf( stderr, "kum error: invalid header format.\n" );
			exit( 1 );			
		}

		++s;
	}

	key_end = s;
	s = (char*) skip_ws( s );
	if( key_end == *pkey || *s != '=' )
	{
		fprintf( stderr, "kum error: invalid header format.\n" );
		exit( 1 );			
	}

	*key_end = '\0';
	++s;

	s = (char*) skip_ws( s );

	if( *s != '\"' && *s != '\'' )
	{
		*pvalue = s;
	}
	else
	{
		/* Removing quotes */
		*pvalue = s + 1;
		
		if( end > *pvalue && *(end - 1) == *s )
		{
			*--end = '\0';
		}
	}
	
	return 1;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:55,代码来源:kum.c


示例10: parse_mulop

/*
 * mulop = unop * unop
 *       | unop / unop
 *       | unop % unop
 *       | unop
 */
int
parse_mulop(char **p)
{
    int val1, val2;
    int done = 0;

    skip_ws(p);
    
    val1 = parse_unop(p);

    do {
	skip_ws(p);

	switch (**p) {

	case '*':
	    (*p)++;	/* skip * */
	    val2 = parse_unop(p);
	    val1 = val1 * val2;
	    break;

	case '/':
        (*p)++;	/* skip /  */
	    val2 = parse_unop(p);
	    if (val2 == 0) {
		if (g_pass == 2)
		    error("division by zero");
		done = 1;
		break;
	    }
	    val1 = val1 / val2;
	    break;

	case '%':
        (*p)++;	/* skip / */
	    val2 = parse_unop(p);
	    if (val2 == 0) {
		if (g_pass == 2)
		    error("modulus of zero");
		done = 1;
		break;
	    }
	    val1 = val1 % val2;
	    break;

	default:
	    done = 1;
	    break;
	}
    } while (!done);

    return val1;
}
开发者ID:Reedgarden,项目名称:bcm-sdk-xgs,代码行数:59,代码来源:ledasm.c


示例11: seta_assignment

static BOOL
seta_assignment ( LPCTSTR* p_, INT* result )
{
	LPCTSTR p = *p_;
	LPTSTR ident;
	TCHAR op = 0;
	INT identlen, exprval;

	PARSE_IDENT(ident,identlen,p);
	if ( identlen )
	{
		p = skip_ws(p);
		if ( *p == _T('=') )
			op = *p, p = skip_ws(p+1);
		else if ( _tcschr ( _T("*/%+-&^|"), *p ) && p[1] == _T('=') )
			op = *p, p = skip_ws(p+2);
		else if ( _tcschr ( _T("<>"), *p ) && *p == p[1] && p[2] == _T('=') )
			op = *p, p = skip_ws(p+3);
	}

	/* allow to chain multiple assignments, such as: a=b=1 */
	if ( ident && op )
	{
		INT identval;
		LPTSTR buf;

		if ( !seta_assignment ( &p, &exprval ) )
			return FALSE;

		if ( !seta_identval ( ident, &identval ) )
			identval = 0;
		switch ( op )
		{
		case '=':
			identval = exprval;
			break;
		case '<':
			identval <<= exprval;
			break;
		case '>':
			identval >>= exprval;
			break;
		default:
			if ( !calc ( &identval, op, exprval ) )
				return FALSE;
		}
		buf = (LPTSTR)alloca ( 32 * sizeof(TCHAR) );
		_sntprintf ( buf, 32, _T("%i"), identval );
		SetEnvironmentVariable ( ident, buf ); // TODO FIXME - check return value
		exprval = identval;
	}
开发者ID:Fetchered,项目名称:ReactOS-CMD,代码行数:51,代码来源:set.c


示例12: read_data

static const gchar* read_data(const gchar *s, GByteArray *data, int *line, GError **error)
{
	unsigned char c;
	const gchar *p;

	++s;

	while (*s) {
		s = skip_ws(s, line);

		if (*s == '}') {
			++s;
			return s;
		}

		if (!g_ascii_isxdigit(*s)) {
			g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Invalid symbol at line %d `%16s'", *line, s);
			return NULL;
		}

		c = g_ascii_xdigit_value(*s) * 16;
		++s;

		if (!g_ascii_isxdigit(*s)) {
			g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Invalid symbol at line %d `%16s'", *line, s);
			return NULL;
		}

		c += g_ascii_xdigit_value(*s);
		++s;

		g_byte_array_append(data, &c, 1);

		p = skip_ws(s, line);
		if (p == s && *s != '}') {
			g_set_error(error, ROBOT_ERROR, ROBOT_ERROR_SYNTAX, "Invalid symbol at line %d `%16s'", *line, s);
			return NULL;
		}

		s = p;
	}

	c = 0;
	while (data->len % 4 != 0)
		g_byte_array_append(data, &c, 1);

	return NULL;
}
开发者ID:rymis,项目名称:robolang,代码行数:48,代码来源:robot_obj_file.c


示例13: seta_bitAndTerm

static BOOL
seta_bitAndTerm ( LPCTSTR* p_, INT* result )
{
	LPCTSTR p = *p_;
	INT lval;
	if ( !seta_logShiftTerm ( &p, &lval ) )
		return FALSE;
	while ( *p && _tcschr(_T("<>"),*p) && p[0] == p[1] )
	{
		INT rval;
		TCHAR op = *p;

		p = skip_ws ( p+2 );

		if ( !seta_logShiftTerm ( &p, &rval ) )
			return FALSE;

		switch ( op )
		{
		case '<':
			lval <<= rval;
			break;
		case '>':
			lval >>= rval;
			break;
		default:
			ConErrResPuts ( STRING_INVALID_OPERAND );
			return FALSE;
		}
	}

	*result = lval;
	*p_ = p;
	return TRUE;
}
开发者ID:Fetchered,项目名称:ReactOS-CMD,代码行数:35,代码来源:set.c


示例14: seta_ltorTerm

static BOOL
seta_ltorTerm ( LPCTSTR* p_, INT* result, LPCTSTR ops, BOOL (*subTerm)(LPCTSTR*,INT*) )
{
	LPCTSTR p = *p_;
	INT lval;
	if ( !subTerm ( &p, &lval ) )
		return FALSE;
	while ( *p && _tcschr(ops,*p) )
	{
		INT rval;
		TCHAR op = *p;

		p = skip_ws ( p+1 );

		if ( !subTerm ( &p, &rval ) )
			return FALSE;

		if ( !calc ( &lval, op, rval ) )
			return FALSE;
	}

	*result = lval;
	*p_ = p;
	return TRUE;
}
开发者ID:Fetchered,项目名称:ReactOS-CMD,代码行数:25,代码来源:set.c


示例15: seta_mulTerm

static BOOL
seta_mulTerm ( LPCTSTR* p_, INT* result )
{
	LPCTSTR p = *p_;
	TCHAR op = 0;
	INT rval;
	if ( _tcschr(_T("!~-"),*p) )
	{
		op = *p;
		p = skip_ws ( p + 1 );
	}
	if ( !seta_unaryTerm ( &p, &rval ) )
		return FALSE;
	switch ( op )
	{
	case '!':
		rval = !rval;
		break;
	case '~':
		rval = ~rval;
		break;
	case '-':
		rval = -rval;
		break;
	}

	*result = rval;
	*p_ = p;
	return TRUE;
}
开发者ID:Fetchered,项目名称:ReactOS-CMD,代码行数:30,代码来源:set.c


示例16: process_bibtexline

static char *
process_bibtexline( char *p, newstr *tag, newstr *data )
{
	p = skip_ws( p );
	p = bibtex_item( p, tag );
	p = skip_ws( p );
	if ( *p=='=' ) {
		p++;
		p = skip_ws( p );
		p = bibtex_item( p, data );
		p = skip_ws( p );
	}
	if ( *p==',' || *p=='}' || *p==')' ) p++;
	p = skip_ws( p );
	return p;
}
开发者ID:andytwoods,项目名称:xPapers,代码行数:16,代码来源:bibtexin.c


示例17: SkASSERT

const char* SkParse::FindHex(const char str[], uint32_t* value)
{
    SkASSERT(str);
    str = skip_ws(str);

    if (!is_hex(*str))
        return NULL;

    uint32_t n = 0;
    int max_digits = 8;
    int digit;

    while ((digit = to_hex(*str)) >= 0)
    {
        if (--max_digits < 0)
            return NULL;
        n = (n << 4) | digit;
        str += 1;
    }

    if (*str == 0 || is_ws(*str))
    {
        if (value)
            *value = n;
        return str;
    }
    return NULL;
}
开发者ID:0omega,项目名称:platform_external_skia,代码行数:28,代码来源:SkParse.cpp


示例18: get_line

static int
get_line(char *src, char *dst, int len)
{
	char *p;

	if (src == NULL) {
		return -1;
	}
	if (dst == NULL) {
		return -1;
	}
	if (len < 0) {
		return -1;
	}

	p = skip_ws(src); /* ignore headding spaces */

	if (p == NULL)
		return 0;

	while (*p != '\n' && *p != '\0') {
		*dst =  *p;
		dst++; p++;
	}
	*dst = '\0';

	return (p - src);
}
开发者ID:centurysys,项目名称:libarms,代码行数:28,代码来源:armsd_conf_parse.c


示例19: process_bibtexid

/* get reference name */
static char*
process_bibtexid( char *p, newstr *data )
{
	newstr tmp;
	char *start_p = p;
	newstr_init( &tmp );
	newstr_empty( data );

	while ( *p && *p!=',' ) newstr_addchar( &tmp, *p++ );
	if ( *p==',' ) p++;
	p = skip_ws( p ); /* skip ending newline/carriage return */

	if ( tmp.len ) {
		if ( strchr( tmp.data, '=' ) ) {
			/* Endnote writes bibtex files w/o fields, try to
			 * distinguish via presence of an equal sign.... if
			 * it's there, assume that it's a tag/data pair instead
			 * and roll back.
			 */
			p = start_p;
		} else {
			/* add '{' and '}' to protect from string expansion */
			newstr_addchar( data, '{' );
			newstr_strcat( data, tmp.data );
			newstr_addchar( data, '}' );
		}
	}

	newstr_free( &tmp );
	return p;
}
开发者ID:andytwoods,项目名称:xPapers,代码行数:32,代码来源:bibtexin.c


示例20: process_bibtexid

static char*
process_bibtexid( char *p, newstr *id )
{
	char *start_p = p;
	newstr tmp;

	newstr_init( &tmp );
	p = newstr_cpytodelim( &tmp, p, ",", 1 );

	if ( tmp.len ) {
		if ( strchr( tmp.data, '=' ) ) {
			/* Endnote writes bibtex files w/o fields, try to
			 * distinguish via presence of an equal sign.... if
			 * it's there, assume that it's a tag/data pair instead
			 * and roll back.
			 */
			p = start_p;
			newstr_empty( id );
		} else {
			newstr_strcpy( id, tmp.data );
		}
	} else {
		newstr_empty( id );
	}

	newstr_free( &tmp );
	return skip_ws( p );
}
开发者ID:jayvdb,项目名称:bibutils-archive,代码行数:28,代码来源:bibtexin.c



注:本文中的skip_ws函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ skipping函数代码示例发布时间:2022-05-30
下一篇:
C++ skip_whitespace函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap