File tree Expand file tree Collapse file tree 3 files changed +63
-24
lines changed Expand file tree Collapse file tree 3 files changed +63
-24
lines changed Original file line number Diff line number Diff line change @@ -844,20 +844,33 @@ other .
844
844
* to forbid operator names like '?-' that could not be
845
845
* sequences of SQL operators.
846
846
*/
847
- while (nchars > 1 &&
848
- (yytext[nchars- 1 ] == ' +' ||
849
- yytext[nchars- 1 ] == ' -' ))
847
+ if (nchars > 1 &&
848
+ (yytext[nchars - 1 ] == ' +' ||
849
+ yytext[nchars - 1 ] == ' -' ))
850
850
{
851
851
int ic;
852
852
853
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
853
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
854
854
{
855
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
855
+ char c = yytext[ic];
856
+ if (c == ' ~' || c == ' !' || c == ' @' ||
857
+ c == ' #' || c == ' ^' || c == ' &' ||
858
+ c == ' |' || c == ' `' || c == ' ?' ||
859
+ c == ' %' )
856
860
break ;
857
861
}
858
- if (ic >= 0 )
859
- break ; /* found a char that makes it OK */
860
- nchars--; /* else remove the +/-, and check again */
862
+ if (ic < 0 )
863
+ {
864
+ /*
865
+ * didn't find a qualifying character, so remove
866
+ * all trailing [+-]
867
+ */
868
+ do {
869
+ nchars--;
870
+ } while (nchars > 1 &&
871
+ (yytext[nchars - 1 ] == ' +' ||
872
+ yytext[nchars - 1 ] == ' -' ));
873
+ }
861
874
}
862
875
863
876
SET_YYLLOC ();
Original file line number Diff line number Diff line change @@ -811,20 +811,33 @@ other .
811
811
* to forbid operator names like '?-' that could not be
812
812
* sequences of SQL operators.
813
813
*/
814
- while (nchars > 1 &&
815
- (yytext[nchars- 1 ] == ' +' ||
816
- yytext[nchars- 1 ] == ' -' ))
814
+ if (nchars > 1 &&
815
+ (yytext[nchars - 1 ] == ' +' ||
816
+ yytext[nchars - 1 ] == ' -' ))
817
817
{
818
818
int ic;
819
819
820
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
820
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
821
821
{
822
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
822
+ char c = yytext[ic];
823
+ if (c == ' ~' || c == ' !' || c == ' @' ||
824
+ c == ' #' || c == ' ^' || c == ' &' ||
825
+ c == ' |' || c == ' `' || c == ' ?' ||
826
+ c == ' %' )
823
827
break ;
824
828
}
825
- if (ic >= 0 )
826
- break ; /* found a char that makes it OK */
827
- nchars--; /* else remove the +/-, and check again */
829
+ if (ic < 0 )
830
+ {
831
+ /*
832
+ * didn't find a qualifying character, so remove
833
+ * all trailing [+-]
834
+ */
835
+ do {
836
+ nchars--;
837
+ } while (nchars > 1 &&
838
+ (yytext[nchars - 1 ] == ' +' ||
839
+ yytext[nchars - 1 ] == ' -' ));
840
+ }
828
841
}
829
842
830
843
if (nchars < yyleng)
Original file line number Diff line number Diff line change @@ -657,20 +657,33 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
657
657
* to forbid operator names like '?-' that could not be
658
658
* sequences of SQL operators.
659
659
*/
660
- while (nchars > 1 &&
661
- (yytext[nchars- 1 ] == ' +' ||
662
- yytext[nchars- 1 ] == ' -' ))
660
+ if (nchars > 1 &&
661
+ (yytext[nchars - 1 ] == ' +' ||
662
+ yytext[nchars - 1 ] == ' -' ))
663
663
{
664
664
int ic;
665
665
666
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
666
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
667
667
{
668
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
668
+ char c = yytext[ic];
669
+ if (c == ' ~' || c == ' !' || c == ' @' ||
670
+ c == ' #' || c == ' ^' || c == ' &' ||
671
+ c == ' |' || c == ' `' || c == ' ?' ||
672
+ c == ' %' )
669
673
break ;
670
674
}
671
- if (ic >= 0 )
672
- break ; /* found a char that makes it OK */
673
- nchars--; /* else remove the +/-, and check again */
675
+ if (ic < 0 )
676
+ {
677
+ /*
678
+ * didn't find a qualifying character, so remove
679
+ * all trailing [+-]
680
+ */
681
+ do {
682
+ nchars--;
683
+ } while (nchars > 1 &&
684
+ (yytext[nchars - 1 ] == ' +' ||
685
+ yytext[nchars - 1 ] == ' -' ));
686
+ }
674
687
}
675
688
676
689
if (nchars < yyleng)
You can’t perform that action at this time.
0 commit comments