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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 case TOKstring: | 505 case TOKstring: |
506 e.reset(new CXFA_FMStringExpression(line, m_pToken->m_wstring)); | 506 e.reset(new CXFA_FMStringExpression(line, m_pToken->m_wstring)); |
507 NextToken(); | 507 NextToken(); |
508 break; | 508 break; |
509 case TOKidentifier: { | 509 case TOKidentifier: { |
510 CFX_WideStringC wsIdentifier(m_pToken->m_wstring); | 510 CFX_WideStringC wsIdentifier(m_pToken->m_wstring); |
511 NextToken(); | 511 NextToken(); |
512 if (m_pToken->m_type == TOKlbracket) { | 512 if (m_pToken->m_type == TOKlbracket) { |
513 CXFA_FMSimpleExpression* s = ParseIndexExpression(); | 513 CXFA_FMSimpleExpression* s = ParseIndexExpression(); |
514 if (s) { | 514 if (s) { |
515 e.reset(new CXFA_FMDotAccessorExpression(line, NULL, TOKdot, | 515 e.reset(new CXFA_FMDotAccessorExpression(line, nullptr, TOKdot, |
516 wsIdentifier, s)); | 516 wsIdentifier, s)); |
517 } | 517 } |
518 NextToken(); | 518 NextToken(); |
519 } else { | 519 } else { |
520 e.reset(new CXFA_FMIdentifierExpressionn(line, wsIdentifier)); | 520 e.reset(new CXFA_FMIdentifierExpressionn(line, wsIdentifier)); |
521 } | 521 } |
522 } break; | 522 } break; |
523 case TOKif: | 523 case TOKif: |
524 e.reset(new CXFA_FMIdentifierExpressionn(line, m_pToken->m_wstring)); | 524 e.reset(new CXFA_FMIdentifierExpressionn(line, m_pToken->m_wstring)); |
525 NextToken(); | 525 NextToken(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 } else if (m_pToken->m_type == TOKlbracket) { | 652 } else if (m_pToken->m_type == TOKlbracket) { |
653 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 653 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
654 if (!(m_pErrorInfo->message.IsEmpty())) { | 654 if (!(m_pErrorInfo->message.IsEmpty())) { |
655 delete e; | 655 delete e; |
656 return nullptr; | 656 return nullptr; |
657 } | 657 } |
658 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdot, tempStr, | 658 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdot, tempStr, |
659 s.release()); | 659 s.release()); |
660 } else { | 660 } else { |
661 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 661 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
662 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 662 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
663 e = new CXFA_FMDotAccessorExpression(line, e, TOKdot, tempStr, s); | 663 e = new CXFA_FMDotAccessorExpression(line, e, TOKdot, tempStr, s); |
664 continue; | 664 continue; |
665 } | 665 } |
666 } else { | 666 } else { |
667 CFX_WideString ws_TempString(m_pToken->m_wstring); | 667 CFX_WideString ws_TempString(m_pToken->m_wstring); |
668 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 668 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
669 ws_TempString.c_str()); | 669 ws_TempString.c_str()); |
670 return e; | 670 return e; |
671 } | 671 } |
672 break; | 672 break; |
673 case TOKdotdot: | 673 case TOKdotdot: |
674 NextToken(); | 674 NextToken(); |
675 if (m_pToken->m_type == TOKidentifier) { | 675 if (m_pToken->m_type == TOKidentifier) { |
676 CFX_WideStringC tempStr = m_pToken->m_wstring; | 676 CFX_WideStringC tempStr = m_pToken->m_wstring; |
677 uint32_t tempLine = m_pToken->m_uLinenum; | 677 uint32_t tempLine = m_pToken->m_uLinenum; |
678 NextToken(); | 678 NextToken(); |
679 if (m_pToken->m_type == TOKlbracket) { | 679 if (m_pToken->m_type == TOKlbracket) { |
680 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 680 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
681 if (!(m_pErrorInfo->message.IsEmpty())) { | 681 if (!(m_pErrorInfo->message.IsEmpty())) { |
682 delete e; | 682 delete e; |
683 return nullptr; | 683 return nullptr; |
684 } | 684 } |
685 e = new CXFA_FMDotDotAccessorExpression(tempLine, e, TOKdotdot, | 685 e = new CXFA_FMDotDotAccessorExpression(tempLine, e, TOKdotdot, |
686 tempStr, s.release()); | 686 tempStr, s.release()); |
687 } else { | 687 } else { |
688 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 688 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
689 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 689 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
690 e = new CXFA_FMDotDotAccessorExpression(line, e, TOKdotdot, tempStr, | 690 e = new CXFA_FMDotDotAccessorExpression(line, e, TOKdotdot, tempStr, |
691 s); | 691 s); |
692 continue; | 692 continue; |
693 } | 693 } |
694 } else { | 694 } else { |
695 CFX_WideString ws_TempString(m_pToken->m_wstring); | 695 CFX_WideString ws_TempString(m_pToken->m_wstring); |
696 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 696 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
697 ws_TempString.c_str()); | 697 ws_TempString.c_str()); |
698 return e; | 698 return e; |
699 } | 699 } |
700 break; | 700 break; |
701 case TOKdotscream: | 701 case TOKdotscream: |
702 NextToken(); | 702 NextToken(); |
703 if (m_pToken->m_type == TOKidentifier) { | 703 if (m_pToken->m_type == TOKidentifier) { |
704 CFX_WideStringC tempStr = m_pToken->m_wstring; | 704 CFX_WideStringC tempStr = m_pToken->m_wstring; |
705 uint32_t tempLine = m_pToken->m_uLinenum; | 705 uint32_t tempLine = m_pToken->m_uLinenum; |
706 NextToken(); | 706 NextToken(); |
707 if (m_pToken->m_type == TOKlbracket) { | 707 if (m_pToken->m_type == TOKlbracket) { |
708 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); | 708 std::unique_ptr<CXFA_FMSimpleExpression> s(ParseIndexExpression()); |
709 if (!(m_pErrorInfo->message.IsEmpty())) { | 709 if (!(m_pErrorInfo->message.IsEmpty())) { |
710 delete e; | 710 delete e; |
711 return nullptr; | 711 return nullptr; |
712 } | 712 } |
713 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdotscream, | 713 e = new CXFA_FMDotAccessorExpression(tempLine, e, TOKdotscream, |
714 tempStr, s.release()); | 714 tempStr, s.release()); |
715 } else { | 715 } else { |
716 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( | 716 CXFA_FMSimpleExpression* s = new CXFA_FMIndexExpression( |
717 tempLine, ACCESSOR_NO_INDEX, NULL, FALSE); | 717 tempLine, ACCESSOR_NO_INDEX, nullptr, FALSE); |
718 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotscream, tempStr, | 718 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotscream, tempStr, |
719 s); | 719 s); |
720 continue; | 720 continue; |
721 } | 721 } |
722 } else { | 722 } else { |
723 CFX_WideString ws_TempString(m_pToken->m_wstring); | 723 CFX_WideString ws_TempString(m_pToken->m_wstring); |
724 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, | 724 Error(m_pToken->m_uLinenum, kFMErrExpectedIdentifier, |
725 ws_TempString.c_str()); | 725 ws_TempString.c_str()); |
726 return e; | 726 return e; |
727 } | 727 } |
728 break; | 728 break; |
729 case TOKdotstar: { | 729 case TOKdotstar: { |
730 CXFA_FMSimpleExpression* s = | 730 CXFA_FMSimpleExpression* s = |
731 new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, NULL, FALSE); | 731 new CXFA_FMIndexExpression(line, ACCESSOR_NO_INDEX, nullptr, FALSE); |
732 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotstar, | 732 e = new CXFA_FMDotAccessorExpression(line, e, TOKdotstar, |
733 FX_WSTRC(L"*"), s); | 733 FX_WSTRC(L"*"), s); |
734 } break; | 734 } break; |
735 default: | 735 default: |
736 return e; | 736 return e; |
737 } | 737 } |
738 NextToken(); | 738 NextToken(); |
739 } | 739 } |
740 return e; | 740 return e; |
741 } | 741 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 NextToken(); | 1040 NextToken(); |
1041 e.reset(ParseBlockExpression()); | 1041 e.reset(ParseBlockExpression()); |
1042 Check(TOKend); | 1042 Check(TOKend); |
1043 if (m_pErrorInfo->message.IsEmpty()) { | 1043 if (m_pErrorInfo->message.IsEmpty()) { |
1044 e.reset(new CXFA_FMDoExpression(line, e.release())); | 1044 e.reset(new CXFA_FMDoExpression(line, e.release())); |
1045 } else { | 1045 } else { |
1046 e.reset(); | 1046 e.reset(); |
1047 } | 1047 } |
1048 return e.release(); | 1048 return e.release(); |
1049 } | 1049 } |
OLD | NEW |