~ubuntu-branches/ubuntu/feisty/comedilib/feisty

« back to all changes in this revision

Viewing changes to lib/calib_lex.l

  • Committer: Bazaar Package Importer
  • Author(s): David Schleef
  • Date: 2003-09-23 18:11:12 UTC
  • Revision ID: james.westby@ubuntu.com-20030923181112-sat05jyh702rb1at
Tags: upstream-0.7.21
ImportĀ upstreamĀ versionĀ 0.7.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%option noyywrap
 
2
%option nounput
 
3
 
 
4
%{
 
5
 
 
6
/*
 
7
    lib/calib_lex.l
 
8
    code for parsing calibration file, generated by flex
 
9
 
 
10
    Copyright (C) 2003 Frank Mori Hess <fmhess@users.sourceforge.net
 
11
 
 
12
    This library is free software; you can redistribute it and/or
 
13
    modify it under the terms of the GNU Lesser General Public
 
14
    License as published by the Free Software Foundation, version 2.1
 
15
    of the License.
 
16
 
 
17
    This library is distributed in the hope that it will be useful,
 
18
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
20
    Lesser General Public License for more details.
 
21
 
 
22
    You should have received a copy of the GNU Lesser General Public
 
23
    License along with this library; if not, write to the Free Software
 
24
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 
25
    USA.
 
26
*/
 
27
 
 
28
#include <string.h>
 
29
#include "libinternal.h"
 
30
#include "calib_yacc.h"
 
31
 
 
32
%}
 
33
 
 
34
%x COMMENT
 
35
%x STRING
 
36
 
 
37
%%
 
38
 
 
39
%{
 
40
        calib_llocp->first_line = 1;
 
41
%}
 
42
 
 
43
<STRING,INITIAL>\n { calib_llocp->first_line++; }
 
44
 
 
45
"#" { BEGIN(COMMENT); }
 
46
<COMMENT>\n { calib_llocp->first_line++; BEGIN(INITIAL); }
 
47
<COMMENT>.
 
48
 
 
49
\" { BEGIN(STRING); }
 
50
<STRING>[^\"]*\" {
 
51
        if( strlen( calib_yytext ) > 0 )
 
52
                calib_yytext[ strlen( calib_yytext ) - 1 ] = 0;
 
53
        calib_lvalp->sval = calib_yytext;
 
54
        BEGIN(INITIAL);
 
55
        return ( T_STRING );
 
56
}
 
57
 
 
58
driver_name     { return ( T_DRIVER_NAME ); }
 
59
board_name      { return ( T_BOARD_NAME ); }
 
60
calibrations    { return ( T_CALIBRATIONS ); }
 
61
subdevice       { return ( T_SUBDEVICE); }
 
62
channels        { return (T_CHANNELS); }
 
63
ranges  { return ( T_RANGES ); }
 
64
arefs   { return ( T_AREFS ); }
 
65
caldacs { return ( T_CALDACS ); }
 
66
channel { return ( T_CHANNEL ); }
 
67
value   { return ( T_VALUE ); }
 
68
=>      { return ( T_ASSIGN ); };
 
69
 
 
70
(0[xX])?(00)?[0-9a-fA-F]+ { calib_lvalp->ival = strtol( calib_yytext, NULL, 0 );
 
71
        return( T_NUMBER ); }
 
72
 
 
73
[ \t]
 
74
 
 
75
.       { return( calib_yytext[0] ); }
 
76
 
 
77
 
 
78
%%
 
79