| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/fm2js/xfa_fmparse.h" | 7 #include "xfa/fxfa/fm2js/xfa_fmparse.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 case TOKstring: | 507 case TOKstring: |
| 508 e.reset(new CXFA_FMStringExpression(line, m_pToken->m_wstring)); | 508 e.reset(new CXFA_FMStringExpression(line, m_pToken->m_wstring)); |
| 509 NextToken(); | 509 NextToken(); |
| 510 break; | 510 break; |
| 511 case TOKidentifier: { | 511 case TOKidentifier: { |
| 512 CFX_WideStringC wsIdentifier(m_pToken->m_wstring); | 512 CFX_WideStringC wsIdentifier(m_pToken->m_wstring); |
| 513 NextToken(); | 513 NextToken(); |
| 514 if (m_pToken->m_type == TOKlbracket) { | 514 if (m_pToken->m_type == TOKlbracket) { |
| 515 CXFA_FMSimpleExpression* s = ParseIndexExpression(); | 515 CXFA_FMSimpleExpression* s = ParseIndexExpression(); |
| 516 if (s) { | 516 if (s) { |
| 517 e.reset(new CXFA_FMDotAccessorExpression(line, NULL, TOKdot, | 517 e.reset(new CXFA_FMDotAccessorExpression(line, nullptr, TOKdot, |
| 518 wsIdentifier, s)); | 518 wsIdentifier, s)); |
| 519 } | 519 } |
| 520 NextToken(); | 520 NextToken(); |
| 521 } else { | 521 } else { |
| 522 e.reset(new CXFA_FMIdentifierExpressionn(line, wsIdentifier)); | 522 e.reset(new CXFA_FMIdentifierExpressionn(line, wsIdentifier)); |
| 523 } | 523 } |
| 524 } break; | 524 } break; |
| 525 case TOKif: | 525 case TOKif: |
| 526 e.reset(new CXFA_FMIdentifierExpressionn(line, m_pToken->m_wstring)); | 526 e.reset(new CXFA_FMIdentifierExpressionn(line, m_pToken->m_wstring)); |
| 527 NextToken(); | 527 NextToken(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } else if (m_pToken->m_type == TOKlbracket) { | 654 } else if (m_pToken->m_type == TOKlbracket) { |
| 655 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 655 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
| 656 if (!(m_pErrorInfo->message.IsEmpty())) { | 656 if (!(m_pErrorInfo->message.IsEmpty())) { |
| 657 delete e; | 657 delete e; |
| 658 return nullptr; | 658 return nullptr; |
| 659 } | 659 } |
| 660 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdot, tempStr, | 660 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdot, tempStr, |
| 661 s.release()); | 661 s.release()); |
| 662 } else { | 662 } else { |
| 663 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 663 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
| 664 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 664 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
| 665 e = new CXFA_FMDotAccessorExpression(line, e, TOKdot, tempStr, s); | 665 e = new CXFA_FMDotAccessorExpression(line, e, TOKdot, tempStr, s); |
| 666 continue; | 666 continue; |
| 667 } | 667 } |
| 668 } else { | 668 } else { |
| 669 CFX_WideString ws_TempString(m_pToken->m_wstring); | 669 CFX_WideString ws_TempString(m_pToken->m_wstring); |
| 670 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 670 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
| 671 ws_TempString.c_str()); | 671 ws_TempString.c_str()); |
| 672 return e; | 672 return e; |
| 673 } | 673 } |
| 674 break; | 674 break; |
| 675 case TOKdotdot: | 675 case TOKdotdot: |
| 676 NextToken(); | 676 NextToken(); |
| 677 if (m_pToken->m_type == TOKidentifier) { | 677 if (m_pToken->m_type == TOKidentifier) { |
| 678 CFX_WideStringC tempStr = m_pToken->m_wstring; | 678 CFX_WideStringC tempStr = m_pToken->m_wstring; |
| 679 uint32_t tempLine = m_pToken->m_uLinenum; | 679 uint32_t tempLine = m_pToken->m_uLinenum; |
| 680 NextToken(); | 680 NextToken(); |
| 681 if (m_pToken->m_type == TOKlbracket) { | 681 if (m_pToken->m_type == TOKlbracket) { |
| 682 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 682 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
| 683 if (!(m_pErrorInfo->message.IsEmpty())) { | 683 if (!(m_pErrorInfo->message.IsEmpty())) { |
| 684 delete e; | 684 delete e; |
| 685 return nullptr; | 685 return nullptr; |
| 686 } | 686 } |
| 687 e = new CXFA_FMDotDotAccessorExpression(tempLine, e, TOKdotdot, | 687 e = new CXFA_FMDotDotAccessorExpression(tempLine, e, TOKdotdot, |
| 688 tempStr, s.release()); | 688 tempStr, s.release()); |
| 689 } else { | 689 } else { |
| 690 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 690 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
| 691 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 691 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
| 692 e = new CXFA_FMDotDotAccessorExpression(line, e, TOKdotdot, tempStr, | 692 e = new CXFA_FMDotDotAccessorExpression(line, e, TOKdotdot, tempStr, |
| 693 s); | 693 s); |
| 694 continue; | 694 continue; |
| 695 } | 695 } |
| 696 } else { | 696 } else { |
| 697 CFX_WideString ws_TempString(m_pToken->m_wstring); | 697 CFX_WideString ws_TempString(m_pToken->m_wstring); |
| 698 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 698 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
| 699 ws_TempString.c_str()); | 699 ws_TempString.c_str()); |
| 700 return e; | 700 return e; |
| 701 } | 701 } |
| 702 break; | 702 break; |
| 703 case TOKdotscream: | 703 case TOKdotscream: |
| 704 NextToken(); | 704 NextToken(); |
| 705 if (m_pToken->m_type == TOKidentifier) { | 705 if (m_pToken->m_type == TOKidentifier) { |
| 706 CFX_WideStringC tempStr = m_pToken->m_wstring; | 706 CFX_WideStringC tempStr = m_pToken->m_wstring; |
| 707 uint32_t tempLine = m_pToken->m_uLinenum; | 707 uint32_t tempLine = m_pToken->m_uLinenum; |
| 708 NextToken(); | 708 NextToken(); |
| 709 if (m_pToken->m_type == TOKlbracket) { | 709 if (m_pToken->m_type == TOKlbracket) { |
| 710 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 710 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
| 711 if (!(m_pErrorInfo->message.IsEmpty())) { | 711 if (!(m_pErrorInfo->message.IsEmpty())) { |
| 712 delete e; | 712 delete e; |
| 713 return nullptr; | 713 return nullptr; |
| 714 } | 714 } |
| 715 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdotscream, | 715 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdotscream, |
| 716 tempStr, s.release()); | 716 tempStr, s.release()); |
| 717 } else { | 717 } else { |
| 718 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 718 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
| 719 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 719 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
| 720 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotscream, tempStr, | 720 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotscream, tempStr, |
| 721 s); | 721 s); |
| 722 continue; | 722 continue; |
| 723 } | 723 } |
| 724 } else { | 724 } else { |
| 725 CFX_WideString ws_TempString(m_pToken->m_wstring); | 725 CFX_WideString ws_TempString(m_pToken->m_wstring); |
| 726 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 726 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
| 727 ws_TempString.c_str()); | 727 ws_TempString.c_str()); |
| 728 return e; | 728 return e; |
| 729 } | 729 } |
| 730 break; | 730 break; |
| 731 case TOKdotstar: { | 731 case TOKdotstar: { |
| 732 CXFA_FMSimpleExpression* s = | 732 CXFA_FMSimpleExpression* s = |
| 733 new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, NULL, FALSE); | 733 new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, nullptr, FALSE); |
| 734 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotstar, | 734 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotstar, |
| 735 FX_WSTRC(L"*"), s); | 735 FX_WSTRC(L"*"), s); |
| 736 } break; | 736 } break; |
| 737 default: | 737 default: |
| 738 return e; | 738 return e; |
| 739 } | 739 } |
| 740 NextToken(); | 740 NextToken(); |
| 741 } | 741 } |
| 742 return e; | 742 return e; |
| 743 } | 743 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 NextToken(); | 1042 NextToken(); |
| 1043 e.reset(ParseBlockExpression()); | 1043 e.reset(ParseBlockExpression()); |
| 1044 Check(TOKend); | 1044 Check(TOKend); |
| 1045 if (m_pErrorInfo->message.IsEmpty()) { | 1045 if (m_pErrorInfo->message.IsEmpty()) { |
| 1046 e.reset(new CXFA_FMDoExpression(line, e.release())); | 1046 e.reset(new CXFA_FMDoExpression(line, e.release())); |
| 1047 } else { | 1047 } else { |
| 1048 e.reset(); | 1048 e.reset(); |
| 1049 } | 1049 } |
| 1050 return e.release(); | 1050 return e.release(); |
| 1051 } | 1051 } |
| OLD | NEW |