From 0e9f31be1f15707e0e624de1b5f602ada5b21d6e Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Mon, 15 Feb 2016 15:08:36 +0100
Subject: [PATCH] allow backslash at end of line (during parsing)

---
 .../src/com/oracle/truffle/r/parser/ParserGeneration.java      | 3 ++-
 .../src/com/oracle/truffle/r/parser/R.g                        | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
index 3e1e4d967e..1d5aed8797 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
@@ -73,6 +73,7 @@ public class ParserGeneration {
         "allow multiple semicolons in {}",
         "allow .. as identifier",
         "rename Operator class",
-        "remove FieldAccess, small refactorings"
+        "remove FieldAccess, small refactorings",
+        "allow backslash at line end"
     };
 }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
index 2e4c58571c..a23d2d2900 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
@@ -746,6 +746,7 @@ fragment ESCAPE [StringBuilder buf]
       | '\'' { buf.append('\''); }
       | ' ' { buf.append(' '); }
       | '\\' { buf.append('\\'); }
+      | '\n' { buf.append('\n'); }
       | a = OCT_DIGIT b = OCT_DIGIT c = OCT_DIGIT { buf.append(ParseUtil.octChar($a.text, $b.text, $c.text)); }
       | a = OCT_DIGIT b = OCT_DIGIT { buf.append(ParseUtil.octChar($a.text, $b.text)); }
       | a = OCT_DIGIT { buf.append(ParseUtil.octChar($a.text)); }
-- 
GitLab