File tree 3 files changed +61
-22
lines changed
3 files changed +61
-22
lines changed Original file line number Diff line number Diff line change @@ -885,20 +885,33 @@ other .
885
885
* to forbid operator names like '?-' that could not be
886
886
* sequences of SQL operators.
887
887
*/
888
- while (nchars > 1 &&
889
- (yytext[nchars - 1 ] == ' +' ||
890
- yytext[nchars - 1 ] == ' -' ))
888
+ if (nchars > 1 &&
889
+ (yytext[nchars - 1 ] == ' +' ||
890
+ yytext[nchars - 1 ] == ' -' ))
891
891
{
892
892
int ic;
893
893
894
894
for (ic = nchars - 2 ; ic >= 0 ; ic--)
895
895
{
896
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
896
+ char c = yytext[ic];
897
+ if (c == ' ~' || c == ' !' || c == ' @' ||
898
+ c == ' #' || c == ' ^' || c == ' &' ||
899
+ c == ' |' || c == ' `' || c == ' ?' ||
900
+ c == ' %' )
897
901
break ;
898
902
}
899
- if (ic >= 0 )
900
- break ; /* found a char that makes it OK */
901
- nchars--; /* else remove the +/-, and check again */
903
+ if (ic < 0 )
904
+ {
905
+ /*
906
+ * didn't find a qualifying character, so remove
907
+ * all trailing [+-]
908
+ */
909
+ do {
910
+ nchars--;
911
+ } while (nchars > 1 &&
912
+ (yytext[nchars - 1 ] == ' +' ||
913
+ yytext[nchars - 1 ] == ' -' ));
914
+ }
902
915
}
903
916
904
917
SET_YYLLOC ();
Original file line number Diff line number Diff line change @@ -817,20 +817,33 @@ other .
817
817
* to forbid operator names like '?-' that could not be
818
818
* sequences of SQL operators.
819
819
*/
820
- while (nchars > 1 &&
821
- (yytext[nchars - 1 ] == ' +' ||
822
- yytext[nchars - 1 ] == ' -' ))
820
+ if (nchars > 1 &&
821
+ (yytext[nchars - 1 ] == ' +' ||
822
+ yytext[nchars - 1 ] == ' -' ))
823
823
{
824
824
int ic;
825
825
826
826
for (ic = nchars - 2 ; ic >= 0 ; ic--)
827
827
{
828
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
828
+ char c = yytext[ic];
829
+ if (c == ' ~' || c == ' !' || c == ' @' ||
830
+ c == ' #' || c == ' ^' || c == ' &' ||
831
+ c == ' |' || c == ' `' || c == ' ?' ||
832
+ c == ' %' )
829
833
break ;
830
834
}
831
- if (ic >= 0 )
832
- break ; /* found a char that makes it OK */
833
- nchars--; /* else remove the +/-, and check again */
835
+ if (ic < 0 )
836
+ {
837
+ /*
838
+ * didn't find a qualifying character, so remove
839
+ * all trailing [+-]
840
+ */
841
+ do {
842
+ nchars--;
843
+ } while (nchars > 1 &&
844
+ (yytext[nchars - 1 ] == ' +' ||
845
+ yytext[nchars - 1 ] == ' -' ));
846
+ }
834
847
}
835
848
836
849
if (nchars < yyleng)
Original file line number Diff line number Diff line change @@ -690,20 +690,33 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
690
690
* to forbid operator names like '?-' that could not be
691
691
* sequences of SQL operators.
692
692
*/
693
- while (nchars > 1 &&
694
- (yytext[nchars- 1 ] == ' +' ||
695
- yytext[nchars- 1 ] == ' -' ))
693
+ if (nchars > 1 &&
694
+ (yytext[nchars - 1 ] == ' +' ||
695
+ yytext[nchars - 1 ] == ' -' ))
696
696
{
697
697
int ic;
698
698
699
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
699
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
700
700
{
701
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
701
+ char c = yytext[ic];
702
+ if (c == ' ~' || c == ' !' || c == ' @' ||
703
+ c == ' #' || c == ' ^' || c == ' &' ||
704
+ c == ' |' || c == ' `' || c == ' ?' ||
705
+ c == ' %' )
702
706
break ;
703
707
}
704
- if (ic >= 0 )
705
- break ; /* found a char that makes it OK */
706
- nchars--; /* else remove the +/-, and check again */
708
+ if (ic < 0 )
709
+ {
710
+ /*
711
+ * didn't find a qualifying character, so remove
712
+ * all trailing [+-]
713
+ */
714
+ do {
715
+ nchars--;
716
+ } while (nchars > 1 &&
717
+ (yytext[nchars - 1 ] == ' +' ||
718
+ yytext[nchars - 1 ] == ' -' ));
719
+ }
707
720
}
708
721
709
722
if (nchars < yyleng)
You can’t perform that action at this time.
0 commit comments