Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: src/jsregexp.cc

Issue 9426032: Fix RegExp white-space character class to match BOMs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Lasse and Andreas. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3590 printer.PrintNode(label, node); 3590 printer.PrintNode(label, node);
3591 } 3591 }
3592 3592
3593 3593
3594 #endif // DEBUG 3594 #endif // DEBUG
3595 3595
3596 3596
3597 // ------------------------------------------------------------------- 3597 // -------------------------------------------------------------------
3598 // Tree to graph conversion 3598 // Tree to graph conversion
3599 3599
3600 static const int kSpaceRangeCount = 20; 3600 static const uc16 kSpaceRanges[] = { 0x0009, 0x000D, 0x0020, 0x0020, 0x00A0,
3601 static const int kSpaceRangeAsciiCount = 4; 3601 0x00A0, 0x1680, 0x1680, 0x180E, 0x180E, 0x2000, 0x200A, 0x2028, 0x2029,
3602 static const uc16 kSpaceRanges[kSpaceRangeCount] = { 0x0009, 0x000D, 0x0020, 3602 0x202F, 0x202F, 0x205F, 0x205F, 0x3000, 0x3000, 0xFEFF, 0xFEFF };
3603 0x0020, 0x00A0, 0x00A0, 0x1680, 0x1680, 0x180E, 0x180E, 0x2000, 0x200A, 3603 static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges);
3604 0x2028, 0x2029, 0x202F, 0x202F, 0x205F, 0x205F, 0x3000, 0x3000 };
3605 3604
3606 static const int kWordRangeCount = 8; 3605 static const uc16 kWordRanges[] = { '0', '9', 'A', 'Z', '_', '_', 'a', 'z' };
3607 static const uc16 kWordRanges[kWordRangeCount] = { '0', '9', 'A', 'Z', '_', 3606 static const int kWordRangeCount = ARRAY_SIZE(kWordRanges);
3608 '_', 'a', 'z' };
3609 3607
3610 static const int kDigitRangeCount = 2; 3608 static const uc16 kDigitRanges[] = { '0', '9' };
3611 static const uc16 kDigitRanges[kDigitRangeCount] = { '0', '9' }; 3609 static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges);
3612 3610
3613 static const int kLineTerminatorRangeCount = 6; 3611 static const uc16 kLineTerminatorRanges[] = { 0x000A, 0x000A, 0x000D, 0x000D,
3614 static const uc16 kLineTerminatorRanges[kLineTerminatorRangeCount] = { 0x000A, 3612 0x2028, 0x2029 };
3615 0x000A, 0x000D, 0x000D, 0x2028, 0x2029 }; 3613 static const int kLineTerminatorRangeCount = ARRAY_SIZE(kLineTerminatorRanges);
3616 3614
3617 RegExpNode* RegExpAtom::ToNode(RegExpCompiler* compiler, 3615 RegExpNode* RegExpAtom::ToNode(RegExpCompiler* compiler,
3618 RegExpNode* on_success) { 3616 RegExpNode* on_success) {
3619 ZoneList<TextElement>* elms = new ZoneList<TextElement>(1); 3617 ZoneList<TextElement>* elms = new ZoneList<TextElement>(1);
3620 elms->Add(TextElement::Atom(this)); 3618 elms->Add(TextElement::Atom(this));
3621 return new TextNode(elms, on_success); 3619 return new TextNode(elms, on_success);
3622 } 3620 }
3623 3621
3624 3622
3625 RegExpNode* RegExpText::ToNode(RegExpCompiler* compiler, 3623 RegExpNode* RegExpText::ToNode(RegExpCompiler* compiler,
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
5334 } 5332 }
5335 5333
5336 return compiler.Assemble(&macro_assembler, 5334 return compiler.Assemble(&macro_assembler,
5337 node, 5335 node,
5338 data->capture_count, 5336 data->capture_count,
5339 pattern); 5337 pattern);
5340 } 5338 }
5341 5339
5342 5340
5343 }} // namespace v8::internal 5341 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698