@@ -100,6 +100,7 @@ PyParser_ParseFileFlagsEx(FILE *fp, const char *filename,
100100}
101101
102102#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
103+ #if 0
103104static char with_msg [] =
104105"%s:%d: Warning: 'with' will become a reserved keyword in Python 2.6\n" ;
105106
@@ -114,6 +115,7 @@ warn(const char *msg, const char *filename, int lineno)
114115 PySys_WriteStderr (msg , filename , lineno );
115116}
116117#endif
118+ #endif
117119
118120/* Parse input coming from the given tokenizer structure.
119121 Return error code. */
@@ -133,8 +135,8 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
133135 return NULL ;
134136 }
135137#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
136- if (* flags & PyPARSE_WITH_IS_KEYWORD )
137- ps -> p_flags |= CO_FUTURE_WITH_STATEMENT ;
138+ if (* flags & PyPARSE_BARRY_AS_BDFL )
139+ ps -> p_flags |= CO_FUTURE_BARRY_AS_BDFL ;
138140#endif
139141
140142 for (;;) {
@@ -177,26 +179,20 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
177179 str [len ] = '\0' ;
178180
179181#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
180- /* This is only necessary to support the "as" warning, but
181- we don't want to warn about "as" in import statements. */
182- if (type == NAME &&
183- len == 6 && str [0 ] == 'i' && strcmp (str , "import" ) == 0 )
184- handling_import = 1 ;
185-
186- /* Warn about with as NAME */
187- if (type == NAME &&
188- !(ps -> p_flags & CO_FUTURE_WITH_STATEMENT )) {
189- if (len == 4 && str [0 ] == 'w' && strcmp (str , "with" ) == 0 )
190- warn (with_msg , err_ret -> filename , tok -> lineno );
191- else if (!(handling_import || handling_with ) &&
192- len == 2 && str [0 ] == 'a' &&
193- strcmp (str , "as" ) == 0 )
194- warn (as_msg , err_ret -> filename , tok -> lineno );
182+ if (type == NOTEQUAL ) {
183+ if (!(ps -> p_flags & CO_FUTURE_BARRY_AS_BDFL ) &&
184+ strcmp (str , "!=" )) {
185+ err_ret -> error = E_SYNTAX ;
186+ break ;
187+ }
188+ else if ((ps -> p_flags & CO_FUTURE_BARRY_AS_BDFL ) &&
189+ strcmp (str , "<>" )) {
190+ err_ret -> text = "with Barry as BDFL, use '<>' "
191+ "instead of '!='" ;
192+ err_ret -> error = E_SYNTAX ;
193+ break ;
194+ }
195195 }
196- else if (type == NAME &&
197- (ps -> p_flags & CO_FUTURE_WITH_STATEMENT ) &&
198- len == 4 && str [0 ] == 'w' && strcmp (str , "with" ) == 0 )
199- handling_with = 1 ;
200196#endif
201197 if (a >= tok -> line_start )
202198 col_offset = a - tok -> line_start ;
0 commit comments