Merge commit 'ashb/master'
[p5sagit/Devel-Declare.git] / Declare.xs
index d29488d..edfbc0d 100644 (file)
@@ -187,8 +187,17 @@ int dd_toke_scan_ident(pTHX_ int offset) {
 }
 
 int dd_toke_scan_str(pTHX_ int offset) {
+  STRLEN remaining = sv_len(PL_linestr) - offset;
+  SV* line_copy = newSVsv(PL_linestr);
   char* base_s = SvPVX(PL_linestr) + offset;
   char* s = scan_str(base_s, FALSE, FALSE);
+  if (s != base_s && sv_len(PL_lex_stuff) > remaining) {
+    int ret = (s - SvPVX(PL_linestr)) + remaining;
+    sv_catsv(line_copy, PL_linestr);
+    dd_set_linestr(aTHX_ SvPV_nolen(line_copy));
+    SvREFCNT_dec(line_copy);
+    return ret;
+  }
   return s - base_s;
 }
 
@@ -321,6 +330,10 @@ STATIC OP *dd_ck_const(pTHX_ OP *o, void *user_data) {
 
   PERL_UNUSED_VAR(user_data);
 
+  if (DD_HAVE_PARSER && PL_expect == XOPERATOR) {
+    return o;
+  }
+
   /* if this is set, we just grabbed a delimited string or something,
      not a bareword, so NO TOUCHY */