Module Name: src
Committed By: rillig
Date: Sun Jan 24 09:25:17 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: externs1.h lex.c scan.l
Log Message:
lint: expand abbreviations in lexer function names
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/xlint/lint1/scan.l
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.62 src/usr.bin/xlint/lint1/externs1.h:1.63
--- src/usr.bin/xlint/lint1/externs1.h:1.62 Sat Jan 23 23:11:40 2021
+++ src/usr.bin/xlint/lint1/externs1.h Sun Jan 24 09:25:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.62 2021/01/23 23:11:40 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.63 2021/01/24 09:25:16 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -310,18 +310,18 @@ extern void outusg(const sym_t *);
* lex.c
*/
extern int lex_name(const char *, size_t);
-extern int lex_icon(const char *, size_t, int);
-extern int lex_fcon(const char *, size_t);
+extern int lex_integer_constant(const char *, size_t, int);
+extern int lex_floating_constant(const char *, size_t);
extern int lex_operator(int, op_t);
extern int lex_string(void);
-extern int lex_wcstrg(void);
-extern int lex_ccon(void);
-extern int lex_wccon(void);
+extern int lex_wide_string(void);
+extern int lex_character_constant(void);
+extern int lex_wide_character_constant(void);
extern void lex_directive(const char *);
-extern void lex_incline(void);
+extern void lex_next_line(void);
extern void lex_comment(void);
-extern void lex_slashslashcomment(void);
-extern void lex_badchar(int);
+extern void lex_slash_slash_comment(void);
+extern void lex_unknown_character(int);
extern int lex_input(void);
/*
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.5 src/usr.bin/xlint/lint1/lex.c:1.6
--- src/usr.bin/xlint/lint1/lex.c:1.5 Sun Jan 24 07:58:48 2021
+++ src/usr.bin/xlint/lint1/lex.c Sun Jan 24 09:25:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.5 2021/01/24 07:58:48 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.6 2021/01/24 09:25:16 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.5 2021/01/24 07:58:48 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.6 2021/01/24 09:25:16 rillig Exp $");
#endif
#include <ctype.h>
@@ -75,10 +75,10 @@ static int inpc(void);
static int hash(const char *);
static sym_t * search(sbuf_t *);
static int keyw(sym_t *);
-static int getescc(int);
+static int get_escaped_char(int);
void
-lex_incline(void)
+lex_next_line(void)
{
curr_pos.p_line++;
curr_pos.p_uniq = 0;
@@ -92,7 +92,7 @@ lex_incline(void)
}
void
-lex_badchar(int c)
+lex_unknown_character(int c)
{
/* unknown character \%o */
@@ -362,7 +362,7 @@ inpc(void)
int c;
if ((c = lex_input()) != EOF && (c &= CHAR_MASK) == '\n')
- lex_incline();
+ lex_next_line();
return c;
}
@@ -470,7 +470,7 @@ keyw(sym_t *sym)
* The value is returned in yylval. icon() (and yylex()) returns T_CON.
*/
int
-lex_icon(const char *yytext, size_t yyleng, int base)
+lex_integer_constant(const char *yytext, size_t yyleng, int base)
{
int l_suffix, u_suffix;
int len;
@@ -711,7 +711,7 @@ xsign(int64_t q, tspec_t t, int len)
* long double which are greater than DBL_MAX.
*/
int
-lex_fcon(const char *yytext, size_t yyleng)
+lex_floating_constant(const char *yytext, size_t yyleng)
{
const char *cp;
int len;
@@ -799,7 +799,7 @@ lex_operator(int t, op_t o)
* Called if lex found a leading \'.
*/
int
-lex_ccon(void)
+lex_character_constant(void)
{
size_t n;
int val, c;
@@ -807,7 +807,7 @@ lex_ccon(void)
n = 0;
val = 0;
- while ((c = getescc('\'')) >= 0) {
+ while ((c = get_escaped_char('\'')) >= 0) {
val = (val << CHAR_SIZE) + c;
n++;
}
@@ -842,7 +842,7 @@ lex_ccon(void)
* Called if lex found a leading L\'
*/
int
-lex_wccon(void)
+lex_wide_character_constant(void)
{
static char buf[MB_LEN_MAX + 1];
size_t i;
@@ -850,7 +850,7 @@ lex_wccon(void)
wchar_t wc;
i = 0;
- while ((c = getescc('\'')) >= 0) {
+ while ((c = get_escaped_char('\'')) >= 0) {
if (i < MB_CUR_MAX)
buf[i] = (char)c;
i++;
@@ -896,7 +896,7 @@ lex_wccon(void)
* -2 if the EOF is reached, and the character otherwise.
*/
static int
-getescc(int delim)
+get_escaped_char(int delim)
{
static int pbc = -1;
int n, c, v;
@@ -1006,7 +1006,7 @@ getescc(int delim)
}
return v;
case '\n':
- return getescc(delim);
+ return get_escaped_char(delim);
case EOF:
return -2;
default:
@@ -1228,7 +1228,7 @@ skip_rest:
* Handle // style comments
*/
void
-lex_slashslashcomment(void)
+lex_slash_slash_comment(void)
{
int c;
@@ -1272,7 +1272,7 @@ lex_string(void)
s = xmalloc(max = 64);
len = 0;
- while ((c = getescc('"')) >= 0) {
+ while ((c = get_escaped_char('"')) >= 0) {
/* +1 to reserve space for a trailing NUL character */
if (len + 1 == max)
s = xrealloc(s, max *= 2);
@@ -1293,7 +1293,7 @@ lex_string(void)
}
int
-lex_wcstrg(void)
+lex_wide_string(void)
{
char *s;
int c, n;
@@ -1304,7 +1304,7 @@ lex_wcstrg(void)
s = xmalloc(max = 64);
len = 0;
- while ((c = getescc('"')) >= 0) {
+ while ((c = get_escaped_char('"')) >= 0) {
/* +1 to save space for a trailing NUL character */
if (len + 1 >= max)
s = xrealloc(s, max *= 2);
Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.130 src/usr.bin/xlint/lint1/scan.l:1.131
--- src/usr.bin/xlint/lint1/scan.l:1.130 Sat Jan 23 17:58:03 2021
+++ src/usr.bin/xlint/lint1/scan.l Sun Jan 24 09:25:16 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: scan.l,v 1.130 2021/01/23 17:58:03 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.131 2021/01/24 09:25:16 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.130 2021/01/23 17:58:03 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.131 2021/01/24 09:25:16 rillig Exp $");
#endif
#include "lint1.h"
@@ -59,15 +59,15 @@ TL ([fFlL]?[i]?)
%%
{L}({L}|{D})* return lex_name(yytext, yyleng);
-0[bB]{BD}+[lLuU]* return lex_icon(yytext, yyleng, 2);
-0{OD}*[lLuU]* return lex_icon(yytext, yyleng, 8);
-{NZD}{D}*[lLuU]* return lex_icon(yytext, yyleng, 10);
-0[xX]{HD}+[lLuU]* return lex_icon(yytext, yyleng, 16);
+0[bB]{BD}+[lLuU]* return lex_integer_constant(yytext, yyleng, 2);
+0{OD}*[lLuU]* return lex_integer_constant(yytext, yyleng, 8);
+{NZD}{D}*[lLuU]* return lex_integer_constant(yytext, yyleng, 10);
+0[xX]{HD}+[lLuU]* return lex_integer_constant(yytext, yyleng, 16);
{D}+\.{D}*{EX}?{TL} |
{D}+{EX}{TL} |
0[xX]{HD}+\.{HD}*{HX}{TL} |
0[xX]{HD}+{HX}{TL} |
-\.{D}+{EX}?{TL} return lex_fcon(yytext, yyleng);
+\.{D}+{EX}?{TL} return lex_floating_constant(yytext, yyleng);
"=" return lex_operator(T_ASSIGN, NOOP);
"*=" return lex_operator(T_OPASSIGN, MULASS);
"/=" return lex_operator(T_OPASSIGN, DIVASS);
@@ -104,7 +104,7 @@ TL ([fFlL]?[i]?)
"!" return lex_operator(T_UNARY, NOT);
"~" return lex_operator(T_UNARY, COMPL);
"\"" return lex_string();
-"L\"" return lex_wcstrg();
+"L\"" return lex_wide_string();
";" return T_SEMI;
"{" return T_LBRACE;
"}" return T_RBRACE;
@@ -116,14 +116,14 @@ TL ([fFlL]?[i]?)
"(" return T_LPAREN;
")" return T_RPAREN;
"..." return T_ELLIPSIS;
-"'" return lex_ccon();
-"L'" return lex_wccon();
+"'" return lex_character_constant();
+"L'" return lex_wide_character_constant();
^#.*$ lex_directive(yytext);
-\n lex_incline();
+\n lex_next_line();
\t|" "|\f|\v ;
"/*" lex_comment();
-"//" lex_slashslashcomment();
-. lex_badchar(yytext[0]);
+"//" lex_slash_slash_comment();
+. lex_unknown_character(yytext[0]);
%%