Show
Ignore:
Timestamp:
08/31/06 04:55:47 (8 years ago)
Author:
mmh
Message:

Cleanup style and formatting.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/scanner-opt-branch/lib/conf-lex.l

    r3300 r4122  
    4747%} 
    4848 
    49 /* Scanner for configuration files */ 
     49 /* Scanner for configuration files */ 
    5050 
    5151%option nodefault 
     
    5454%option nounput 
    5555 
    56 /* States. 'Normal' states STRING and MIDDLE share some rules; other states 
    57    have only their own rules */ 
     56 /* 
     57  * States. 'Normal' states STRING and MIDDLE share some rules; 
     58  * other states have only their own rules 
     59  */ 
     60 
    5861%s MIDDLE 
    5962%x STRING 
    6063%x ERR 
    6164 
    62 /* Any whitespace-like character */ 
     65 /* Any whitespace-like character */ 
     66 
    6367BLANK           [[:space:]] 
    6468 
    6569IDCHAR          [[:alnum:]_] 
    6670 
    67 /* Note: `10', `10.4' and `.4' are valid, `10.' is not */ 
     71 /* Note: `10', `10.4' and `.4' are valid, `10.' is not */ 
     72 
    6873FLOAT   [[:digit:]]*\.?[[:digit:]]+ 
    6974 
    70 /* Only positive whole numbers are recognized here */ 
     75 /* Only positive whole numbers are recognized here */ 
     76 
    7177NUM     0|([1-9][[:digit:]]*) 
    7278 
    73 /* Only number between 1 and 255, octally represented. */ 
     79 /* Only number between 1 and 255, octally represented. */ 
     80 
    7481OCTESC          (1[0-7]{0,2})|([2-7][0-7]?)|(0[1-7][0-7]?)|(00[1-7]) 
    7582 
     
    7986 
    8087 /* End of line: It may be the end of this line. Same for End of file. */ 
     88 
    8189<MIDDLE>\n      | 
    8290<MIDDLE><<EOF>> { 
     
    8593                } 
    8694 
    87  /* We want to match any blank, except End of line; that is why we have to 
    88     match whitespace one by one! */ 
     95 /* 
     96  * We want to match any blank, except End of line; that is why we have to 
     97  * match whitespace one by one! 
     98  */ 
     99 
    89100{BLANK}         /* Eat up a blank */ 
    90101 
    91102 /* Escaped End of line: eat and be happy */ 
     103 
    92104<MIDDLE>\\\n    /* Eat this! */ 
    93105 
    94  /* Remove a comment; we do not change the state, this is done when the \n is 
    95     eaten */ 
     106 /* 
     107  * Remove a comment; we do not change the state, 
     108  * this is done when the \n is eaten 
     109  */ 
     110 
    96111#[^\n]*         /* Eat this! */ 
    97112 
    98113 /* Some keywords at the beginning of lines */ 
     114 
    99115<INITIAL>"label" { 
    100116                  sensors_yylval.line = sensors_yylineno; 
     
    133149 
    134150 /* Anything else at the beginning of a line is an error */ 
     151 
    135152<INITIAL>.      { 
    136153                  yymore(); 
     
    145162 
    146163 /* A number */ 
     164 
    147165<MIDDLE>{FLOAT} { 
    148166                  sensors_yylval.value = atof(sensors_yytext); 
     
    151169 
    152170 /* Some operators */ 
    153 <MIDDLE>"+"     { 
    154                   return '+'; 
    155                 } 
    156  
    157 <MIDDLE>"-"     { 
    158                   return '-'; 
    159                 } 
    160  
    161 <MIDDLE>"*"     { 
    162                   return '*'; 
    163                 } 
    164  
    165 <MIDDLE>"/"     { 
    166                   return '/'; 
    167                 } 
    168  
    169 <MIDDLE>"("     { 
    170                   return '('; 
    171                 } 
    172  
    173 <MIDDLE>")"     { 
    174                   return ')'; 
    175                 } 
    176 <MIDDLE>","     { 
    177                   return ','; 
    178                 } 
    179 <MIDDLE>"@"     { 
    180                   return '@'; 
    181                 } 
    182 <MIDDLE>"^"     { 
    183                   return '^'; 
    184                 } 
    185 <MIDDLE>"`"     { 
    186                   return '`'; 
    187                 } 
     171 
     172<MIDDLE>"+"     return '+'; 
     173<MIDDLE>"-"     return '-'; 
     174<MIDDLE>"*"     return '*'; 
     175<MIDDLE>"/"     return '/'; 
     176<MIDDLE>"("     return '('; 
     177<MIDDLE>")"     return ')'; 
     178<MIDDLE>","     return ','; 
     179<MIDDLE>"@"     return '@'; 
     180<MIDDLE>"^"     return '^'; 
     181<MIDDLE>"`"     return '`'; 
    188182 
    189183 /* Quoted string */ 
     184 
    190185<MIDDLE>\"      { 
    191186                  buffer_malloc(); 
     
    194189 
    195190 /* Oops, newline while in a string is not good */ 
     191 
    196192<STRING>\n      | 
    197193<STRING>\\\n    { 
     
    204200 
    205201 /* At the end */ 
     202 
    206203<STRING>\"      { 
    207204                  buffer_add_char("\0"); 
     
    244241 
    245242 /* We can't support \0, this would cause havoc! */ 
     243 
    246244<STRING>\\{OCTESC} { 
    247245                  int res; 
     
    251249 
    252250 /* Other escapes: just copy the character behind the slash */ 
     251 
    253252<STRING>\\.     { 
    254253                  buffer_add_char(&sensors_yytext[1]); 
     
    256255 
    257256 /* Anything else */ 
     257 
    258258<STRING>[^\\\n\"]+ { 
    259259                  buffer_add_string(sensors_yytext); 
     
    261261 
    262262 /* A normal, unquoted identifier */ 
     263 
    263264<MIDDLE>{IDCHAR}+ { 
    264265                  sensors_yylval.name = strdup(sensors_yytext);