Handle empty parser state stack

This commit is contained in:
Kovid Goyal 2021-03-20 21:14:14 +05:30
parent 7fdd6bb3e4
commit c8b5289a34
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 4 deletions

View File

@ -276,7 +276,7 @@ class Build(Command):
parser.add_option('--debug', default=False, action='store_true', parser.add_option('--debug', default=False, action='store_true',
help='Build in debug mode') help='Build in debug mode')
parser.add_option('--sanitize', default=False, action='store_true', parser.add_option('--sanitize', default=False, action='store_true',
help='Build with sanitization support. Run with LD_PREFLOAD=$(gcc -print-file-name=libasan.so)') help='Build with sanitization support. Run with LD_PRELOAD=$(gcc -print-file-name=libasan.so)')
def run(self, opts): def run(self, opts):
from setup.parallel_build import parallel_build, create_job from setup.parallel_build import parallel_build, create_job

View File

@ -737,7 +737,6 @@ class TokenQueue {
class Parser { class Parser {
private: private:
enum class ParseState : unsigned { enum class ParseState : unsigned {
normal,
escape, escape,
comment, comment,
string, string,
@ -1147,6 +1146,7 @@ class Parser {
void dispatch_current_char() { void dispatch_current_char() {
write_to_output(ch); write_to_output(ch);
if (!states.size()) { handle_normal(); return; }
switch (states.top()) { switch (states.top()) {
case ParseState::comment: case ParseState::comment:
handle_comment(); break; handle_comment(); break;
@ -1174,8 +1174,6 @@ class Parser {
handle_url_after_string(); break; handle_url_after_string(); break;
case ParseState::at_keyword: case ParseState::at_keyword:
handle_at_keyword(); break; handle_at_keyword(); break;
case ParseState::normal:
handle_normal(); break;
} }
prev_ch = ch; prev_ch = ch;
} }