/* commandl.l: Debugger command lexical scanner Copyright (c) 2002 Philip Kendall $Id$ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Author contact information: E-mail: pak21-fuse@srcf.ucam.org Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England */ %{ #include #include #include "commandy.h" #include "debugger.h" #include "debugger_internals.h" #define YY_INPUT(buf,result,max_size) \ { \ if( !debugger_command_input( buf, &result, max_size ) ) result = YY_NULL; \ } %} DIGIT [0-9] HEX [0-9a-f] %option caseless %option noyywrap %% al|all { return ALL; } ba|bas|base { return BASE; } br|bre|brea|break|breakp|breakpo|breakpoi|breakpoin|breakpoint { return BREAK;} co|con|cont|contin|continu|continue { return CONTINUE; } cl|cle|clea|clear { return CLEAR; } di|dis|disa|disas|disass|disasse|disassm|disassmb|diasassmbl|disassemble { return DISASSEMBLE; } ex|exi|exit { return EXIT; } i|ig|ign|igno|ignor|ignore { return IGNORE; } n|ne|nex|next { return NEXT; } p|po|por|port { return PORT; } r|re|rea|read { return READ; } se|set { return SET; } sh|sho|show { return SHOW; } s|st|ste|step { return STEP; } w|wr|wri|writ|write { return WRITE; } a|b|c|d|e|f|h|l { yylval.integer = tolower( *yytext ); return REGISTER; } af|bc|de|hl|sp|pc|ix|iy { yylval.integer = debugger_reg16_index( yytext ); return REGISTER; } ${HEX}+ { yylval.integer = strtol( yytext+1, NULL, 16 ); return NUMBER; } 0x{HEX}+ { yylval.integer = strtol( yytext+2, NULL, 16 ); return NUMBER; } {DIGIT}+ { yylval.integer = atoi( yytext ); return NUMBER; } [ \n]+ /* Swallow whitespace */ . { return ERROR; }