[svn:parrot] r46015 - trunk/compilers/imcc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Mon Apr 26 00:24:11 UTC 2010


Author: chromatic
Date: Mon Apr 26 00:24:10 2010
New Revision: 46015
URL: https://trac.parrot.org/parrot/changeset/46015

Log:
[IMCC] Added a save/restore of current line number when IMCC starts scanning a
new chunk of code, usually because of an .include directive.  This should fix
up more line numbers, or at least not hurt anything.

Modified:
   trunk/compilers/imcc/imcc.l
   trunk/compilers/imcc/imclexer.c

Modified: trunk/compilers/imcc/imcc.l
==============================================================================
--- trunk/compilers/imcc/imcc.l	Sun Apr 25 19:45:48 2010	(r46014)
+++ trunk/compilers/imcc/imcc.l	Mon Apr 26 00:24:10 2010	(r46015)
@@ -1261,6 +1261,7 @@
 scan_file(PARROT_INTERP, macro_frame_t *frame, FILE *file, void *yyscanner)
 {
     yyguts_t * const yyg      = (yyguts_t *)yyscanner;
+    const      int   oldline  = IMCC_INFO(interp)->line;
     frame->buffer             = YY_CURRENT_BUFFER;
     frame->s.next             = (parser_state_t *)IMCC_INFO(interp)->frames;
     IMCC_INFO(interp)->frames = frame;
@@ -1271,6 +1272,8 @@
 
     yy_switch_to_buffer(yy_create_buffer(file, YY_BUF_SIZE, yyscanner),
         yyscanner);
+
+    IMCC_INFO(interp)->line   = oldline;
 }
 
 void

Modified: trunk/compilers/imcc/imclexer.c
==============================================================================
--- trunk/compilers/imcc/imclexer.c	Sun Apr 25 19:45:48 2010	(r46014)
+++ trunk/compilers/imcc/imclexer.c	Mon Apr 26 00:24:10 2010	(r46015)
@@ -5702,6 +5702,7 @@
 scan_file(PARROT_INTERP, macro_frame_t *frame, FILE *file, void *yyscanner)
 {
     yyguts_t * const yyg      = (yyguts_t *)yyscanner;
+    const      int   oldline  = IMCC_INFO(interp)->line;
     frame->buffer             = YY_CURRENT_BUFFER;
     frame->s.next             = (parser_state_t *)IMCC_INFO(interp)->frames;
     IMCC_INFO(interp)->frames = frame;
@@ -5711,6 +5712,8 @@
     IMCC_INFO(interp)->line   = 0;
 
     yy_switch_to_buffer(yy_create_buffer(file,YY_BUF_SIZE,yyscanner),yyscanner);
+
+    IMCC_INFO(interp)->line   = oldline;
 }
 
 void


More information about the parrot-commits mailing list