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 @@ -675,20 +675,33 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
675
675
* to forbid operator names like '?-' that could not be
676
676
* sequences of SQL operators.
677
677
*/
678
- while (nchars > 1 &&
679
- (yytext[nchars- 1 ] == ' +' ||
680
- yytext[nchars- 1 ] == ' -' ))
678
+ if (nchars > 1 &&
679
+ (yytext[nchars - 1 ] == ' +' ||
680
+ yytext[nchars - 1 ] == ' -' ))
681
681
{
682
682
int ic;
683
683
684
- for (ic = nchars- 2 ; ic >= 0 ; ic--)
684
+ for (ic = nchars - 2 ; ic >= 0 ; ic--)
685
685
{
686
- if (strchr (" ~!@#^&|`?%" , yytext[ic]))
686
+ char c = yytext[ic];
687
+ if (c == ' ~' || c == ' !' || c == ' @' ||
688
+ c == ' #' || c == ' ^' || c == ' &' ||
689
+ c == ' |' || c == ' `' || c == ' ?' ||
690
+ c == ' %' )
687
691
break ;
688
692
}
689
- if (ic >= 0 )
690
- break ; /* found a char that makes it OK */
691
- nchars--; /* else remove the +/-, and check again */
693
+ if (ic < 0 )
694
+ {
695
+ /*
696
+ * didn't find a qualifying character, so remove
697
+ * all trailing [+-]
698
+ */
699
+ do {
700
+ nchars--;
701
+ } while (nchars > 1 &&
702
+ (yytext[nchars - 1 ] == ' +' ||
703
+ yytext[nchars - 1 ] == ' -' ));
704
+ }
692
705
}
693
706
694
707
if (nchars < yyleng)
You can’t perform that action at this time.
0 commit comments