101 parenthesesState(IgnoreParentheses), |
101 parenthesesState(IgnoreParentheses), |
102 parenthesesCount(0), |
102 parenthesesCount(0), |
103 prohibitAutomaticSemicolon(false), |
103 prohibitAutomaticSemicolon(false), |
104 tokenizeComments(tokenizeComments) |
104 tokenizeComments(tokenizeComments) |
105 { |
105 { |
106 driver->setLexer(this); |
106 if (driver) driver->setLexer(this); |
107 // allocate space for read buffers |
107 // allocate space for read buffers |
108 buffer8 = new char[size8]; |
108 buffer8 = new char[size8]; |
109 buffer16 = new QChar[size16]; |
109 buffer16 = new QChar[size16]; |
110 pattern = 0; |
110 pattern = 0; |
111 flags = 0; |
111 flags = 0; |
675 if (restrKeyword) { |
675 if (restrKeyword) { |
676 token = QDeclarativeJSGrammar::T_SEMICOLON; |
676 token = QDeclarativeJSGrammar::T_SEMICOLON; |
677 setDone(Other); |
677 setDone(Other); |
678 } else |
678 } else |
679 state = Start; |
679 state = Start; |
680 driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
680 if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
681 } else if (current == 0) { |
681 } else if (current == 0) { |
682 driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
682 if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
683 setDone(Eof); |
683 setDone(Eof); |
684 } |
684 } |
685 |
685 |
686 break; |
686 break; |
687 case InMultiLineComment: |
687 case InMultiLineComment: |
688 if (current == 0) { |
688 if (current == 0) { |
689 setDone(Bad); |
689 setDone(Bad); |
690 err = UnclosedComment; |
690 err = UnclosedComment; |
691 errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file"); |
691 errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file"); |
692 driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
692 if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
693 } else if (isLineTerminator()) { |
693 } else if (isLineTerminator()) { |
694 shiftWindowsLineBreak(); |
694 shiftWindowsLineBreak(); |
695 yylineno++; |
695 yylineno++; |
696 } else if (current == '*' && next1 == '/') { |
696 } else if (current == '*' && next1 == '/') { |
697 state = Start; |
697 state = Start; |
698 shift(1); |
698 shift(1); |
699 driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
699 if (driver) driver->addComment(startpos, tokenLength(), startlineno, startcolumn); |
700 } |
700 } |
701 |
701 |
702 break; |
702 break; |
703 case InIdentifier: |
703 case InIdentifier: |
704 if (isIdentLetter(current) || isDecimalDigit(current)) { |
704 if (isIdentLetter(current) || isDecimalDigit(current)) { |