FreeBSD/contrib/bsnmp/gensnmptree/gensnmptree.c
/*
 * Parse a top level element. Return the tree if it was a tree, NULL
 * otherwise.
 */
Parse a top level element. Return the tree if it was a tree, NULL
otherwise.
Parse a top level element . Return the tree if it was a tree NULL otherwise .
static struct node *
parse_top(enum tok tok)
{
	struct type *t;
	if (tok == '(')
		return (parse(tok));
	if (tok == TOK_TYPEDEF) {
		if (gettoken() != TOK_STR)
			report("type name expected after typedef");
		t = make_type(str);
		tok = gettoken();
		t->is_enum = (tok == TOK_ENUM);
		t->is_bits = (tok == TOK_BITS);
		t->syntax = parse_type(&tok, t, NULL);
		pushback(tok);
		return (NULL);
	}
	if (tok == TOK_INCLUDE) {
		if (gettoken() != TOK_FILENAME)
			report("filename expected in include directive");
		input_fopen(str, val);
		return (NULL);
	}
	report("'(' or 'typedef' expected");
}
static struct node * parse_top ( enum tok tok ) { struct type * t ; if ( tok == ' ' ) return ( parse ( tok ) ) ; if ( tok == TOK_TYPEDEF ) { if ( gettoken ( ) != TOK_STR ) report ( " " ) ; t = make_type ( str ) ; tok = gettoken ( ) ; t -> is_enum = ( tok == TOK_ENUM ) ; t -> is_bits = ( tok == TOK_BITS ) ; t -> syntax = parse_type ( & tok , t , NULL ) ; pushback ( tok ) ; return ( NULL ) ; } if ( tok == TOK_INCLUDE ) { if ( gettoken ( ) != TOK_FILENAME ) report ( " " ) ; input_fopen ( str , val ) ; return ( NULL ) ; } report ( " " ) ; }
Parse a top level element.
Parse a top level element .