[openrtm-commit:01783] r557 - trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 2月 28日 (日) 15:30:55 JST
Author: ga
Date: 2016-02-28 15:30:55 +0900 (Sun, 28 Feb 2016)
New Revision: 557
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/PreProcessor.java
Log:
Modified IDL parse preparations processing #2891
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/PreProcessor.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/PreProcessor.java 2016-02-28 06:04:16 UTC (rev 556)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/PreProcessor.java 2016-02-28 06:30:55 UTC (rev 557)
@@ -25,6 +25,9 @@
private static final Pattern COMMENT_PATTERN = Pattern
.compile("/\\*(.*?)(\\*/)", Pattern.DOTALL);
+ private static final Pattern SPACE_PATTERN = Pattern
+ .compile("^ +", Pattern.MULTILINE);
+
private static final int INCLUDE_FILE_INDEX = 2;
/**
@@ -37,14 +40,21 @@
*/
public static String parseAlltoSpace(String target) {
String targetNoCmt = eraseComments(target);
- targetNoCmt = targetNoCmt.trim();
//
+ StringBuffer targetNoSpace = new StringBuffer();
+ Matcher matcherSpace = SPACE_PATTERN.matcher(targetNoCmt);
+ while (matcherSpace.find()) {
+ matcherSpace.appendReplacement(targetNoSpace, Matcher.quoteReplacement(""));
+ }
+ matcherSpace.appendTail(targetNoSpace);
+ //
StringBuffer result = new StringBuffer();
- Matcher matcher = PREPROSESSOR_PATTERN.matcher(targetNoCmt);
+ Matcher matcher = PREPROSESSOR_PATTERN.matcher(targetNoSpace.toString());
while (matcher.find()) {
matcher.appendReplacement(result, Matcher.quoteReplacement(""));
}
matcher.appendTail(result);
+ //
return result.toString();
}
More information about the openrtm-commit
mailing list