Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: expand abbreviations in lexer func...
details: https://anonhg.NetBSD.org/src/rev/5ac01429957e
branches: trunk
changeset: 950283:5ac01429957e
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 24 09:25:16 2021 +0000
description:
lint: expand abbreviations in lexer function names
No functional change.
diffstat:
usr.bin/xlint/lint1/externs1.h | 18 +++++++++---------
usr.bin/xlint/lint1/lex.c | 36 ++++++++++++++++++------------------
usr.bin/xlint/lint1/scan.l | 26 +++++++++++++-------------
3 files changed, 40 insertions(+), 40 deletions(-)
diffs (262 lines):
diff -r c86c5c310332 -r 5ac01429957e usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Sun Jan 24 09:18:42 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Sun Jan 24 09:25:16 2021 +0000
@@ -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 @@
* 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);
/*
diff -r c86c5c310332 -r 5ac01429957e usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Jan 24 09:18:42 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Jan 24 09:25:16 2021 +0000
@@ -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 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 @@
}
void
-lex_badchar(int c)
+lex_unknown_character(int c)
{
/* unknown character \%o */
@@ -362,7 +362,7 @@
int c;
if ((c = lex_input()) != EOF && (c &= CHAR_MASK) == '\n')
- lex_incline();
+ lex_next_line();
return c;
}
@@ -470,7 +470,7 @@
* 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 @@
* 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 @@
* Called if lex found a leading \'.
*/
int
-lex_ccon(void)
+lex_character_constant(void)
{
size_t n;
int val, c;
@@ -807,7 +807,7 @@
n = 0;
val = 0;
- while ((c = getescc('\'')) >= 0) {
+ while ((c = get_escaped_char('\'')) >= 0) {
val = (val << CHAR_SIZE) + c;
n++;
}
@@ -842,7 +842,7 @@
* 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 @@
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 @@
* -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 @@
}
return v;
case '\n':
- return getescc(delim);
+ return get_escaped_char(delim);
case EOF:
return -2;
default:
@@ -1228,7 +1228,7 @@
* Handle // style comments
*/
void
-lex_slashslashcomment(void)
+lex_slash_slash_comment(void)
{
int c;
@@ -1272,7 +1272,7 @@
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 @@
}
int
-lex_wcstrg(void)
+lex_wide_string(void)
{
char *s;
int c, n;
@@ -1304,7 +1304,7 @@
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);
diff -r c86c5c310332 -r 5ac01429957e usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l Sun Jan 24 09:18:42 2021 +0000
+++ b/usr.bin/xlint/lint1/scan.l Sun Jan 24 09:25:16 2021 +0000
@@ -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 @@
%%
{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 @@
"!" 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 @@
"(" 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]);
%%
Home |
Main Index |
Thread Index |
Old Index