Skip to content
Browse files

Replaced multi-line action regex with better character cue regex, add…

…ed to Big Fish tests
  • Loading branch information...
1 parent 5225e79 commit b7fad8fa51ae87238afcb8086d2bd0818ca42374 @nyousefi committed Feb 26, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 Fountain/FountainParser.m
  2. +1 −1 Fountain/FountainRegexes.m
  3. +1 −1 FountainTests/BigFishTests.m
View
4 Fountain/FountainParser.m
@@ -77,13 +77,13 @@ + (NSArray *)parseBodyOfString:(NSString *)string
// Make sure pattern and template regexes match up!
NSArray *patterns = [NSArray arrayWithObjects:UNIVERSAL_LINE_BREAKS_PATTERN, BLOCK_COMMENT_PATTERN,
BRACKET_COMMENT_PATTERN, SYNOPSIS_PATTERN, PAGE_BREAK_PATTERN, FORCED_TRANSITION_PATTERN,
- SCENE_HEADER_PATTERN, FIRST_LINE_ACTION_PATTERN, TRANSITION_PATTERN, MULTI_LINE_ACTION_PATTERN,
+ SCENE_HEADER_PATTERN, FIRST_LINE_ACTION_PATTERN, TRANSITION_PATTERN,
CHARACTER_CUE_PATTERN, PARENTHETICAL_PATTERN, DIALOGUE_PATTERN, SECTION_HEADER_PATTERN,
ACTION_PATTERN, CLEANUP_PATTERN, NEWLINE_REPLACEMENT, nil];
NSArray *templates = [NSArray arrayWithObjects:UNIVERSAL_LINE_BREAKS_TEMPLATE, BLOCK_COMMENT_TEMPLATE,
BRACKET_COMMENT_TEMPLATE, SYNOPSIS_TEMPLATE, PAGE_BREAK_TEMPLATE, FORCED_TRANSITION_TEMPLATE,
- SCENE_HEADER_TEMPLATE, FIRST_LINE_ACTION_TEMPLATE, TRANSITION_TEMPLATE, MULTI_LINE_ACTION_TEMPLATE,
+ SCENE_HEADER_TEMPLATE, FIRST_LINE_ACTION_TEMPLATE, TRANSITION_TEMPLATE,
CHARACTER_CUE_TEMPLATE, PARENTHETICAL_TEMPLATE, DIALOGUE_TEMPLATE, SECTION_HEADER_TEMPLATE,
ACTION_TEMPLATE, CLEANUP_TEMPLATE, NEWLINE_RESTORE, nil];
View
2 Fountain/FountainRegexes.m
@@ -32,7 +32,7 @@
NSString * const SCENE_HEADER_PATTERN = @"(?<=\\n)(([iI][nN][tT]|[eE][xX][tT]|[^\\w][eE][sS][tT]|\\.|[iI]\\.?\\/[eE]\\.?)([^\\n]+))\\n";
NSString * const ACTION_PATTERN = @"([^<>]*?)(\\n{2}|\\n<)";
NSString * const MULTI_LINE_ACTION_PATTERN = @"\n{2}(([^a-z\\n:]+?[\\.\\?,\\s!\\*_]*?)\n{2}){1,2}";
-NSString * const CHARACTER_CUE_PATTERN = @"(?<=\\n)([ \\t]*[^<>a-z\\s\\/\\n][^<>a-z:!\\?\\n]*[^<>a-z\\(!\\?:,\\n\\.][ \\t]?)\\n{1}";
+NSString * const CHARACTER_CUE_PATTERN = @"(?<=\\n)([ \\t]*[^<>a-z\\s\\/\\n][^<>a-z:!\\?\\n]*[^<>a-z\\(!\\?:,\\n\\.][ \\t]?)\\n{1}(?!\\n)";
NSString * const DIALOGUE_PATTERN = @"(<(Character|Parenthetical)>[^<>\\n]+<\\/(Character|Parenthetical)>)([^<>]*?)(?=\\n{2}|\\n{1}<Parenthetical>)";
NSString * const PARENTHETICAL_PATTERN = @"(\\([^<>]*?\\)[\\s]?)\n";
NSString * const TRANSITION_PATTERN = @"\\n([\\*_]*([^<>\\na-z]*TO:|FADE TO BLACK\\.|FADE OUT\\.|CUT TO BLACK\\.)[\\*_]*)\\n";
View
2 FountainTests/BigFishTests.m
@@ -67,7 +67,7 @@ - (void)testSceneHeadings
- (void)testCharacters
{
- NSInteger indexes[] = {6, 9, 13, 19};
+ NSInteger indexes[] = {6, 9, 13, 19, 39};
NSInteger maxIndexes = sizeof(indexes)/sizeof(NSInteger);
for (int i=0; i < maxIndexes; i++) {
FNElement *element = [self.script.elements objectAtIndex:indexes[i]];

0 comments on commit b7fad8f

Please sign in to comment.
Something went wrong with that request. Please try again.