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

Side by Side Diff: src/lexer/experimental-scanner.h

Issue 78463002: Experimental scanner: Remove the re2c version for real. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/lexer/even-more-experimental-scanner.cc ('k') | src/lexer/experimental-scanner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_LEXER_EXPERIMENTAL_SCANNER_H
29 #define V8_LEXER_EXPERIMENTAL_SCANNER_H
30
31 #include <vector>
32
33 #include "flags.h"
34 #include "token.h"
35
36 namespace v8 {
37 namespace internal {
38
39 class EvenMoreExperimentalScanner;
40 class PushScanner;
41
42 class ExperimentalScanner {
43 public:
44 struct Location {
45 Location(int b, int e) : beg_pos(b), end_pos(e) { }
46 Location() : beg_pos(0), end_pos(0) { }
47
48 bool IsValid() const {
49 return beg_pos >= 0 && end_pos >= beg_pos;
50 }
51
52 static Location invalid() { return Location(-1, -1); }
53
54 int beg_pos;
55 int end_pos;
56 };
57
58 struct SavedToken {
59 int beg, end;
60 Token::Value value;
61 };
62
63 ExperimentalScanner(const char* fname,
64 bool read_all_at_once,
65 Isolate* isolate,
66 int repeat);
67 ~ExperimentalScanner();
68
69 Token::Value Next();
70 Token::Value current_token();
71 Location location();
72
73 void Record(v8::internal::Token::Value token, int beg_pos, int end_pos);
74
75 private:
76 void FillTokens();
77 static const int BUFFER_SIZE = 256;
78 std::vector<SavedToken> token_;
79 size_t current_;
80 size_t fetched_;
81 FILE* file_;
82 PushScanner* scanner_;
83 bool read_all_at_once_;
84 bool already_pushed_;
85 const v8::internal::byte* source_;
86 int length_;
87 };
88
89 const byte* ReadFile(const char* name, Isolate* isolate, int* size, int repeat);
90
91 } } // namespace v8::internal
92
93 #endif
OLDNEW
« no previous file with comments | « src/lexer/even-more-experimental-scanner.cc ('k') | src/lexer/experimental-scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698