cvsuser 03/07/29 08:17:48
Modified: languages/imcc ChangeLog imcc.l
languages/imcc/docs parsing.pod
languages/imcc/t/syn bsr.t
Log:
ignore text between POD markers
Revision Changes Path
1.20 +2 -0 parrot/languages/imcc/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/ChangeLog,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -r1.19 -r1.20
--- ChangeLog 29 Jul 2003 13:35:21 -0000 1.19
+++ ChangeLog 29 Jul 2003 15:17:45 -0000 1.20
@@ -6,6 +6,8 @@
- only upper half of registers are preserved
- s. t/imcpasm/pcc.t for generated code
+ * ignore text between =$pod_marker and =cut
+
- 2003-07-09 leo
* version 0.0.10.1
1.39 +9 -2 parrot/languages/imcc/imcc.l
Index: imcc.l
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/imcc.l,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -w -r1.38 -r1.39
--- imcc.l 29 Jul 2003 13:35:21 -0000 1.38
+++ imcc.l 29 Jul 2003 15:17:45 -0000 1.39
@@ -58,6 +58,7 @@
static int read_macro (YYSTYPE *valp, void *interp);
static int expand_macro (YYSTYPE *valp, void *interp, const char *name);
static void include_file (const char *file_name);
+static int in_pod;
#define YY_DECL int yylex(YYSTYPE *valp, struct Parrot_Interp *interp)
@@ -89,14 +90,15 @@
%x emit
%x macro
+%x pod
%%
/* for emacs "*/
- if (expect_pasm == 1) {
+ if (expect_pasm == 1 && !in_pod) {
expect_pasm = 2;
BEGIN(emit);
}
- if (pasm_file && YYSTATE == INITIAL) {
+ if (pasm_file && YYSTATE == INITIAL && !in_pod) {
if (pasm_file == 1) {
BEGIN(emit);
return EMIT;
@@ -135,6 +137,11 @@
valp->s = str_dup(yytext);
return REG;
}
+
+^"=" { in_pod = 1; BEGIN(pod); }
+<pod>^"=cut"{EOL} { in_pod = 0; BEGIN(INITIAL); }
+<pod>. { /*ignore*/ }
+<pod>{EOL} { ++line; }
".sym" return(LOCAL);
".arg" return(ARG);
1.6 +16 -1 parrot/languages/imcc/docs/parsing.pod
Index: parsing.pod
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/docs/parsing.pod,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- parsing.pod 7 Jul 2003 21:56:21 -0000 1.5
+++ parsing.pod 29 Jul 2003 15:17:47 -0000 1.6
@@ -10,6 +10,8 @@
=item 0.2 lexicals
+=item 0.3 pod markers
+
=back
=head1 OVERVIEW
@@ -32,10 +34,23 @@
I<compilation unit> containing statements. This allows e.g. nested
subs.
+=head2 Comments
+
+Comment start with B<#> and end at line end.
+
+=head2 POD
+
+Everything enclosed in POD markers is ignored.
+
+ =some_pod_marker in col 1
+ ...
+ =cut
+
+A POD starts with a B<=> in columns 1 and ends with B<=cut> on its own line.
=head1 Compilation units
-=head2 Subroutines .sub ... .end
+=head2 Subroutines .sub ... .end and .pcc_sub ... .end
.sub _name
statements
1.12 +34 -1 parrot/languages/imcc/t/syn/bsr.t
Index: bsr.t
===================================================================
RCS file: /cvs/public/parrot/languages/imcc/t/syn/bsr.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- bsr.t 15 Jul 2003 10:19:05 -0000 1.11
+++ bsr.t 29 Jul 2003 15:17:48 -0000 1.12
@@ -1,6 +1,6 @@
#!perl
use strict;
-use TestCompiler tests => 12;
+use TestCompiler tests => 14;
##############################
# this tests register allocation/preserving of local bsr calls
@@ -352,3 +352,36 @@
CODE
foo
OUT
+
+output_is(<<'CODE', <<'OUT', "pod before");
+=head1 BLA
+
+ fasel
+
+=cut
+.sub _main
+ print "ok 1\n"
+ end
+.end
+CODE
+ok 1
+OUT
+
+output_is(<<'CODE', <<'OUT', "pod before, after");
+=head1 FOO
+
+ fasel
+
+=cut
+.sub _main
+ print "ok 1\n"
+ end
+.end
+=head1 BAR
+
+ junk
+
+CODE
+ok 1
+OUT
+