File tree 4 files changed +61
-1
lines changed
src/processing/app/preproc
test/processing/app/preproc
4 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ public String strip(String in) {
257
257
// pre-processor directive
258
258
p += "|" + "(^\\ s*#.*?$)" ;
259
259
260
- Pattern pattern = Pattern .compile (p , Pattern .MULTILINE );
260
+ Pattern pattern = Pattern .compile (p , Pattern .MULTILINE | Pattern . DOTALL );
261
261
Matcher matcher = pattern .matcher (in );
262
262
return matcher .replaceAll (" " );
263
263
}
Original file line number Diff line number Diff line change
1
+ const char *foo = " \
2
+ hello \
3
+ world\n " ;
4
+
5
+ // " delete this comment line and the IDE parser will crash
6
+
7
+ void setup ()
8
+ {
9
+ }
10
+
11
+ void loop ()
12
+ {
13
+ }
14
+ /*
15
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
16
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
17
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
18
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
19
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
20
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
21
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
22
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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+ {
11
+ }
12
+
Original file line number Diff line number Diff line change @@ -93,4 +93,18 @@ public void testCharWithEscapedDoubleQuote() throws Exception {
93
93
assertEquals ("Wire.h" , pdePreprocessor .getExtraImports ().get (1 ));
94
94
}
95
95
96
+ @ Test
97
+ public void testLineContinuations () throws Exception {
98
+ String s = FileUtils .readFileToString (new File (PdePreprocessorTest .class .getResource ("LineContinuations.ino" ).getFile ()));
99
+
100
+ PdePreprocessor pdePreprocessor = new PdePreprocessor ();
101
+ String actualOutput = pdePreprocessor .strip (s );
102
+ String expectedOutput = FileUtils .readFileToString (new File (PdePreprocessorTest .class .getResource ("LineContinuations.stripped.ino" ).getFile ()));
103
+
104
+ assertEquals (expectedOutput , actualOutput );
105
+
106
+ pdePreprocessor .writePrefix (s );
107
+ assertEquals (0 , pdePreprocessor .getExtraImports ().size ());
108
+ }
109
+
96
110
}
You can’t perform that action at this time.
0 commit comments