LCOV - code coverage report
Current view: top level - libcpu - i386_lex.l (source / functions) Hit Total Coverage
Test: elfutils-0.183 Lines: 40 52 76.9 %
Date: 2021-02-07 19:08:58 Functions: 0 1 0.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                 :            : #include <libintl.h>
      35                 :            : 
      36                 :            : #include <libeu.h>
      37                 :            : #include "system.h"
      38                 :            : #include "i386_parse.h"
      39                 :            : 
      40                 :            : 
      41                 :            : static void eat_to_eol (void);
      42                 :            : static void invalid_char (int ch);
      43                 :            : %}
      44                 :            : 
      45                 :            : ID              [a-zA-Z_][a-zA-Z0-9_/]*
      46                 :            : ID2             [a-zA-Z0-9_:/]*
      47                 :            : NUMBER          [0-9]+
      48                 :            : WHITE           [[:space:]]+
      49                 :            : 
      50                 :            : %option yylineno
      51                 :            : %option never-interactive
      52                 :            : %option noyywrap
      53                 :            : 
      54                 :            : 
      55                 :            : %x MAIN
      56                 :            : 
      57                 :            : %%
      58                 :            : 
      59                 :            : "%mask"                               { return kMASK; }
      60                 :          4 : 
      61                 :          4 : "%prefix"                     { return kPREFIX; }
      62         [ +  - ]:          4 : "%suffix"                     { return kSUFFIX; }
      63                 :         14 : 
      64         [ +  - ]:          4 : "%synonym"                    { return kSYNONYM; }
      65         [ +  - ]:         10 : 
      66                 :         94 : {NUMBER}                        { i386_lval.num = strtoul (yytext, NULL, 10);
      67         [ +  - ]:        188 :                                   return kNUMBER; }
      68                 :          2 : 
      69                 :          2 : "%%"                          { BEGIN (MAIN); return kPERCPERC; }
      70         [ +  - ]:          2 : 
      71                 :      13145 : 
      72         [ +  - ]:      13145 : <MAIN>"0"                       { return '0'; }
      73                 :      13839 : <MAIN>"1"                       { return '1'; }
      74                 :      21426 : 
      75         [ +  - ]:      13839 : <INITIAL,MAIN>"{"{ID2}"}"     { i386_lval.str = xstrndup (yytext + 1,
      76         [ +  - ]:       7587 :                                                             yyleng - 2);
      77                 :       7587 :                                   return kBITFIELD; }
      78                 :         18 : 
      79                 :         36 : <MAIN>"INVALID"                 { i386_lval.str = (void *) -1l;
      80         [ +  - ]:         18 :                                   return kID; }
      81                 :       1587 : 
      82                 :       1587 : <MAIN>{ID}                        { i386_lval.str = xstrndup (yytext, yyleng);
      83         [ +  - ]:       3174 :                                   return kID; }
      84                 :       4317 : 
      85                 :       4317 : <MAIN>","                       { return ','; }
      86         [ +  - ]:       4317 : 
      87                 :       1501 : <MAIN>":"                       { return ':'; }
      88         [ +  - ]:       1501 : 
      89                 :          0 : <INITIAL,MAIN>^"\n"             { /* IGNORE */ }
      90                 :            : 
      91         [ #  # ]:          0 : <INITIAL,MAIN>"\n"              { return '\n'; }
      92                 :        120 : 
      93         [ +  - ]:       1613 : <INITIAL,MAIN>^"#"              { eat_to_eol (); }
      94         [ +  - ]:        120 : 
      95                 :        218 : {WHITE}                         { /* IGNORE */ }
      96                 :            : 
      97         [ -  + ]:        218 : <MAIN>{WHITE}                     { return kSPACE; }
      98                 :        112 : 
      99         [ +  - ]:       1434 : <MAIN>.                           { i386_lval.ch = *yytext; return kCHAR; }
     100         [ +  - ]:        112 : 
     101                 :          0 : .                               { invalid_char (*yytext); }
     102         [ #  # ]:          0 : 
     103                 :          0 : 
     104         [ #  # ]:          0 : %%
     105                 :          0 : 
     106                 :            : static void
     107                 :            : eat_to_eol (void)
     108                 :            : {
     109                 :       1502 :   while (1)
     110                 :            :     {
     111                 :       1502 :       int c = input ();
     112                 :            : 
     113         [ +  + ]:       1502 :       if (c == EOF || c == '\n')
     114                 :            :         break;
     115                 :            :     }
     116                 :            : }
     117                 :            : 
     118                 :            : static void
     119                 :          0 : invalid_char (int ch)
     120                 :            : {
     121         [ #  # ]:          0 :   error (0, 0, (isascii (ch)
     122                 :          0 :                 ? _("invalid character '%c' at line %d; ignored")
     123                 :          0 :                 : _("invalid character '\\%o' at line %d; ignored")),
     124                 :            :          ch, yylineno);
     125                 :          0 : }
     126                 :            : 
     127                 :            : // Local Variables:
     128                 :            : // mode: C
     129                 :            : // End:

Generated by: LCOV version 1.13