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

Side by Side Diff: src/conversions.cc

Issue 5136002: Extract scanner base/JS/JSON and move base and JS to scanner-base. (Closed)
Patch Set: Created 10 years, 1 month 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
« no previous file with comments | « src/conversions.h ('k') | src/parser.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 21 matching lines...) Expand all
32 32
33 #include "conversions-inl.h" 33 #include "conversions-inl.h"
34 #include "dtoa.h" 34 #include "dtoa.h"
35 #include "factory.h" 35 #include "factory.h"
36 #include "scanner-base.h" 36 #include "scanner-base.h"
37 #include "strtod.h" 37 #include "strtod.h"
38 38
39 namespace v8 { 39 namespace v8 {
40 namespace internal { 40 namespace internal {
41 41
42 int HexValue(uc32 c) {
43 if ('0' <= c && c <= '9')
44 return c - '0';
45 if ('a' <= c && c <= 'f')
46 return c - 'a' + 10;
47 if ('A' <= c && c <= 'F')
48 return c - 'A' + 10;
49 return -1;
50 }
51
52 namespace { 42 namespace {
53 43
54 // C++-style iterator adaptor for StringInputBuffer 44 // C++-style iterator adaptor for StringInputBuffer
55 // (unlike C++ iterators the end-marker has different type). 45 // (unlike C++ iterators the end-marker has different type).
56 class StringInputBufferIterator { 46 class StringInputBufferIterator {
57 public: 47 public:
58 class EndMarker {}; 48 class EndMarker {};
59 49
60 explicit StringInputBufferIterator(StringInputBuffer* buffer); 50 explicit StringInputBufferIterator(StringInputBuffer* buffer);
61 51
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 // Allocate result and fill in the parts. 1074 // Allocate result and fill in the parts.
1085 StringBuilder builder(result_size + 1); 1075 StringBuilder builder(result_size + 1);
1086 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); 1076 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size);
1087 if (decimal_pos > 0) builder.AddCharacter('.'); 1077 if (decimal_pos > 0) builder.AddCharacter('.');
1088 builder.AddSubstring(decimal_buffer, decimal_pos); 1078 builder.AddSubstring(decimal_buffer, decimal_pos);
1089 return builder.Finalize(); 1079 return builder.Finalize();
1090 } 1080 }
1091 1081
1092 1082
1093 } } // namespace v8::internal 1083 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/conversions.h ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698