Skip to content

Commit

Permalink
Adding support for multiline comments of all kinds. close #27
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuru Taustahuzau committed Apr 11, 2014
1 parent b2d0e7d commit a89dc53
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@
ReferencedContainer = "container:ROADAttributesCodeGenerator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-src=&quot;/Users/ossir/Desktop/MyProject/Pods&quot; -dst=&quot;/Users/ossir/Desktop/TestFolder/1&quot;"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,24 @@ + (RFPreprocessedSourceCode *)prepareCodeForInjecting:(NSString *)sourceCode {
return result;
}

static NSRegularExpression *stringRegex = nil;

+ (void)processStringParamsInCode:(RFPreprocessedSourceCode *)sourceCodeInfo {
[self processBlockMatchedRegex:@"(?<!')\"((\\\\\")*[^\"\\r\\n]*(\\\\\")*)*\"'{0}" withDataType:MetaMarkerDataTypeString inCodeInfo:sourceCodeInfo];
NSError *error;
if (!stringRegex) {
stringRegex = [[NSRegularExpression alloc] initWithPattern:@"(^|[^'])(@?\"([^\"\\\\]|(\\\\.)|(\\\\\\n)|(\"\\s*@?\"))*\")" options:NSRegularExpressionAnchorsMatchLines error:&error];
}

for (;;) {
NSTextCheckingResult *result = [stringRegex firstMatchInString:sourceCodeInfo.sourceCode options:0 range:NSMakeRange(0, [sourceCodeInfo.sourceCode length])];

if (!result) {
break;
}

NSString *metaMarker = [sourceCodeInfo.metaMarkers addData:[sourceCodeInfo.sourceCode substringWithRange:[result rangeAtIndex:2]] withType:MetaMarkerDataTypeString];
[sourceCodeInfo.sourceCode replaceCharactersInRange:[result rangeAtIndex:2] withString:metaMarker];
}
}

+ (void)processBlockMatchedRegex:(NSString *)blockRegex withDataType:(MetaMarkerDataType)dataType inCodeInfo:(RFPreprocessedSourceCode *)sourceCodeInfo {
Expand Down
Binary file modified tools/binaries/ROADAttributesCodeGenerator
Binary file not shown.

0 comments on commit a89dc53

Please sign in to comment.