| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 | 93 |
| 94 // Interface for a stream of Unicode characters. | 94 // Interface for a stream of Unicode characters. |
| 95 class UnicodeInputStream { | 95 class UnicodeInputStream { |
| 96 public: | 96 public: |
| 97 virtual ~UnicodeInputStream(); | 97 virtual ~UnicodeInputStream(); |
| 98 | 98 |
| 99 // Returns the next Unicode code-point in the input, or a negative value when | 99 // Returns the next Unicode code-point in the input, or a negative value when |
| 100 // there is no more input in the stream. | 100 // there is no more input in the stream. |
| 101 virtual int32_t Next() = 0; | 101 virtual int32_t Next() = 0; |
| 102 | |
| 103 // Pushes a read character back into the stream, so that it will be the next | |
| 104 // to be read by Advance(). The character pushed back must be the most | |
| 105 // recently read character that hasn't already been pushed back (i.e., if | |
| 106 // pushing back more than one character, they must occur in the opposite order | |
| 107 // of the one they were read in). | |
| 108 virtual void PushBack(int32_t ch) = 0; | |
| 109 }; | 102 }; |
| 110 | 103 |
| 111 | 104 |
| 112 // Preparse a JavaScript program. The source code is provided as a | 105 // Preparse a JavaScript program. The source code is provided as a |
| 113 // UnicodeInputStream. The max_stack_size limits the amount of stack | 106 // UnicodeInputStream. The max_stack_size limits the amount of stack |
| 114 // space that the preparser is allowed to use. If the preparser uses | 107 // space that the preparser is allowed to use. If the preparser uses |
| 115 // more stack space than the limit provided, the result's stack_overflow() | 108 // more stack space than the limit provided, the result's stack_overflow() |
| 116 // method will return true. Otherwise the result contains preparser | 109 // method will return true. Otherwise the result contains preparser |
| 117 // data that can be used by the V8 parser to speed up parsing. | 110 // data that can be used by the V8 parser to speed up parsing. |
| 118 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, | 111 PreParserData V8EXPORT Preparse(UnicodeInputStream* input, |
| 119 size_t max_stack_size); | 112 size_t max_stack_size); |
| 120 | 113 |
| 121 } // namespace v8. | 114 } // namespace v8. |
| 122 | 115 |
| 123 #endif // PREPARSER_H | 116 #endif // PREPARSER_H |
| OLD | NEW |