1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/**************************************************************/
/* ********************************************************** */
/* * * */
/* * SCANNER FOR SPASS INTERACTIVE MODULE * */
/* * * */
/* * $Module: KIV * */
/* * * */
/* * Copyright (C) 1997, 1998, 1999, 2001 * */
/* * MPI fuer Informatik * */
/* * * */
/* * This program is free software; you can redistribute * */
/* * it and/or modify it under the terms of the FreeBSD * */
/* * Licence. * */
/* * * */
/* * This program is distributed in the hope that it will * */
/* * be useful, but WITHOUT ANY WARRANTY; without even * */
/* * the implied warranty of MERCHANTABILITY or FITNESS * */
/* * FOR A PARTICULAR PURPOSE. See the LICENCE file * */
/* * for more details. * */
/* * * */
/* * * */
/* $Revision: 1.3 $ * */
/* $State: Exp $ * */
/* $Date: 2011-05-22 13:47:15 $ * */
/* $Author: weidenb $ * */
/* * * */
/* * Contact: * */
/* * Christoph Weidenbach * */
/* * MPI fuer Informatik * */
/* * Stuhlsatzenhausweg 85 * */
/* * 66123 Saarbruecken * */
/* * Email: spass@mpi-inf.mpg.de * */
/* * Germany * */
/* * * */
/* ********************************************************** */
/**************************************************************/
/* $RCSfile: iascanner.l,v $ */
%{
#include <ctype.h> /* for isprint */
#include <errno.h>
#include "misc.h"
#include "memory.h"
#include "symbol.h"
#include "term.h"
#include "ia.h"
#include "iaparser.h"
extern NAT dfg_LINENUMBER; /* defined in dfgparser.y */
%}
%option noyywrap
/* Force the scanner to read the input character by character */
%option always-interactive
/* Omit unused functions yyunput, yyinput */
%option nounput
%option noinput
%%
and return IA_AND;
equal return IA_EQUAL;
equiv return IA_EQUIV;
exists return IA_EXISTS;
false return IA_FALSE;
forall return IA_FORALL;
implied return IA_IMPLIED;
implies return IA_IMPLIES;
not return IA_NOT;
or return IA_OR;
true return IA_TRUE;
prove return IA_PROVE;
[0-9]+ { unsigned long n;
errno = 0;
n = strtoul(yytext, NULL, 10);
if (errno != 0 || n > INT_MAX) {
misc_StartUserErrorReport();
misc_UserErrorReport("\n Number too big in line %d.\n",
dfg_LINENUMBER);
misc_FinishUserErrorReport();
}
ia_lval.number = (int) n;
return IA_NUM;
}
[a-zA-Z0-9_]+ { ia_lval.string = (char*) memory_Malloc(yyleng+1);
strcpy(ia_lval.string, yytext);
return IA_ID;
}
[ \t]+ /* ignore */
"\n" dfg_LINENUMBER++;
[-()\[\],\.] return yytext[0];
. { misc_StartUserErrorReport();
misc_UserErrorReport("\n Illegal character '");
if (isprint((int)yytext[0]))
misc_UserErrorReport("%c",yytext[0]);
else
misc_UserErrorReport("\\x%x", (unsigned int) yytext[0]);
misc_UserErrorReport("' in line %d.\n", dfg_LINENUMBER);
misc_FinishUserErrorReport();
}
%%
|