home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 4 / AACD04.ISO / AACD / Programming / envsof20 / source / scanner / test_eiffel.c < prev   
Encoding:
C/C++ Source or Header  |  1999-08-28  |  1.2 KB  |  51 lines

  1. /* test_eiffel.c -- Test ScanHandlerEiffel.
  2.  * Copyright 1999 Thomas Aglassinger and others, see file "forum.txt" */
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. #ifdef LATTICE
  8. #define __A0
  9. #define __A1
  10. #define __D0
  11. #define __COMMODORE_DATE__ __DATE__
  12. #endif
  13.  
  14. /* This violently includes the scanner */
  15. #include "eiffel.c"
  16.  
  17. static void test_handler(char *text)
  18. {
  19.    ULONG length = strlen(text);
  20.    printf("%s\n", text);
  21.    text[length] = '?';          /* Remove 0-termination */
  22.  
  23.    length = ScanHandlerEiffel(length, &text, NULL);
  24.  
  25.    if (length > 0)
  26.    {
  27.       printf("--> «");
  28.       while (length > 0)
  29.       {
  30.          printf("%c", *text);
  31.          text += 1;
  32.          length -= 1;
  33.       }
  34.       printf("»\n");
  35.    }
  36. }
  37.  
  38. int main(void)
  39. {
  40.    test_handler("   sepp(hugo: INTEGER) is");
  41.    test_handler("   description: \"that's it\"");
  42.    test_handler("   sepp, hugo, resi is");
  43.    test_handler("   sepp is");
  44.    test_handler("   -- Don't show up because this is");  /* a comment */
  45.    test_handler("   frozen sepp(hugo: INTEGER) is");
  46.    test_handler("   frozen conforms_to(other: GENERAL): BOOLEAN is");
  47.    test_handler("   infix \"#<<\"(s: INTEGER): like Current is");
  48.    test_handler("   frozen infix \"+\"(s: INTEGER): like Current is");
  49.    return 0;
  50. }
  51.