arlex.l 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. %option noinput nounput noyywrap
  2. %{
  3. /* arlex.l - Strange script language lexer */
  4. /* Copyright (C) 1992-2022 Free Software Foundation, Inc.
  5. This file is part of GNU Binutils.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  17. MA 02110-1301, USA. */
  18. /* Contributed by Steve Chamberlain <sac@cygnus.com>. */
  19. #define DONTDECLARE_MALLOC
  20. #include "ansidecl.h"
  21. #include "libiberty.h"
  22. #include "arparse.h"
  23. #ifndef YY_NO_UNPUT
  24. #define YY_NO_UNPUT
  25. #endif
  26. extern int yylex (void);
  27. int linenumber;
  28. %}
  29. %a 10000
  30. %o 25000
  31. %%
  32. "ADDLIB" { return ADDLIB; }
  33. "ADDMOD" { return ADDMOD; }
  34. "CLEAR" { return CLEAR; }
  35. "CREATE" { return CREATE; }
  36. "DELETE" { return DELETE; }
  37. "DIRECTORY" { return DIRECTORY; }
  38. "END" { return END; }
  39. "EXTRACT" { return EXTRACT; }
  40. "FULLDIR" { return FULLDIR; }
  41. "HELP" { return HELP; }
  42. "LIST" { return LIST; }
  43. "OPEN" { return OPEN; }
  44. "REPLACE" { return REPLACE; }
  45. "VERBOSE" { return VERBOSE; }
  46. "SAVE" { return SAVE; }
  47. "addlib" { return ADDLIB; }
  48. "addmod" { return ADDMOD; }
  49. "clear" { return CLEAR; }
  50. "create" { return CREATE; }
  51. "delete" { return DELETE; }
  52. "directory" { return DIRECTORY; }
  53. "end" { return END; }
  54. "extract" { return EXTRACT; }
  55. "fulldir" { return FULLDIR; }
  56. "help" { return HELP; }
  57. "list" { return LIST; }
  58. "open" { return OPEN; }
  59. "replace" { return REPLACE; }
  60. "verbose" { return VERBOSE; }
  61. "save" { return SAVE; }
  62. "+\n" { linenumber ++; }
  63. "(" { return '('; }
  64. ")" { return ')'; }
  65. "," { return ','; }
  66. [A-Za-z0-9/\\$:.\-\_\+]+ {
  67. yylval.name = xstrdup (yytext);
  68. return FILENAME;
  69. }
  70. "*".* { }
  71. ";".* { }
  72. " " { }
  73. "\n" { linenumber ++; return NEWLINE; }
  74. %%