Expand file tree Collapse file tree 3 files changed +61
-22
lines changed Original file line number Diff line number Diff line change @@ -881,20 +881,33 @@ other .
881
881
* to forbid operator names like '?-' that could not be
882
882
* sequences of SQL operators.
883
883
*/
884
- while (nchars > 1 &&
885
- (yytext[nchars - 1 ] == ' +' ||
886
- yytext[nchars - 1 ] == ' -' ))
884
+ if (nchars > 1 &&
885
+ (yytext[nchars - 1 ] == ' +' ||
886
+ yytext[nchars - 1 ] == ' -' ))
887
887
{
888
888
int ic;
889
889
890
890
for (ic = nchars - 2 ; ic >= 0 ; ic--)
891
891
{
892
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
892
+ char c = yytext[ic];
893
+ if (c == ' ~' || c == ' !' || c == ' @' ||
894
+ c == ' #' || c == ' ^' || c == ' &' ||
895
+ c == ' |' || c == ' `' || c == ' ?' ||
896
+ c == ' %' )
893
897
break ;
894
898
}
895
- if (ic >= 0 )
896
- break ; /* found a char that makes it OK */
897
- nchars--; /* else remove the +/-, and check again */
899
+ if (ic < 0 )
900
+ {
901
+ /*
902
+ * didn't find a qualifying character, so remove
903
+ * all trailing [+-]
904
+ */
905
+ do {
906
+ nchars--;
907
+ } while (nchars > 1 &&
908
+ (yytext[nchars - 1 ] == ' +' ||
909
+ yytext[nchars - 1 ] == ' -' ));
910
+ }
898
911
}
899
912
900
913
SET_YYLLOC ();
Original file line number Diff line number Diff line change @@ -800,20 +800,33 @@ other .
800
800
* to forbid operator names like '?-' that could not be
801
801
* sequences of SQL operators.
802
802
*/
803
- while (nchars > 1 &&
804
- (yytext[nchars - 1 ] == ' +' ||
805
- yytext[nchars - 1 ] == ' -' ))
803
+ if (nchars > 1 &&
804
+ (yytext[nchars - 1 ] == ' +' ||
805
+ yytext[nchars - 1 ] == ' -' ))
806
806
{
807
807
int ic;
808
808
809
809
for (ic = nchars - 2 ; ic >= 0 ; ic--)
810
810
{
811
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
811
+ char c = yytext[ic];
812
+ if (c == ' ~' || c == ' !' || c == ' @' ||
813
+ c == ' #' || c == ' ^' || c == ' &' ||
814
+ c == ' |' || c == ' `' || c == ' ?' ||
815
+ c == ' %' )
812
816
break ;
813
817
}
814
- if (ic >= 0 )
815
- break ; /* found a char that makes it OK */
816
- nchars--; /* else remove the +/-, and check again */
818
+ if (ic < 0 )
819
+ {
820
+ /*
821
+ * didn't find a qualifying character, so remove
822
+ * all trailing [+-]
823
+ */
824
+ do {
825
+ nchars--;
826
+ } while (nchars > 1 &&
827
+ (yytext[nchars - 1 ] == ' +' ||
828
+ yytext[nchars - 1 ] == ' -' ));
829
+ }
817
830
}
818
831
819
832
if (nchars < yyleng)
Original file line number Diff line number Diff line change @@ -686,20 +686,33 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
686
686
* to forbid operator names like '?-' that could not be
687
687
* sequences of SQL operators.
688
688
*/
689
- while (nchars > 1 &&
690
- (yytext[nchars- 1 ] == ' +' ||
691
- yytext[nchars- 1 ] == ' -' ))
689
+ if (nchars > 1 &&
690
+ (yytext[nchars - 1 ] == ' +' ||
691
+ yytext[nchars - 1 ] == ' -' ))
692
692
{
693
693
int ic;
694
694
695
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
695
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
696
696
{
697
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
697
+ char c = yytext[ic];
698
+ if (c == ' ~' || c == ' !' || c == ' @' ||
699
+ c == ' #' || c == ' ^' || c == ' &' ||
700
+ c == ' |' || c == ' `' || c == ' ?' ||
701
+ c == ' %' )
698
702
break ;
699
703
}
700
- if (ic >= 0 )
701
- break ; /* found a char that makes it OK */
702
- nchars--; /* else remove the +/-, and check again */
704
+ if (ic < 0 )
705
+ {
706
+ /*
707
+ * didn't find a qualifying character, so remove
708
+ * all trailing [+-]
709
+ */
710
+ do {
711
+ nchars--;
712
+ } while (nchars > 1 &&
713
+ (yytext[nchars - 1 ] == ' +' ||
714
+ yytext[nchars - 1 ] == ' -' ));
715
+ }
703
716
}
704
717
705
718
if (nchars < yyleng)
0 commit comments