Skip to content

Commit

Permalink
F53OSCServer: fixes to NSPredicate class method for OSC wildcard patt…
Browse files Browse the repository at this point in the history
…erns

- perform OSC wildcard `*` and `?` conversion to regex equivalent after converting curly braces to parentheses. Fixes a bug that caused `?` to falsely match on a two-character string ending in "1" (caused by the `{1}` quantifier in the regex pattern becoming converted to `(1)`.)
- unescape minus signs inside of square braces (which get escaped by `stringWithSpecialRegexCharactersEscaped`) so that OSC range patterns are properly converted to regex, e.g. `[A-Z]`
- only convert commas to the regex OR `|` character when inside of curly braces

Code:
- fix/simplify regex pattern used to match OSC `?` wildcard
- only perform (potentially expensive?) substring replacements when needed
- add F53OSCServerTests.m to test `+[F53OSCServer predicateForAttribute:matchingOSCPattern:]`
  • Loading branch information
balord authored Mar 26, 2020
1 parent 966f776 commit 66fe5c5
Show file tree
Hide file tree
Showing 3 changed files with 1,004 additions and 8 deletions.
4 changes: 4 additions & 0 deletions F53OSC Monitor/F53OSC Monitor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
3D608AF623F6C987000D1C3A /* F53OSCMessageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D608AF523F6C987000D1C3A /* F53OSCMessageTests.m */; };
3DA1FD7A24045D3300DBDAD4 /* F53OSCServerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA1FD7924045D3300DBDAD4 /* F53OSCServerTests.m */; };
3DD2E36F240AEEA400AF8C1F /* F53OSCValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DD2E36D240AEEA400AF8C1F /* F53OSCValue.m */; };
66AFE43C1B79485100985C54 /* ActivityChartView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66AFE43B1B79485100985C54 /* ActivityChartView.m */; };
66EE17591B729EA0008B6743 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66EE17581B729EA0008B6743 /* AppDelegate.m */; };
Expand Down Expand Up @@ -44,6 +45,7 @@

/* Begin PBXFileReference section */
3D608AF523F6C987000D1C3A /* F53OSCMessageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = F53OSCMessageTests.m; sourceTree = "<group>"; };
3DA1FD7924045D3300DBDAD4 /* F53OSCServerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = F53OSCServerTests.m; sourceTree = "<group>"; };
3DD2E36D240AEEA400AF8C1F /* F53OSCValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = F53OSCValue.m; path = ../../F53OSCValue.m; sourceTree = "<group>"; };
3DD2E36E240AEEA400AF8C1F /* F53OSCValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = F53OSCValue.h; path = ../../F53OSCValue.h; sourceTree = "<group>"; };
66AFE43A1B79485100985C54 /* ActivityChartView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivityChartView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -167,6 +169,7 @@
isa = PBXGroup;
children = (
3D608AF523F6C987000D1C3A /* F53OSCMessageTests.m */,
3DA1FD7924045D3300DBDAD4 /* F53OSCServerTests.m */,
66EE176B1B729EA0008B6743 /* F53OSC_NSNumberTests.m */,
66EE17691B729EA0008B6743 /* Supporting Files */,
);
Expand Down Expand Up @@ -349,6 +352,7 @@
files = (
3D608AF623F6C987000D1C3A /* F53OSCMessageTests.m in Sources */,
66EE176C1B729EA0008B6743 /* F53OSC_NSNumberTests.m in Sources */,
3DA1FD7A24045D3300DBDAD4 /* F53OSCServerTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 66fe5c5

Please sign in to comment.