LCOV - code coverage report
Current view: top level - libcpu - i386_lex.l (source / functions) Hit Total Coverage
Test: elfutils-0.191 Lines: 42 54 77.8 %
Date: 2024-04-17 19:42:11 Functions: 1 2 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 19 44 43.2 %

           Branch data     Line data    Source code
       1                 :            : %{
       2                 :            : /* Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc.
       3                 :            :    Written by Ulrich Drepper <drepper@redhat.com>, 2004.
       4                 :            : 
       5                 :            :    This file is free software; you can redistribute it and/or modify
       6                 :            :    it under the terms of either
       7                 :            : 
       8                 :            :      * the GNU Lesser General Public License as published by the Free
       9                 :            :        Software Foundation; either version 3 of the License, or (at
      10                 :            :        your option) any later version
      11                 :            : 
      12                 :            :    or
      13                 :            : 
      14                 :            :      * the GNU General Public License as published by the Free
      15                 :            :        Software Foundation; either version 2 of the License, or (at
      16                 :            :        your option) any later version
      17                 :            : 
      18                 :            :    or both in parallel, as here.
      19                 :            : 
      20                 :            :    elfutils is distributed in the hope that it will be useful, but
      21                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23                 :            :    General Public License for more details.
      24                 :            : 
      25                 :            :    You should have received copies of the GNU General Public License and
      26                 :            :    the GNU Lesser General Public License along with this program.  If
      27                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      28                 :            : 
      29                 :            : #ifdef HAVE_CONFIG_H
      30                 :            : # include <config.h>
      31                 :            : #endif
      32                 :            : 
      33                 :            : #include <ctype.h>
      34                 :            : 
      35                 :            : #include <libeu.h>
      36                 :            : #include "system.h"
      37                 :            : #include "i386_parse.h"
      38                 :            : 
      39                 :            : 
      40                 :            : static void eat_to_eol (void);
      41                 :            : static void invalid_char (int ch);
      42                 :            : %}
      43                 :            : 
      44                 :            : ID              [a-zA-Z_][a-zA-Z0-9_/]*
      45                 :            : ID2             [a-zA-Z0-9_:/]*
      46                 :            : NUMBER          [0-9]+
      47                 :            : WHITE           [[:space:]]+
      48                 :            : 
      49                 :            : %option yylineno
      50                 :            : %option never-interactive
      51                 :            : %option noyywrap
      52                 :            : 
      53                 :            : 
      54                 :            : %x MAIN
      55                 :            : 
      56                 :            : %%
      57                 :            : 
      58                 :            : "%mask"                               { return kMASK; }
      59                 :          4 : 
      60                 :          4 : "%prefix"                     { return kPREFIX; }
      61         [ +  - ]:          4 : "%suffix"                     { return kSUFFIX; }
      62                 :         14 : 
      63         [ +  - ]:          4 : "%synonym"                    { return kSYNONYM; }
      64         [ +  - ]:         10 : 
      65                 :         94 : {NUMBER}                        { i386_lval.num = strtoul (yytext, NULL, 10);
      66         [ +  - ]:        188 :                                   return kNUMBER; }
      67                 :          2 : 
      68                 :          2 : "%%"                          { BEGIN (MAIN); return kPERCPERC; }
      69         [ +  - ]:          2 : 
      70                 :      13145 : 
      71         [ +  - ]:      13145 : <MAIN>"0"                       { return '0'; }
      72                 :      13839 : <MAIN>"1"                       { return '1'; }
      73                 :      21426 : 
      74         [ +  - ]:      13839 : <INITIAL,MAIN>"{"{ID2}"}"     { i386_lval.str = xstrndup (yytext + 1,
      75         [ +  - ]:       7587 :                                                             yyleng - 2);
      76                 :       7587 :                                   return kBITFIELD; }
      77                 :         18 : 
      78                 :         36 : <MAIN>"INVALID"                 { i386_lval.str = (void *) -1l;
      79         [ +  - ]:         18 :                                   return kID; }
      80                 :       1587 : 
      81                 :       1587 : <MAIN>{ID}                        { i386_lval.str = xstrndup (yytext, yyleng);
      82         [ +  - ]:       3174 :                                   return kID; }
      83                 :       4317 : 
      84                 :       4317 : <MAIN>","                       { return ','; }
      85         [ +  - ]:       4317 : 
      86                 :       1501 : <MAIN>":"                       { return ':'; }
      87         [ +  - ]:       1501 : 
      88                 :          0 : <INITIAL,MAIN>^"\n"             { /* IGNORE */ }
      89                 :            : 
      90         [ #  # ]:          0 : <INITIAL,MAIN>"\n"              { return '\n'; }
      91                 :        120 : 
      92         [ +  - ]:       1613 : <INITIAL,MAIN>^"#"              { eat_to_eol (); }
      93         [ +  - ]:        120 : 
      94                 :        218 : {WHITE}                         { /* IGNORE */ }
      95                 :            : 
      96         [ -  + ]:        218 : <MAIN>{WHITE}                     { return kSPACE; }
      97                 :        112 : 
      98         [ +  - ]:       1434 : <MAIN>.                           { i386_lval.ch = *yytext; return kCHAR; }
      99         [ +  - ]:        112 : 
     100                 :          0 : .                               { invalid_char (*yytext); }
     101         [ #  # ]:          0 : 
     102                 :          0 : 
     103         [ #  # ]:          0 : %%
     104                 :          0 : 
     105                 :            : static void
     106                 :        120 : eat_to_eol (void)
     107                 :            : {
     108                 :       1502 :   while (1)
     109                 :            :     {
     110                 :       1502 :       int c = input ();
     111                 :            : 
     112         [ +  + ]:       1502 :       if (c == EOF || c == '\n')
     113                 :            :         break;
     114                 :            :     }
     115                 :        120 : }
     116                 :            : 
     117                 :            : static void
     118                 :          0 : invalid_char (int ch)
     119                 :            : {
     120         [ #  # ]:          0 :   error (0, 0, (isascii (ch)
     121                 :          0 :                 ? _("invalid character '%c' at line %d; ignored")
     122                 :          0 :                 : _("invalid character '\\%o' at line %d; ignored")),
     123                 :            :          ch, yylineno);
     124                 :          0 : }
     125                 :            : 
     126                 :            : // Local Variables:
     127                 :            : // mode: C
     128                 :            : // End:

Generated by: LCOV version 1.16