tests/indent: add skeletons for testing tokens and parser symbols
The constants that were previously defined in indent_codes.h were a wild mixture of tokens from the lexer and symbols on the parser stack. They were split into separate types starting at indent.h 1.49 from 2021-10-25 and finishing at 1.73 from 2021-10-31. To match the tests with the new token names, the old tests need to be migrated to the newly added tests. This will take some time so first add the skeletons and migrate them in smaller steps, cleaning them up and extending them on the way.
This commit is contained in:
parent
796d49a188
commit
9ae26de163
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1167 2021/11/18 18:14:47 rillig Exp $
|
||||
# $NetBSD: mi,v 1.1168 2021/11/18 21:19:18 rillig Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -4797,6 +4797,41 @@
|
|||
./usr/tests/usr.bin/indent/lineno.0.stdout tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/list_head.0 tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/list_head.0.stdout tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/lsym_binary_op.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_case_label.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_colon.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_comma.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_comment.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_do.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_else.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_eof.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_for.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_form_feed.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_funcname.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_if.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_lbrace.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_lparen_or_lbracket.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_newline.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_offsetof.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_period.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_postfix_op.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_preprocessing.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_question.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_rbrace.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_return.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_rparen_or_rbracket.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_semicolon.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_sizeof.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_storage_class.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_string_prefix.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_switch.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_tag.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_type_in_parentheses.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_type_outside_parentheses.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_typedef.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_unary_op.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_while.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/lsym_word.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/ncs.0 tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/ncs.0.pro tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/ncs.0.stdout tests-obsolete obsolete,atf
|
||||
|
@ -5068,6 +5103,21 @@
|
|||
./usr/tests/usr.bin/indent/ps_ind_level.0.pro tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/ps_ind_level.0.stdout tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/ps_ind_level.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_decl.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_do.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_do_stmt.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_else.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_for_exprs.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_if_expr.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_if_expr_stmt.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_if_expr_stmt_else.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_lbrace.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_rbrace.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_semicolon.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_stmt.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_stmt_list.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_switch_expr.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/psym_while_expr.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/indent/struct.0 tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/struct.0.stdout tests-obsolete obsolete,atf
|
||||
./usr/tests/usr.bin/indent/surplusbad.0 tests-obsolete obsolete,atf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.33 2021/10/23 21:45:14 rillig Exp $
|
||||
# $NetBSD: Makefile,v 1.34 2021/11/18 21:19:19 rillig Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -8,15 +8,50 @@ TESTS_SH+= t_misc
|
|||
TESTS_SH+= t_options
|
||||
|
||||
FILESDIR= ${TESTSDIR}
|
||||
FILES= fmt_block.c
|
||||
FILES+= fmt_block.c
|
||||
FILES+= fmt_decl.c
|
||||
FILES+= fmt_else_comment.c
|
||||
FILES+= fmt_expr.c
|
||||
FILES+= indent_off_on.c
|
||||
FILES+= label.c
|
||||
FILES+= lex_ident.c
|
||||
FILES+= lex_char.c
|
||||
FILES+= lex_ident.c
|
||||
FILES+= lex_string.c
|
||||
FILES+= lsym_binary_op.c
|
||||
FILES+= lsym_case_label.c
|
||||
FILES+= lsym_colon.c
|
||||
FILES+= lsym_comma.c
|
||||
FILES+= lsym_comment.c
|
||||
FILES+= lsym_do.c
|
||||
FILES+= lsym_else.c
|
||||
FILES+= lsym_eof.c
|
||||
FILES+= lsym_for.c
|
||||
FILES+= lsym_form_feed.c
|
||||
FILES+= lsym_funcname.c
|
||||
FILES+= lsym_if.c
|
||||
FILES+= lsym_lbrace.c
|
||||
FILES+= lsym_lparen_or_lbracket.c
|
||||
FILES+= lsym_newline.c
|
||||
FILES+= lsym_offsetof.c
|
||||
FILES+= lsym_period.c
|
||||
FILES+= lsym_postfix_op.c
|
||||
FILES+= lsym_preprocessing.c
|
||||
FILES+= lsym_question.c
|
||||
FILES+= lsym_rbrace.c
|
||||
FILES+= lsym_return.c
|
||||
FILES+= lsym_rparen_or_rbracket.c
|
||||
FILES+= lsym_semicolon.c
|
||||
FILES+= lsym_sizeof.c
|
||||
FILES+= lsym_storage_class.c
|
||||
FILES+= lsym_string_prefix.c
|
||||
FILES+= lsym_switch.c
|
||||
FILES+= lsym_tag.c
|
||||
FILES+= lsym_type_in_parentheses.c
|
||||
FILES+= lsym_type_outside_parentheses.c
|
||||
FILES+= lsym_typedef.c
|
||||
FILES+= lsym_unary_op.c
|
||||
FILES+= lsym_while.c
|
||||
FILES+= lsym_word.c
|
||||
FILES+= opt_P.c
|
||||
FILES+= opt_T.c
|
||||
FILES+= opt_bacc.c
|
||||
|
@ -60,6 +95,21 @@ FILES+= opt_ut.c
|
|||
FILES+= opt_v.c
|
||||
FILES+= opt_version.c
|
||||
FILES+= ps_ind_level.c
|
||||
FILES+= psym_decl.c
|
||||
FILES+= psym_do.c
|
||||
FILES+= psym_do_stmt.c
|
||||
FILES+= psym_else.c
|
||||
FILES+= psym_for_exprs.c
|
||||
FILES+= psym_if_expr.c
|
||||
FILES+= psym_if_expr_stmt.c
|
||||
FILES+= psym_if_expr_stmt_else.c
|
||||
FILES+= psym_lbrace.c
|
||||
FILES+= psym_rbrace.c
|
||||
FILES+= psym_semicolon.c
|
||||
FILES+= psym_stmt.c
|
||||
FILES+= psym_stmt_list.c
|
||||
FILES+= psym_switch_expr.c
|
||||
FILES+= psym_while_expr.c
|
||||
FILES+= t_options.awk
|
||||
FILES+= token_binary_op.c
|
||||
FILES+= token_case_label.c
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* $NetBSD: lsym_binary_op.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_binary_op, which represents a binary operator in
|
||||
* an expression. Examples for binary operators are '>>', '=', '+', '&&'.
|
||||
*
|
||||
* Binary operators are surrounded by blanks.
|
||||
*
|
||||
* Some tokens like '+', '*' or '&' can be either binary or unary operators,
|
||||
* with an entirely different meaning.
|
||||
*
|
||||
* The token '*' is not only a binary or a unary operator, it is used in types
|
||||
* as well, to derive a pointer type.
|
||||
*
|
||||
* See also:
|
||||
* lsym_postfix_op.c for postfix unary operators
|
||||
* lsym_unary_op.c for prefix unary operators
|
||||
* lsym_colon.c for ':'
|
||||
* lsym_question.c for '?'
|
||||
* lsym_comma.c for ','
|
||||
* C99 6.4.6 "Punctuators"
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,22 @@
|
|||
/* $NetBSD: lsym_case_label.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_case_label, which represents either the keyword
|
||||
* 'case' or the keyword 'default', which are both used in 'switch'
|
||||
* statements.
|
||||
*
|
||||
* Since C11, the keyword 'default' is used in _Generic selections as well.
|
||||
*
|
||||
* See also:
|
||||
* psym_switch_expr.c
|
||||
* C11 6.5.1.1 "Generic selection"
|
||||
*/
|
||||
|
||||
// TODO: test C11 _Generic
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,20 @@
|
|||
/* $NetBSD: lsym_colon.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_colon, which represents a ':' in these contexts:
|
||||
*
|
||||
* After a label that is the target of a 'goto' statement.
|
||||
*
|
||||
* In a 'switch' statement, after a 'case' label or a 'default' label.
|
||||
*
|
||||
* As part of the conditional operator '?:'.
|
||||
*
|
||||
* In the declaration of a struct member that is a bit-field.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,29 @@
|
|||
/* $NetBSD: lsym_comma.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_comma, which represents a ',' in these contexts:
|
||||
*
|
||||
* In an expression, the binary operator ',' evaluates its left operand before
|
||||
* its right operand, inserting a sequence point.
|
||||
*
|
||||
* In a parameter list of a function type, a ',' separates the parameter
|
||||
* declarations.
|
||||
*
|
||||
* In a traditional function definition, a ',' separates the parameter names.
|
||||
*
|
||||
* In a prototype function definition, a ',' separates the parameter
|
||||
* declarations.
|
||||
*
|
||||
* In a function call expression, a ',' separates the arguments.
|
||||
*
|
||||
* In a macro definition, a ',' separates the parameter names.
|
||||
*
|
||||
* In a macro invocation, a ',' separates the arguments.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,19 @@
|
|||
/* $NetBSD: lsym_comment.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_comment, which starts a comment.
|
||||
*
|
||||
* C11 distinguishes block comments and end-of-line comments. Indent further
|
||||
* distinguishes box comments that are a special kind of block comments.
|
||||
*
|
||||
* See also:
|
||||
* opt_fc1.c
|
||||
* token_comment.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,19 @@
|
|||
/* $NetBSD: lsym_do.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_do, which represents the keyword 'do' that starts
|
||||
* a 'do-while' loop.
|
||||
*
|
||||
* See also:
|
||||
* psym_do.c
|
||||
* psym_do_stmt.c
|
||||
* C11 6.8.5 "Iteration statements"
|
||||
* C11 6.8.5.2 "The 'do' statement"
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_else.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_else, which represents the keyword 'else' in an
|
||||
* 'if-else' statement.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,12 @@
|
|||
/* $NetBSD: lsym_eof.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_eof, which represents the end of the input file.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_for.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_for, which represents the keyword 'for' that
|
||||
* starts a 'for' loop.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: lsym_form_feed.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_form_feed, which represents a form feed, a special
|
||||
* kind of whitespace that is seldom used. If it is used, it usually appears
|
||||
* on a line of its own, after an external-declaration, to force a page break
|
||||
* when printing the source code on actual paper.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: lsym_funcname.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_funcname, which is an identifier that is followed
|
||||
* by an opening parenthesis.
|
||||
*
|
||||
* See also:
|
||||
* lsym_word.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_if.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_if, which represents the keyword 'if' that starts
|
||||
* an 'if' or 'if-else' statement.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,20 @@
|
|||
/* $NetBSD: lsym_lbrace.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_lbrace, which represents a '{' in these contexts:
|
||||
*
|
||||
* In an initializer, '{' starts an inner group of initializers, usually to
|
||||
* initialize a nested struct, union or array.
|
||||
*
|
||||
* In a function body, '{' starts a block.
|
||||
*
|
||||
* In an expression, '(type){' starts a compound expression that is typically
|
||||
* used in an assignment to a struct or array.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,28 @@
|
|||
/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '['
|
||||
* in these contexts:
|
||||
*
|
||||
* In a type name, '(' constructs a function type.
|
||||
*
|
||||
* In an expression, '(' starts an inner expression to override the usual
|
||||
* operator precedence.
|
||||
*
|
||||
* In an expression, an identifier followed by '(' starts a function call
|
||||
* expression.
|
||||
*
|
||||
* In a 'sizeof' expression, '(' is required if the argument is a type name.
|
||||
*
|
||||
* After one of the keywords 'for', 'if', 'switch' or 'while', the controlling
|
||||
* expression must be enclosed in '(' and ')'.
|
||||
*
|
||||
* In an expression, '(' followed by a type name starts a cast expression.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,18 @@
|
|||
/* $NetBSD: lsym_newline.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_newline, which represents a forced line break in
|
||||
* the source code.
|
||||
*
|
||||
* Indent preserves most of the line breaks from the original code.
|
||||
*
|
||||
* See also:
|
||||
* lsym_form_feed.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_offsetof.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_offsetof, which represents the keyword 'offsetof'
|
||||
* that starts an expression for computing the offset of a member in a struct.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,23 @@
|
|||
/* $NetBSD: lsym_period.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_period, which represents '.' in these contexts:
|
||||
*
|
||||
* In an initializer, '.' starts a named designator (since C99).
|
||||
*
|
||||
* In an expression, 'sou.member' accesses the member 'member' in the struct
|
||||
* or union 'sou'.
|
||||
*
|
||||
* In a function prototype declaration, the sequence '.' '.' '.' marks the
|
||||
* start of a variable number of arguments.
|
||||
*
|
||||
* See also:
|
||||
* lsym_word.c for '.' inside numeric constants
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: lsym_postfix_op.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_postfix_op, which represents the operators '++'
|
||||
* and '--' for incrementing and decrementing a variable.
|
||||
*
|
||||
* See also:
|
||||
* lsym_unary_op.c for the corresponding prefix operators
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,20 @@
|
|||
/* $NetBSD: lsym_preprocessing.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_preprocessing, which represents a '#' that starts
|
||||
* a preprocessing line.
|
||||
*
|
||||
* The whole preprocessing line is processed separately from the main source
|
||||
* code, without much tokenizing or parsing.
|
||||
*/
|
||||
|
||||
// TODO: test '#' in the middle of a non-preprocessing line
|
||||
// TODO: test stringify '#'
|
||||
// TODO: test token paste '##'
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_question.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_question, which represents the '?' in a '?:'
|
||||
* conditional expression.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: lsym_rbrace.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_rbrace, which represents '}', the counterpart to
|
||||
* '{'.
|
||||
*
|
||||
* See also:
|
||||
* lsym_lbrace.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_return.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_return, which represents the keyword 'return' that
|
||||
* starts a 'return' statement for leaving the execution of a function.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: lsym_rparen_or_rbracket.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_rparen_or_lbracket, which represents ')' or ']',
|
||||
* the counterparts for '(' and '['.
|
||||
*
|
||||
* See also:
|
||||
* lsym_lparen_or_lbracket.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,19 @@
|
|||
/* $NetBSD: lsym_semicolon.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_semicolon, which represents ';' in these contexts:
|
||||
*
|
||||
* In a declaration, ';' finishes the declaration.
|
||||
*
|
||||
* In a statement, ';' finishes the statement.
|
||||
*
|
||||
* In a 'for' statement, ';' separates the 3 expressions in the head of the
|
||||
* 'for' statement.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,17 @@
|
|||
/* $NetBSD: lsym_sizeof.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_sizeof, which represents the keyword 'sizeof' for
|
||||
* determining the memory size of an object or a type.
|
||||
*
|
||||
* See also:
|
||||
* opt_bs.c "blank after sizeof"
|
||||
* C11 6.5.3.4 "The 'sizeof' and '_Alignof' operators"
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_storage_class.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_storage_class, which represents a storage class as
|
||||
* part of a declaration.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,18 @@
|
|||
/* $NetBSD: lsym_string_prefix.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_string_prefix, which represents the prefix 'L' for
|
||||
* string literals of type wchar_t.
|
||||
*
|
||||
* TODO: Try to merge this token into lsym_word.
|
||||
*
|
||||
* See also:
|
||||
* lsym_word.c for string literals
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,17 @@
|
|||
/* $NetBSD: lsym_switch.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_switch, which represents the keyword 'switch' that
|
||||
* starts a 'switch' statement.
|
||||
*
|
||||
* See also:
|
||||
* C11 6.8.4 "Selection statements"
|
||||
* C11 6.8.4.2 "The 'switch' statement"
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_tag.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_tag, which represents one of the keywords
|
||||
* 'struct', 'union' or 'enum' that declare, define or use a tagged type.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,19 @@
|
|||
/* $NetBSD: lsym_type_in_parentheses.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_token_in_parentheses, which represents a type name
|
||||
* inside parentheses in the following contexts:
|
||||
*
|
||||
* As part of a parameter list of a function prototype.
|
||||
*
|
||||
* In a cast expression.
|
||||
*
|
||||
* In a compound expression (since C99).
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: lsym_type_outside_parentheses.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_type_outside_parentheses, which represents a type
|
||||
* name outside parentheses, such as in a declaration that is not for a
|
||||
* function.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_typedef.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_typedef, which represents the keyword 'typedef'
|
||||
* for giving a type an additional name.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,18 @@
|
|||
/* $NetBSD: lsym_unary_op.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_unary_op, which represents a unary operator.
|
||||
*
|
||||
* In an expression, a unary operator is written without blank next to its
|
||||
* argument.
|
||||
*
|
||||
* In a type name, the "unary operator" '*' represents the derivation of a
|
||||
* pointer type.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: lsym_while.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token 'lsym_while', which represents the keyword 'while' that
|
||||
* starts a 'while' loop or finishes a 'do-while' loop.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,20 @@
|
|||
/* $NetBSD: lsym_word.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_word, which represents a constant, a string
|
||||
* literal or an identifier.
|
||||
*
|
||||
* See also:
|
||||
* lsym_funcname.c for an identifier followed by '('
|
||||
*/
|
||||
|
||||
// TODO: Is '"string"(' syntactically valid in any context?
|
||||
// TODO: Is '123(' syntactically valid in any context?
|
||||
// TODO: Would the output of the above depend on -pcs/-npcs?
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,19 @@
|
|||
/* $NetBSD: psym_decl.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_decl, which represents a declaration.
|
||||
*
|
||||
* Since C99, declarations and statements can be mixed in blocks.
|
||||
*
|
||||
* A label can be followed by a statement but not by a declaration.
|
||||
*/
|
||||
|
||||
// TODO: prove that psym_decl can only ever occur at the top of the stack.
|
||||
// TODO: delete decl_level if the above is proven.
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: psym_do.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_do, which represents the state after
|
||||
* reading the token 'do', now waiting for the statement of the loop body.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: psym_do_stmt.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_do_stmt, which represents the state after
|
||||
* reading the keyword 'do' and the loop body, now waiting for the keyword
|
||||
* 'while' and the controlling expression.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: psym_else.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_else, which represents the keyword 'else'
|
||||
* that is being shifted on the parser stack.
|
||||
*
|
||||
* This parser symbol never ends up on the stack itself.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: psym_for_exprs.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser state psym_for_exprs, which represents the state after
|
||||
* reading the keyword 'for' and the 3 expressions, now waiting for the body
|
||||
* of the loop.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: psym_if_expr.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_if_expr, representing the parser state
|
||||
* after reading the keyword 'if' and the controlling expression, now waiting
|
||||
* for the statement of the 'then' branch.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: psym_if_expr_stmt.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_if_expr_stmt, which represents the state
|
||||
* after reading the keyword 'if', the controlling expression and the
|
||||
* statement for the 'then' branch. If the next token is 'else', another
|
||||
* statement will follow, otherwise the 'if' statement is finished already.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: psym_if_expr_stmt_else.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_if_expr_stmt_else, which represents the
|
||||
* parser state after reading the keyword 'if', the controlling expression,
|
||||
* the statement of the 'then' branch and the keyword 'else'. If the next
|
||||
* token is an 'if', the formatting depends on the option '-ei' or '-nei'. In
|
||||
* all other situations, the next statement will finish the 'if' statement.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,17 @@
|
|||
/* $NetBSD: psym_lbrace.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_lbrace, which represents a '{'.
|
||||
*
|
||||
* TODO: could this be a '{' from an initializer as well?
|
||||
*
|
||||
* See also:
|
||||
* psym_rbrace.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: psym_rbrace.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_rbrace, which represents '}' and finishes
|
||||
* the previous '{'.
|
||||
*
|
||||
* See also:
|
||||
* psym_lbrace.c
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: psym_semicolon.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_semicolon, which pushes a new statement on
|
||||
* the stack.
|
||||
*
|
||||
* This token is never stored on the stack itself.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: psym_stmt.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_stmt, which represents a statement on the
|
||||
* stack.
|
||||
*
|
||||
* TODO: Explain why the stack contains 'lbrace' 'stmt' instead of only 'lbrace'.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,15 @@
|
|||
/* $NetBSD: psym_stmt_list.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_stmt_list, which represents a list of
|
||||
* statements.
|
||||
*
|
||||
* TODO: explain why psym_stmt and psym_stmt_list are both necessary.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: psym_switch_expr.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_switch_expr, which represents the keyword
|
||||
* 'switch' followed by the controlling expression, now waiting for a
|
||||
* statement (usually a block) containing the 'case' labels.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: psym_while_expr.c,v 1.1 2021/11/18 21:19:19 rillig Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Tests for the parser symbol psym_while_expr, which represents the keyword
|
||||
* 'while' followed by the controlling expression, now waiting for the
|
||||
* statement of the loop body.
|
||||
*/
|
||||
|
||||
#indent input
|
||||
// TODO: add input
|
||||
#indent end
|
||||
|
||||
#indent run-equals-input
|
Loading…
Reference in New Issue