5 /* $Header: /cvs/gnome/gcalctool/gcalctool/lr_tokeniser.l,v 1.7 2005/12/19 15:46:57 richb Exp $
7 * Copyright (C) 2004-2007 Sami Pietila
9 * This program 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)
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 #include <sys/types.h>
31 #include "functions.h" /* FIXME: Needed for gc_strdup() */
32 #include "lr_parser.h"
33 #include "lr_parser.tab.h"
43 NUMBER [DIGIT}*{DECIMAL}{DIGIT}+|{DIGIT}
50 "Acosh" {return tACOSH;}
51 "Acos" {return tACOS;}
53 "Asinh" {return tASINH;}
54 "Asin" {return tASIN;}
55 "Atanh" {return tATANH;}
56 "Atan" {return tATAN;}
57 "Cbrt" {return tCBRT;}
59 "Cosh" {return tCOSH;}
63 "Frac" {return tFRAC;}
67 "Log" {return tLOG10;}
73 "Rand" {return tRAND;}
74 "Rate" {return tRATE;}
75 "Sinh" {return tSINH;}
78 "Sqrt" {return tSQRT;}
80 "Tanh" {return tTANH;}
82 "Term" {return tTERM;}
85 "XNOR" {return tXNOR;}
93 if (strlen(yytext) > 40) parser_state.error = EINVAL;
94 MPstr_to_num(yytext, v->base, lrlval.int_t);
98 {HEXS}*{DECIMAL}{HEXS}+ {
99 if (strlen(yytext) > 40) parser_state.error = EINVAL;
100 MPstr_to_num(yytext, v->base, lrlval.int_t);
104 {HEXS}+{SEPARATOR}{HEXS}+ {
105 MPstr_to_num(yytext, v->base, lrlval.int_t);
117 lr_flush_buffer(YY_CURRENT_BUFFER);