app.c (78828) | app.c (89857) |
---|---|
1/* This is the Assembler Pre-Processor 2 Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 3 1999, 2000 4 Free Software Foundation, Inc. 5 6 This file is part of GAS, the GNU Assembler. 7 8 GAS is free software; you can redistribute it and/or modify --- 64 unchanged lines hidden (view full) --- 73#define LEX_IS_DOUBLEDASH_1ST 12 74#endif 75#ifdef TC_M32R 76#define DOUBLEBAR_PARALLEL 77#endif 78#ifdef DOUBLEBAR_PARALLEL 79#define LEX_IS_DOUBLEBAR_1ST 13 80#endif | 1/* This is the Assembler Pre-Processor 2 Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 3 1999, 2000 4 Free Software Foundation, Inc. 5 6 This file is part of GAS, the GNU Assembler. 7 8 GAS is free software; you can redistribute it and/or modify --- 64 unchanged lines hidden (view full) --- 73#define LEX_IS_DOUBLEDASH_1ST 12 74#endif 75#ifdef TC_M32R 76#define DOUBLEBAR_PARALLEL 77#endif 78#ifdef DOUBLEBAR_PARALLEL 79#define LEX_IS_DOUBLEBAR_1ST 13 80#endif |
81#define LEX_IS_PARALLEL_SEPARATOR 14 |
|
81#define IS_SYMBOL_COMPONENT(c) (lex[c] == LEX_IS_SYMBOL_COMPONENT) 82#define IS_WHITESPACE(c) (lex[c] == LEX_IS_WHITESPACE) 83#define IS_LINE_SEPARATOR(c) (lex[c] == LEX_IS_LINE_SEPARATOR) | 82#define IS_SYMBOL_COMPONENT(c) (lex[c] == LEX_IS_SYMBOL_COMPONENT) 83#define IS_WHITESPACE(c) (lex[c] == LEX_IS_WHITESPACE) 84#define IS_LINE_SEPARATOR(c) (lex[c] == LEX_IS_LINE_SEPARATOR) |
85#define IS_PARALLEL_SEPARATOR(c) (lex[c] == LEX_IS_PARALLEL_SEPARATOR) |
|
84#define IS_COMMENT(c) (lex[c] == LEX_IS_COMMENT_START) 85#define IS_LINE_COMMENT(c) (lex[c] == LEX_IS_LINE_COMMENT_START) 86#define IS_NEWLINE(c) (lex[c] == LEX_IS_NEWLINE) 87 88static int process_escape PARAMS ((int)); 89 90/* FIXME-soon: The entire lexer/parser thingy should be 91 built statically at compile time rather than dynamically --- 67 unchanged lines hidden (view full) --- 159 lex[(unsigned char) *p] = LEX_IS_LINE_COMMENT_START; 160 } /* declare line comment chars */ 161 162 for (p = line_separator_chars; *p; p++) 163 { 164 lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR; 165 } /* declare line separators */ 166 | 86#define IS_COMMENT(c) (lex[c] == LEX_IS_COMMENT_START) 87#define IS_LINE_COMMENT(c) (lex[c] == LEX_IS_LINE_COMMENT_START) 88#define IS_NEWLINE(c) (lex[c] == LEX_IS_NEWLINE) 89 90static int process_escape PARAMS ((int)); 91 92/* FIXME-soon: The entire lexer/parser thingy should be 93 built statically at compile time rather than dynamically --- 67 unchanged lines hidden (view full) --- 161 lex[(unsigned char) *p] = LEX_IS_LINE_COMMENT_START; 162 } /* declare line comment chars */ 163 164 for (p = line_separator_chars; *p; p++) 165 { 166 lex[(unsigned char) *p] = LEX_IS_LINE_SEPARATOR; 167 } /* declare line separators */ 168 |
169#ifdef tc_parallel_separator_chars 170 /* This macro permits the processor to specify all characters which 171 separate parallel insns on the same line. */ 172 for (p = tc_parallel_separator_chars; *p; p++) 173 { 174 lex[(unsigned char) *p] = LEX_IS_PARALLEL_SEPARATOR; 175 } /* declare parallel separators */ 176#endif 177 |
|
167 /* Only allow slash-star comments if slash is not in use. 168 FIXME: This isn't right. We should always permit them. */ 169 if (lex['/'] == 0) 170 { 171 lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST; 172 } 173 174#ifdef TC_M68K --- 196 unchanged lines hidden (view full) --- 371#ifdef DOUBLEBAR_PARALLEL 372 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator. 373#endif 374 */ 375 376 /* I added states 9 and 10 because the MIPS ECOFF assembler uses 377 constructs like ``.loc 1 20''. This was turning into ``.loc 378 120''. States 9 and 10 ensure that a space is never dropped in | 178 /* Only allow slash-star comments if slash is not in use. 179 FIXME: This isn't right. We should always permit them. */ 180 if (lex['/'] == 0) 181 { 182 lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST; 183 } 184 185#ifdef TC_M68K --- 196 unchanged lines hidden (view full) --- 382#ifdef DOUBLEBAR_PARALLEL 383 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator. 384#endif 385 */ 386 387 /* I added states 9 and 10 because the MIPS ECOFF assembler uses 388 constructs like ``.loc 1 20''. This was turning into ``.loc 389 120''. States 9 and 10 ensure that a space is never dropped in |
379 between characters which could appear in a identifier. Ian | 390 between characters which could appear in an identifier. Ian |
380 Taylor, ian@cygnus.com. 381 382 I added state 11 so that something like "Lfoo add %r25,%r26,%r27" works 383 correctly on the PA (and any other target where colons are optional). 384 Jeff Law, law@cs.utah.edu. 385 386 I added state 13 so that something like "cmp r1, r2 || trap #1" does not 387 get squashed into "cmp r1,r2||trap#1", with the all important space --- 162 unchanged lines hidden (view full) --- 550 to += len; 551 from += len; 552 } 553 } 554 555 ch = GET (); 556 if (ch == EOF) 557 { | 391 Taylor, ian@cygnus.com. 392 393 I added state 11 so that something like "Lfoo add %r25,%r26,%r27" works 394 correctly on the PA (and any other target where colons are optional). 395 Jeff Law, law@cs.utah.edu. 396 397 I added state 13 so that something like "cmp r1, r2 || trap #1" does not 398 get squashed into "cmp r1,r2||trap#1", with the all important space --- 162 unchanged lines hidden (view full) --- 561 to += len; 562 from += len; 563 } 564 } 565 566 ch = GET (); 567 if (ch == EOF) 568 { |
558 as_warn (_("end of file in string: inserted '\"'")); | 569 as_warn (_("end of file in string; inserted '\"'")); |
559 state = old_state; 560 UNGET ('\n'); 561 PUT ('"'); 562 } 563 else if (lex[ch] == LEX_IS_STRINGQUOTE) 564 { 565 state = old_state; 566 PUT (ch); --- 49 unchanged lines hidden (view full) --- 616 case '3': 617 case '4': 618 case '5': 619 case '6': 620 case '7': 621 break; 622#if defined(IGNORE_NONSTANDARD_ESCAPES) | defined(ONLY_STANDARD_ESCAPES) 623 default: | 570 state = old_state; 571 UNGET ('\n'); 572 PUT ('"'); 573 } 574 else if (lex[ch] == LEX_IS_STRINGQUOTE) 575 { 576 state = old_state; 577 PUT (ch); --- 49 unchanged lines hidden (view full) --- 627 case '3': 628 case '4': 629 case '5': 630 case '6': 631 case '7': 632 break; 633#if defined(IGNORE_NONSTANDARD_ESCAPES) | defined(ONLY_STANDARD_ESCAPES) 634 default: |
624 as_warn (_("Unknown escape '\\%c' in string: Ignored"), ch); | 635 as_warn (_("unknown escape '\\%c' in string; ignored"), ch); |
625 break; 626#else /* ONLY_STANDARD_ESCAPES */ 627 default: 628 /* Accept \x as x for any x */ 629 break; 630#endif /* ONLY_STANDARD_ESCAPES */ 631 632 case EOF: | 636 break; 637#else /* ONLY_STANDARD_ESCAPES */ 638 default: 639 /* Accept \x as x for any x */ 640 break; 641#endif /* ONLY_STANDARD_ESCAPES */ 642 643 case EOF: |
633 as_warn (_("End of file in string: '\"' inserted")); | 644 as_warn (_("end of file in string; '\"' inserted")); |
634 PUT ('"'); 635 continue; 636 } 637 PUT (ch); 638 continue; 639 640 case 7: 641 ch = GET (); --- 149 unchanged lines hidden (view full) --- 791 UNGET (ch); 792 PUT (' '); 793 break; 794 } 795 } 796#endif 797 if (IS_COMMENT (ch) 798 || ch == '/' | 645 PUT ('"'); 646 continue; 647 } 648 PUT (ch); 649 continue; 650 651 case 7: 652 ch = GET (); --- 149 unchanged lines hidden (view full) --- 802 UNGET (ch); 803 PUT (' '); 804 break; 805 } 806 } 807#endif 808 if (IS_COMMENT (ch) 809 || ch == '/' |
799 || IS_LINE_SEPARATOR (ch)) | 810 || IS_LINE_SEPARATOR (ch) 811 || IS_PARALLEL_SEPARATOR (ch)) |
800 { 801 if (scrub_m68k_mri) 802 { 803 /* In MRI mode, we keep these spaces. */ 804 UNGET (ch); 805 PUT (' '); 806 break; 807 } --- 179 unchanged lines hidden (view full) --- 987 ch = process_escape (ch); 988 } 989 sprintf (out_buf, "%d", (int) (unsigned char) ch); 990 991 /* None of these 'x constants for us. We want 'x'. */ 992 if ((ch = GET ()) != '\'') 993 { 994#ifdef REQUIRE_CHAR_CLOSE_QUOTE | 812 { 813 if (scrub_m68k_mri) 814 { 815 /* In MRI mode, we keep these spaces. */ 816 UNGET (ch); 817 PUT (' '); 818 break; 819 } --- 179 unchanged lines hidden (view full) --- 999 ch = process_escape (ch); 1000 } 1001 sprintf (out_buf, "%d", (int) (unsigned char) ch); 1002 1003 /* None of these 'x constants for us. We want 'x'. */ 1004 if ((ch = GET ()) != '\'') 1005 { 1006#ifdef REQUIRE_CHAR_CLOSE_QUOTE |
995 as_warn (_("Missing close quote: (assumed)")); | 1007 as_warn (_("missing close quote; (assumed)")); |
996#else 997 if (ch != EOF) 998 UNGET (ch); 999#endif 1000 } 1001 if (strlen (out_buf) == 1) 1002 { 1003 PUT (out_buf[0]); --- 30 unchanged lines hidden (view full) --- 1034 } 1035 /* Fall through. */ 1036 1037 case LEX_IS_LINE_SEPARATOR: 1038 state = 0; 1039 PUT (ch); 1040 break; 1041 | 1008#else 1009 if (ch != EOF) 1010 UNGET (ch); 1011#endif 1012 } 1013 if (strlen (out_buf) == 1) 1014 { 1015 PUT (out_buf[0]); --- 30 unchanged lines hidden (view full) --- 1046 } 1047 /* Fall through. */ 1048 1049 case LEX_IS_LINE_SEPARATOR: 1050 state = 0; 1051 PUT (ch); 1052 break; 1053 |
1054 case LEX_IS_PARALLEL_SEPARATOR: 1055 state = 1; 1056 PUT (ch); 1057 break; 1058 |
|
1042#ifdef TC_V850 1043 case LEX_IS_DOUBLEDASH_1ST: 1044 ch2 = GET (); 1045 if (ch2 != '-') 1046 { 1047 UNGET (ch2); 1048 goto de_fault; 1049 } --- 64 unchanged lines hidden (view full) --- 1114 break; 1115 } 1116 if (ch < '0' || ch > '9' || state != 0 || startch != '#') 1117 { 1118 /* Not a cpp line. */ 1119 while (ch != EOF && !IS_NEWLINE (ch)) 1120 ch = GET (); 1121 if (ch == EOF) | 1059#ifdef TC_V850 1060 case LEX_IS_DOUBLEDASH_1ST: 1061 ch2 = GET (); 1062 if (ch2 != '-') 1063 { 1064 UNGET (ch2); 1065 goto de_fault; 1066 } --- 64 unchanged lines hidden (view full) --- 1131 break; 1132 } 1133 if (ch < '0' || ch > '9' || state != 0 || startch != '#') 1134 { 1135 /* Not a cpp line. */ 1136 while (ch != EOF && !IS_NEWLINE (ch)) 1137 ch = GET (); 1138 if (ch == EOF) |
1122 as_warn (_("EOF in Comment: Newline inserted")); | 1139 as_warn (_("end of file in comment; newline inserted")); |
1123 state = 0; 1124 PUT ('\n'); 1125 break; 1126 } 1127 /* Looks like `# 123 "filename"' from cpp. */ 1128 UNGET (ch); 1129 old_state = 4; 1130 state = -1; --- 198 unchanged lines hidden --- | 1140 state = 0; 1141 PUT ('\n'); 1142 break; 1143 } 1144 /* Looks like `# 123 "filename"' from cpp. */ 1145 UNGET (ch); 1146 old_state = 4; 1147 state = -1; --- 198 unchanged lines hidden --- |