LCOV - code coverage report
Current view: top level - src - scan_touchstone.l (source / functions) Hit Total Coverage
Test: qucs-core-0.0.19 Code Coverage Lines: 0 17 0.0 %
Date: 2015-01-05 16:01:02 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 20 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*-c-*- */
       2                 :            : 
       3                 :            : %{
       4                 :            : /*
       5                 :            :  * scan_touchstone.l - scanner for Touchstone files
       6                 :            :  *
       7                 :            :  * Copyright (C) 2003, 2004, 2005, 2008 Stefan Jahn <stefan@lkcc.org>
       8                 :            :  *
       9                 :            :  * This is free software; you can redistribute it and/or modify
      10                 :            :  * it under the terms of the GNU General Public License as published by
      11                 :            :  * the Free Software Foundation; either version 2, or (at your option)
      12                 :            :  * any later version.
      13                 :            :  *
      14                 :            :  * This software is distributed in the hope that it will be useful,
      15                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17                 :            :  * GNU General Public License for more details.
      18                 :            :  *
      19                 :            :  * You should have received a copy of the GNU General Public License
      20                 :            :  * along with this package; see the file COPYING.  If not, write to
      21                 :            :  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
      22                 :            :  * Boston, MA 02110-1301, USA.
      23                 :            :  *
      24                 :            :  * $Id$
      25                 :            :  *
      26                 :            :  */
      27                 :            : 
      28                 :            : #if HAVE_CONFIG_H
      29                 :            : # include <config.h>
      30                 :            : #endif
      31                 :            : 
      32                 :            : #include <stdio.h>
      33                 :            : #include <stdlib.h>
      34                 :            : #include <string.h>
      35                 :            : #include <ctype.h>
      36                 :            : 
      37                 :            : #ifdef __MINGW32__
      38                 :            : #include <io.h>
      39                 :            : #endif
      40                 :            : 
      41                 :            : #ifdef HAVE_UNISTD_H
      42                 :            : #include <unistd.h>
      43                 :            : #endif
      44                 :            : 
      45                 :            : #include "logging.h"
      46                 :            : #include "complex.h"
      47                 :            : #include "object.h"
      48                 :            : #include "vector.h"
      49                 :            : #include "dataset.h"
      50                 :            : #include "check_touchstone.h"
      51                 :            : #include "tokens_touchstone.h"
      52                 :            : 
      53                 :            : using namespace qucs;
      54                 :            : 
      55                 :            : %}
      56                 :            : 
      57                 :            : WS       [ \t\n\r]
      58                 :            : ID       [a-zA-Z_][a-zA-Z0-9_]*
      59                 :            : DIGIT    [0-9]
      60                 :            : EXPONENT [Ee][+-]?{DIGIT}+
      61                 :            : INT      [+-]?{DIGIT}+
      62                 :            : FLOAT1   [+-]?{DIGIT}+{EXPONENT}
      63                 :            : FLOAT2   [+-]?{DIGIT}*"."{DIGIT}+({EXPONENT})?
      64                 :            : SPACE    [ \t]
      65                 :            : 
      66                 :            : %x COMMENT
      67                 :            : %option yylineno noyywrap nounput prefix="touchstone_"
      68                 :            : 
      69                 :            : %%
      70                 :            : 
      71                 :          0 : <INITIAL>[Rr]  { /* pass the 'R' to the parser */ return 'R'; }
      72                 :          0 : <INITIAL>^#    { /* pass the leading '#' to the parser */ return '#'; }
      73                 :          0 : <INITIAL>\r?\n { /* detect end of line */ return Eol; }
      74         [ #  # ]:          0 : 
      75                 :            : <*>{SPACE} /* skip spaces */
      76 [ #  # ][ #  # ]:          0 : 
      77                 :            : <INITIAL>{ID} { /* identify identifier */
      78         [ #  # ]:          0 :     touchstone_lval.ident = strdup (touchstone_text);
      79                 :          0 :     return Option;
      80                 :            :   }
      81                 :            : 
      82                 :            : <INITIAL>({FLOAT1}|{FLOAT2}|{INT}) { /* identify float */
      83         [ #  # ]:          0 :     touchstone_lval.f = strtod (touchstone_text, NULL);
      84                 :          0 :     return Float;
      85                 :            :   }
      86                 :            : 
      87                 :            : <INITIAL>"!" { /* leave these characters */
      88         [ #  # ]:          0 :     BEGIN(COMMENT);
      89                 :            :   }
      90                 :          0 : 
      91                 :            : <INITIAL>. { /* any other character in invalid */
      92         [ #  # ]:          0 :     logprint (LOG_ERROR,
      93                 :            :               "line %d: syntax error, unrecognized character: `%s'\n",
      94                 :          0 :               touchstone_lineno, touchstone_text);
      95                 :          0 :     return InvalidCharacter;
      96                 :            :   }
      97                 :            : 
      98                 :            : <COMMENT>.     { /* skip any character in here */ }
      99         [ #  # ]:          0 : <COMMENT>\r?\n { BEGIN(INITIAL); /* skipping ends here */ return Eol; }
     100                 :            : 
     101                 :          0 : %%

Generated by: LCOV version 1.11