home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / guile-ii.src / guile-ii / guile-src / ctax / ctax-lex.l < prev    next >
Encoding:
Text File  |  1995-08-14  |  4.7 KB  |  148 lines

  1. /*    Copyright (C) 1994 Free Software Foundation, Inc.
  2.  
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7.  
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. GNU General Public License for more details.
  12.  
  13. You should have received a copy of the GNU General Public License
  14. along with this software; see the file COPYING.  If not, write to
  15. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  16.  
  17. /*
  18.  * Tom Lord
  19.  * Cygnus Support
  20.  */
  21.  
  22. %{
  23. #include "ctax.h"
  24. #include "ctax-parse.h"
  25. extern int parse_line_no;
  26. %}
  27.  
  28. DIGIT [0-9]
  29. NUMBER {DIGIT}+("."{DIGIT}*)?
  30. %%
  31. [\n]        ++parse_line_no;
  32. [ \t]*
  33. \/\/.*
  34. {NUMBER}    {
  35.           show("ctax_number_lx");
  36.           yylval = parse_number(yytext);
  37.           return ctax_number_lx;
  38.         }
  39. scm        show("ctax_SCM_lx"); return ctax_SCM_lx;
  40. if        show("ctax_if_lx"); return ctax_if_lx;
  41. else        show("ctax_else_lx"); return ctax_else_lx;
  42. for        show("ctax_for_lx"); return ctax_for_lx;
  43. while        show("ctax_while_lx"); return ctax_while_lx;
  44. return        show("return"); return ctax_return_lx;
  45. do        show("ctax_do_lx"); return ctax_do_lx;
  46. break        show("ctax_break_lx"); return ctax_break_lx;
  47. continue    show("ctax_continue_lx"); return ctax_continue_lx;
  48. interactive    show("ctax_interactive_lx"); return ctax_interactive_lx;
  49. struct        show("ctax_struct_lx"); return ctax_struct_lx;
  50. new        show("ctax_new_lx"); return ctax_new_lx;
  51. \@bit        show("'@b'"); return ctax_bit_array_lx;
  52. \@uint        show("'@u'"); return ctax_uint_array_lx;
  53. \@int        show("'@i'"); return ctax_int_array_lx;
  54. \@float        show("'@f'"); return ctax_float_array_lx;
  55. \@double    show("'@d'"); return ctax_double_array_lx;
  56. \@complex    show("'@c'"); return ctax_complex_array_lx;
  57. \@        show("'@'"); return '@';
  58. [a-z][a-z?!<>=0-9_]*    {
  59.               show("ctax_id_lx");
  60.               yylval = parse_intern (yytext);
  61.                   return ctax_id_lx;
  62.                 }
  63. \.        show("'.'"); return ctax_field_ref_lx;
  64. -\>        show("'->'"); return ctax_field_ref_lx;
  65. \[        show("'['"); return '[';
  66. \]        show("']'"); return ']';
  67. \\        show("'\\'"); return '\\';
  68. =        show("'='"); return '=';
  69. \+        show("'+'"); return '+';
  70. -        show("'-'"); return '-';
  71. \*        show("'*'"); return '*';
  72. \/        show("'/'"); return '/';
  73. &        show("'&'"); return '&';
  74. \|        show("'|'"); return '|';
  75. ~        show("'~'"); return '~';
  76. !        show("'!'"); return '!';
  77. \^        show("'^'"); return '^';
  78. %        show("'%'"); return '%';
  79. ;        show("';'"); return ';';
  80. \<        show("'<'"); return '<';
  81. >        show("'>'"); return '>';
  82. ,        show("','"); return ',';
  83. \?        show("'?'"); return '?';
  84. :        show("':'"); return ':';
  85. \(        show("'('"); return '(';
  86. \)        show("')'"); return ')';
  87. ==        show("ctax_eq_lx"); return ctax_eq_lx;
  88. !=        show("ctax_ne_lx"); return ctax_ne_lx;
  89. >=        show("ctax_ge_lx"); return ctax_ge_lx;
  90. \<=        show("ctax_le_lx"); return ctax_le_lx;
  91. \<\<        show("ctax_lshift_lx"); return ctax_lshift_lx;
  92. \>\>        show("ctax_rshift_lx"); return ctax_rshift_lx;
  93. &&        show("ctax_and_lx"); return ctax_and_lx;
  94. \|\|        show("ctax_or_lx"); return ctax_or_lx;
  95. \.:        show("'.:'"); return ctax_field_ref_col_lx;
  96. ->:        show("'->:'"); return ctax_field_ref_col_lx;
  97. \[:        show("'[:'"); return ctax_subs_left_col_lx;
  98. \]:        show("']:'"); return ctax_subs_right_col_lx;
  99. =:        show("'=:'"); return ctax_assign_col_lx;
  100. \+:        show("'+:'"); return ctax_add_col_lx;
  101. -:        show("'-:'"); return ctax_subtract_col_lx;
  102. \*:        show("'*:'"); return ctax_multiply_col_lx;
  103. \/:        show("'/:'"); return ctax_divide_col_lx;
  104. &:        show("'&:'"); return ctax_bitand_col_lx;
  105. \|:        show("'|:'"); return ctax_bitor_col_lx;
  106. ~:        show("'~:'"); return ctax_bitnot_col_lx;
  107. !:        show("'!:'"); return ctax_lognot_col_lx;
  108. \^:        show("'^:'"); return ctax_bitxor_col_lx;
  109. %:        show("'%:'"); return ctax_modulo_col_lx;
  110. \<:        show("'<:'"); return ctax_less_col_lx;
  111. >:        show("'>:'"); return ctax_greater_col_lx;
  112. ==:        show("ctax_eq_l:x"); return ctax_eq_col_lx;
  113. !=:        show("ctax_ne_l:x"); return ctax_ne_col_lx;
  114. >=:        show("ctax_ge_l:x"); return ctax_ge_col_lx;
  115. \<=:        show("ctax_le_l:x"); return ctax_le_col_lx;
  116. \<\<:        show("ctax_lshift_l:x"); return ctax_lshift_col_lx;
  117. \>\>:        show("ctax_rshift_l:x"); return ctax_rshift_col_lx;
  118. &&:        show("ctax_and_l:x"); return ctax_and_col_lx;
  119. \|\|:        show("ctax_or_l:x"); return ctax_or_col_lx;
  120. \"([^\"\\]*(\\\")?)*\"    {
  121.                 show("ctax_string_lx");
  122.                 yylval = parse_make_string (yytext);
  123.                 return ctax_string_lx;
  124.               }
  125.  
  126. '.'              {
  127.                 show("ctax_char_lx");
  128.                 yylval = parse_make_char (yytext);
  129.                 return ctax_char_lx;
  130.               }
  131. \{              show("{"); return '{';
  132. \}              show("}"); return '}';
  133. %%
  134.  
  135. show (s)
  136.   char * s;
  137. {
  138. #if 0
  139.   printf ("lex: %s %s\n", s, yytext);
  140. #endif
  141. }
  142.  
  143. yyerror (msg)
  144.   char * msg;
  145. {
  146.   printf ("%s\n", msg);
  147. }
  148.