~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/Mono.Texteditor/Mono.TextEditor.Highlighting.Regex/Regex.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                        foreach (string pattern in patterns) {
35
35
                                int curOffset = offset;
36
36
                                bool match = true;
 
37
                                int length = 0;
37
38
                                for (int i = 0; i < pattern.Length; i++) {
38
 
                                        if (curOffset >= doc.Length) {
39
 
                                                match = false;
40
 
                                                break;
41
 
                                        }
42
 
                                        
43
 
                                        if (doc [curOffset] != pattern [i]) {
44
 
                                                match = false;
45
 
                                                break;
 
39
                                        if (pattern[i] == '\u00AE' && i + 1 < pattern.Length) {
 
40
                                                i++;
 
41
                                                if (curOffset >= doc.Length) {
 
42
                                                        match = true;
 
43
                                                        break;
 
44
                                                }
 
45
                                                if (pattern[i] == doc [curOffset]) {
 
46
                                                        match = false;
 
47
                                                        break;
 
48
                                                }
 
49
                                        } else {
 
50
                                                if (curOffset >= doc.Length) {
 
51
                                                        match = false;
 
52
                                                        break;
 
53
                                                }
 
54
                                                if (doc [curOffset] != pattern [i]) {
 
55
                                                        match = false;
 
56
                                                        break;
 
57
                                                }
 
58
                                                length++;
46
59
                                        }
47
60
                                        curOffset++;
48
61
                                        
49
62
                                }
50
63
                                if (match) 
51
 
                                        return new RegexMatch (pattern.Length);
 
64
                                        return new RegexMatch (length);
52
65
                        }
53
66
                        return RegexMatch.NoMatch;
54
67
                }