~ubuntu-branches/ubuntu/vivid/bc/vivid-proposed

« back to all changes in this revision

Viewing changes to bc/scan.l

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-05 12:24:03 UTC
  • mfrom: (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20071205122403-rv1a7x90ktu1wl95
Tags: 1.06.94-3ubuntu1
* Merge with Debian; remaining changes:
  - Make bc/dc notice read and write errors on its input and output.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%{
2
 
/* scan.l: the (f)lex description file for the scanner. */
3
 
 
4
1
/*  This file is part of GNU bc.
5
 
    Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
 
2
 
 
3
    Copyright (C) 1991-1994, 1997, 2006 Free Software Foundation, Inc.
6
4
 
7
5
    This program is free software; you can redistribute it and/or modify
8
6
    it under the terms of the GNU General Public License as published by
15
13
    GNU General Public License for more details.
16
14
 
17
15
    You should have received a copy of the GNU General Public License
18
 
    along with this program; see the file COPYING.  If not, write to
 
16
    along with this program; see the file COPYING.  If not, write to:
19
17
      The Free Software Foundation, Inc.
20
 
      59 Temple Place, Suite 330
21
 
      Boston, MA 02111 USA
 
18
      Foundation, Inc.  51 Franklin Street, Fifth Floor,
 
19
      Boston, MA 02110-1301  USA
22
20
 
23
21
    You may contact the author by:
24
22
       e-mail:  philnelson@acm.org
29
27
       
30
28
*************************************************************************/
31
29
 
 
30
/* scan.l: the (f)lex description file for the scanner. */
 
31
 
 
32
%{
 
33
 
32
34
#include "bcdefs.h"
33
35
#include "bc.h"
34
36
#include "global.h"
44
46
#endif
45
47
 
46
48
/* Force . as last for now. */
47
 
/* edd 9 June 2001 commented out for GNU readline-4.2
48
 
   #define DOT_IS_LAST
49
 
*/
 
49
#define DOT_IS_LAST
50
50
 
51
51
/* We want to define our own yywrap. */
52
52
#undef yywrap
146
146
 
147
147
/* Definitions for readline access. */
148
148
extern FILE *rl_instream;
149
 
/* edd 9 June 2001 commented out for GNU readline-4.2
150
 
   _PROTOTYPE(char *readline, (char *)); 
151
 
*/
152
149
 
153
150
/* rl_input puts upto MAX characters into BUF with the number put in
154
151
   BUF placed in *RESULT.  If the yy input file is the same as
249
246
auto   return(Auto);
250
247
else   return(Else);
251
248
read   return(Read);
 
249
random return(Random);
252
250
halt   return(Halt);
253
251
last   return(Last);
 
252
void   return(Void); 
254
253
history {
255
254
#if defined(READLINE) || defined(LIBEDIT)
256
255
          return(HistoryVar);
275
274
&& { return(AND); }
276
275
\|\| { return(OR); }
277
276
"!" { return(NOT); }
278
 
"*"|"/"|"%" { yylval.c_value = yytext[0]; return((int)yytext[0]); }
 
277
"*"|"/"|"%"|"&" { yylval.c_value = yytext[0]; return((int)yytext[0]); }
279
278
"="|\+=|-=|\*=|\/=|%=|\^=  { yylval.c_value = yytext[0]; return(ASSIGN_OP); }
280
279
=\+|=-|=\*|=\/|=%|=\^  { 
281
280
#ifdef OLD_EQ_OP