Module Name:    src
Committed By:   rillig
Date:           Sun Feb  7 11:52:43 UTC 2021

Modified Files:
        src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: indent lexer code consistently

Several of the braces were misaligned.  For the simple keywords, there
is no need to write these braces at all, they only made the code look
more complicated than it really is.

I stumbled upon this because syntax errors in the test cases currently
let the test case succeed instead of fail, which is another ingredient
for unreliable tests, besides the loose output matching.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.9 src/tests/lib/libcurses/director/testlang_conf.l:1.10
--- src/tests/lib/libcurses/director/testlang_conf.l:1.9	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 11:52:43 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.9 2020/10/24 04:46:17 blymn Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.10 2021/02/07 11:52:43 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn <bl...@netbsd.org>
@@ -172,8 +172,8 @@ MULTIPLIER	\*
 
 include		BEGIN(incl);
 
-<incl>[ \t]*      /* eat the whitespace */
-<incl>[^ \t\n]+   { /* got the include file name */
+<incl>[ \t]*	/* eat the whitespace */
+<incl>[^ \t\n]+ { /* got the include file name */
 		char inc_file[MAXPATHLEN];
 
 		if (include_ptr > MAX_INCLUDES) {
@@ -218,10 +218,8 @@ include		BEGIN(incl);
 <<EOF>>	{
 		yypop_buffer_state();
 
-		if ( !YY_CURRENT_BUFFER )
-		{
+		if (!YY_CURRENT_BUFFER)
 			yyterminate();
-		}
 
 		if (--include_ptr < 0)
 			err(2, "Include stack underflow");
@@ -231,97 +229,29 @@ include		BEGIN(incl);
 		line = include_stack[include_ptr];
 	}
 
-{ASSIGN}	{
-			return ASSIGN;
-		}
-
-{CALL2}		{
-			return CALL2;
-		}
-
-{CALL3}		{
-			return CALL3;
-		}
-
-{CALL4}		{
-			return CALL4;
-		}
-
-{CALL}		{
-			return CALL;
-		}
-
-{CHECK}		{
-			return CHECK;
-		}
-
-{DELAY}		{
-			return DELAY;
-		}
-
-{INPUT}		{
-			return INPUT;
-		}
-
-{NOINPUT}		{
-			return NOINPUT;
-		}
-
-{COMPARE}	{
-			return COMPARE;
-		}
-
-{COMPAREND}	{
-			return COMPAREND;
-		}
-
-{NON_NULL}	{
-			return NON_NULL;
-		}
-
-{NULL_RET}		{
-			return NULL_RET;
-		}
-
-{OK_RET}		{
-			return OK_RET;
-		}
-
-{ERR_RET}		{
-			return ERR_RET;
-		}
-
-{MULTIPLIER}	{
-			return MULTIPLIER;
-		}
-
-{CCHAR}		{
-			return CCHAR;
-		}
-
-{WCHAR}		{
-			return WCHAR;
-		}
-
-{OR}		{
-			return OR;
-		}
-
-{LHB}		{
-			return LHB;
-		}
-
-{RHB}		{
-			return RHB;
-		}
-
-{LHSB}		{
-			return LHSB;
-		}
-
-{RHSB}		{
-			return RHSB;
-		}
+{ASSIGN}	return ASSIGN;
+{CALL2}		return CALL2;
+{CALL3}		return CALL3;
+{CALL4}		return CALL4;
+{CALL}		return CALL;
+{CHECK}		return CHECK;
+{DELAY}		return DELAY;
+{INPUT}		return INPUT;
+{NOINPUT}	return NOINPUT;
+{COMPARE}	return COMPARE;
+{COMPAREND}	return COMPAREND;
+{NON_NULL}	return NON_NULL;
+{NULL_RET}	return NULL_RET;
+{OK_RET}	return OK_RET;
+{ERR_RET}	return ERR_RET;
+{MULTIPLIER}	return MULTIPLIER;
+{CCHAR}		return CCHAR;
+{WCHAR}		return WCHAR;
+{OR}		return OR;
+{LHB}		return LHB;
+{RHB}		return RHB;
+{LHSB}		return LHSB;
+{RHSB}		return RHSB;
 
 {HEX}		{
 			/* Hex value, convert to decimal and return numeric */
@@ -334,12 +264,11 @@ include		BEGIN(incl);
 			return numeric;
 		}
 
-
-{numeric}		{
+{numeric}	{
 			if ((yylval.string = strdup(yytext)) == NULL)
 				err(1, "Cannot allocate numeric string");
 			return numeric;
-}
+		}
 
 {VARNAME}	{
 			if ((yylval.string = strdup(yytext)) == NULL)
@@ -434,15 +363,14 @@ include		BEGIN(incl);
 				err(1, "Cannot allocate string for varname");
 			return VARIABLE;
 		}
-	
+
 	/* comments, white-outs */
 [ \t\r]		|
 #.*		;
 ^#.*\n		|
 #.*\n		|
 \\\n		|
-^\n		{ 
-line++; }
+^\n		line++;
 
 	/* eol on a line with data. need to process, return eol */
 \n		{
@@ -451,6 +379,7 @@ line++; }
 		}
 
 .		{
+			/* FIXME: report syntax error */
 		}
 
 %%

Reply via email to