mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-21 19:51:45 +00:00
parser: Strip trailing whitespace
This commit is contained in:
1 parent
6b5a19b708
commit
0c097bfca4
2 files changed
+19
-19
No files matched your search
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
%{
|
%{
|
||||||
/*
|
/*
|
||||||
conf-lex.l - Part of libsensors, a Linux library for reading sensor data.
|
conf-lex.l - Part of libsensors, a Linux library for reading sensor data.
|
||||||
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
|
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -245,7 +245,7 @@ ignore{BLANK}* {
|
|||||||
if (! sensors_yylval.name)
|
if (! sensors_yylval.name)
|
||||||
sensors_fatal_error("conf-lex.l",
|
sensors_fatal_error("conf-lex.l",
|
||||||
"Allocating a new string");
|
"Allocating a new string");
|
||||||
|
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ ignore{BLANK}* {
|
|||||||
BEGIN(ERR);
|
BEGIN(ERR);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
\" {
|
\" {
|
||||||
buffer_add_char("\0");
|
buffer_add_char("\0");
|
||||||
sensors_yylval.name = strdup(buffer);
|
sensors_yylval.name = strdup(buffer);
|
||||||
|
|||||||
+16
-16
@@ -85,7 +85,7 @@ static sensors_chip *current_chip = NULL;
|
|||||||
sensors_bus_id bus;
|
sensors_bus_id bus;
|
||||||
sensors_chip_name chip;
|
sensors_chip_name chip;
|
||||||
sensors_config_line line;
|
sensors_config_line line;
|
||||||
}
|
}
|
||||||
|
|
||||||
%left <nothing> '-' '+'
|
%left <nothing> '-' '+'
|
||||||
%left <nothing> '*' '/'
|
%left <nothing> '*' '/'
|
||||||
@@ -211,13 +211,13 @@ chip_statement: CHIP chip_name_list
|
|||||||
new_el.ignores_count = new_el.ignores_max = 0;
|
new_el.ignores_count = new_el.ignores_max = 0;
|
||||||
new_el.chips = $2;
|
new_el.chips = $2;
|
||||||
chip_add_el(&new_el);
|
chip_add_el(&new_el);
|
||||||
current_chip = sensors_config_chips +
|
current_chip = sensors_config_chips +
|
||||||
sensors_config_chips_count - 1;
|
sensors_config_chips_count - 1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
chip_name_list: chip_name
|
chip_name_list: chip_name
|
||||||
{
|
{
|
||||||
$$.fits = NULL;
|
$$.fits = NULL;
|
||||||
$$.fits_count = $$.fits_max = 0;
|
$$.fits_count = $$.fits_max = 0;
|
||||||
fits_add_el(&$1,$$);
|
fits_add_el(&$1,$$);
|
||||||
@@ -227,14 +227,14 @@ chip_name_list: chip_name
|
|||||||
fits_add_el(&$2,$$);
|
fits_add_el(&$2,$$);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
expression: FLOAT
|
expression: FLOAT
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->data.val = $1;
|
$$->data.val = $1;
|
||||||
$$->kind = sensors_kind_val;
|
$$->kind = sensors_kind_val;
|
||||||
}
|
}
|
||||||
| NAME
|
| NAME
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->data.var = $1;
|
$$->data.var = $1;
|
||||||
$$->kind = sensors_kind_var;
|
$$->kind = sensors_kind_var;
|
||||||
}
|
}
|
||||||
@@ -243,35 +243,35 @@ expression: FLOAT
|
|||||||
$$->kind = sensors_kind_source;
|
$$->kind = sensors_kind_source;
|
||||||
}
|
}
|
||||||
| expression '+' expression
|
| expression '+' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_add;
|
$$->data.subexpr.op = sensors_add;
|
||||||
$$->data.subexpr.sub1 = $1;
|
$$->data.subexpr.sub1 = $1;
|
||||||
$$->data.subexpr.sub2 = $3;
|
$$->data.subexpr.sub2 = $3;
|
||||||
}
|
}
|
||||||
| expression '-' expression
|
| expression '-' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_sub;
|
$$->data.subexpr.op = sensors_sub;
|
||||||
$$->data.subexpr.sub1 = $1;
|
$$->data.subexpr.sub1 = $1;
|
||||||
$$->data.subexpr.sub2 = $3;
|
$$->data.subexpr.sub2 = $3;
|
||||||
}
|
}
|
||||||
| expression '*' expression
|
| expression '*' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_multiply;
|
$$->data.subexpr.op = sensors_multiply;
|
||||||
$$->data.subexpr.sub1 = $1;
|
$$->data.subexpr.sub1 = $1;
|
||||||
$$->data.subexpr.sub2 = $3;
|
$$->data.subexpr.sub2 = $3;
|
||||||
}
|
}
|
||||||
| expression '/' expression
|
| expression '/' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_divide;
|
$$->data.subexpr.op = sensors_divide;
|
||||||
$$->data.subexpr.sub1 = $1;
|
$$->data.subexpr.sub1 = $1;
|
||||||
$$->data.subexpr.sub2 = $3;
|
$$->data.subexpr.sub2 = $3;
|
||||||
}
|
}
|
||||||
| '-' expression %prec NEG
|
| '-' expression %prec NEG
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_negate;
|
$$->data.subexpr.op = sensors_negate;
|
||||||
$$->data.subexpr.sub1 = $2;
|
$$->data.subexpr.sub1 = $2;
|
||||||
@@ -280,14 +280,14 @@ expression: FLOAT
|
|||||||
| '(' expression ')'
|
| '(' expression ')'
|
||||||
{ $$ = $2; }
|
{ $$ = $2; }
|
||||||
| '^' expression
|
| '^' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_exp;
|
$$->data.subexpr.op = sensors_exp;
|
||||||
$$->data.subexpr.sub1 = $2;
|
$$->data.subexpr.sub1 = $2;
|
||||||
$$->data.subexpr.sub2 = NULL;
|
$$->data.subexpr.sub2 = NULL;
|
||||||
}
|
}
|
||||||
| '`' expression
|
| '`' expression
|
||||||
{ $$ = malloc_expr();
|
{ $$ = malloc_expr();
|
||||||
$$->kind = sensors_kind_sub;
|
$$->kind = sensors_kind_sub;
|
||||||
$$->data.subexpr.op = sensors_log;
|
$$->data.subexpr.op = sensors_log;
|
||||||
$$->data.subexpr.sub1 = $2;
|
$$->data.subexpr.sub1 = $2;
|
||||||
@@ -318,7 +318,7 @@ string: NAME
|
|||||||
;
|
;
|
||||||
|
|
||||||
chip_name: NAME
|
chip_name: NAME
|
||||||
{ int res = sensors_parse_chip_name($1,&$$);
|
{ int res = sensors_parse_chip_name($1,&$$);
|
||||||
free($1);
|
free($1);
|
||||||
if (res) {
|
if (res) {
|
||||||
sensors_yyerror("Parse error in chip name");
|
sensors_yyerror("Parse error in chip name");
|
||||||
|
|||||||
Reference in new issue
Block a user