1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--- a/src/c-parser.c
+++ b/src/c-parser.c
@@ -1668,6 +1668,7 @@
{
static ScmObj trigger_line = SCM_FALSE;
ScmObj line_str;
+ ScmObj rx;
/* skip the first line '# 1 "<stdin>"' */
Scm_ReadLineUnsafe(SCM_PORT(in));
@@ -1682,7 +1683,22 @@
}
}
- while (!SCM_EOFP(line_str = Scm_ReadLineUnsafe(SCM_PORT(in)))) {
+ rx = Scm_RegComp(SCM_STRING(SCM_MAKE_STR_IMMUTABLE("^#\\s+\\d+\\s+\"<stdin>\"")), 0);
+ line_str = Scm_ReadLineUnsafe(SCM_PORT(in));
+ while (!SCM_EOFP(line_str)) {
+ ScmObj body_str = line_str;
+ while (!SCM_EOFP(line_str = Scm_ReadLineUnsafe(SCM_PORT(in)))
+ && SCM_STRING_LENGTH(line_str) >= 13
+#ifdef SCM_REGEXP_MULTI_LINE
+ && SCM_REGMATCHP(Scm_RegExec(SCM_REGEXP(rx), SCM_STRING(line_str), SCM_UNDEFINED, SCM_UNDEFINED))) {
+#else
+ && SCM_REGMATCHP(Scm_RegExec(SCM_REGEXP(rx), SCM_STRING(line_str)))) {
+#endif
+ if (SCM_EOFP(line_str = Scm_ReadLineUnsafe(SCM_PORT(in)))) {
+ Scm_Error("[bug] unexpected EOF while parsing macro body");
+ }
+ body_str = Scm_StringAppend2(SCM_STRING(body_str), SCM_STRING(line_str));
+ }
if (SCM_NULLP(macro_list)) {
Scm_Error("[bug] lost macro body");
} else {
@@ -1690,7 +1706,7 @@
macro_list = SCM_CDR(macro_list);
Scm_FilenameSet(SCM_CAAR(pos_name_args));
Scm_LineNumberSet(SCM_INT_VALUE(SCM_CDAR(pos_name_args)));
- parse_macro_body(SCM_CADR(pos_name_args), SCM_CDDR(pos_name_args), line_str);
+ parse_macro_body(SCM_CADR(pos_name_args), SCM_CDDR(pos_name_args), body_str);
}
}
|