File tree Expand file tree Collapse file tree 3 files changed +61
-22
lines changed 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 @@ -798,20 +798,33 @@ other .
798
798
* to forbid operator names like '?-' that could not be
799
799
* sequences of SQL operators.
800
800
*/
801
- while (nchars > 1 &&
802
- (yytext[nchars - 1 ] == ' +' ||
803
- yytext[nchars - 1 ] == ' -' ))
801
+ if (nchars > 1 &&
802
+ (yytext[nchars - 1 ] == ' +' ||
803
+ yytext[nchars - 1 ] == ' -' ))
804
804
{
805
805
int ic;
806
806
807
807
for (ic = nchars - 2 ; ic >= 0 ; ic--)
808
808
{
809
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
809
+ char c = yytext[ic];
810
+ if (c == ' ~' || c == ' !' || c == ' @' ||
811
+ c == ' #' || c == ' ^' || c == ' &' ||
812
+ c == ' |' || c == ' `' || c == ' ?' ||
813
+ c == ' %' )
810
814
break ;
811
815
}
812
- if (ic >= 0 )
813
- break ; /* found a char that makes it OK */
814
- nchars--; /* else remove the +/-, and check again */
816
+ if (ic < 0 )
817
+ {
818
+ /*
819
+ * didn't find a qualifying character, so remove
820
+ * all trailing [+-]
821
+ */
822
+ do {
823
+ nchars--;
824
+ } while (nchars > 1 &&
825
+ (yytext[nchars - 1 ] == ' +' ||
826
+ yytext[nchars - 1 ] == ' -' ));
827
+ }
815
828
}
816
829
817
830
if (nchars < yyleng)
Original file line number Diff line number Diff line change @@ -687,20 +687,33 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
687
687
* to forbid operator names like '?-' that could not be
688
688
* sequences of SQL operators.
689
689
*/
690
- while (nchars > 1 &&
691
- (yytext[nchars- 1 ] == ' +' ||
692
- yytext[nchars- 1 ] == ' -' ))
690
+ if (nchars > 1 &&
691
+ (yytext[nchars - 1 ] == ' +' ||
692
+ yytext[nchars - 1 ] == ' -' ))
693
693
{
694
694
int ic;
695
695
696
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
696
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
697
697
{
698
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
698
+ char c = yytext[ic];
699
+ if (c == ' ~' || c == ' !' || c == ' @' ||
700
+ c == ' #' || c == ' ^' || c == ' &' ||
701
+ c == ' |' || c == ' `' || c == ' ?' ||
702
+ c == ' %' )
699
703
break ;
700
704
}
701
- if (ic >= 0 )
702
- break ; /* found a char that makes it OK */
703
- nchars--; /* else remove the +/-, and check again */
705
+ if (ic < 0 )
706
+ {
707
+ /*
708
+ * didn't find a qualifying character, so remove
709
+ * all trailing [+-]
710
+ */
711
+ do {
712
+ nchars--;
713
+ } while (nchars > 1 &&
714
+ (yytext[nchars - 1 ] == ' +' ||
715
+ yytext[nchars - 1 ] == ' -' ));
716
+ }
704
717
}
705
718
706
719
if (nchars < yyleng)
You can’t perform that action at this time.
0 commit comments