1818#include "abstract.h"
1919#endif /* PGEN */
2020
21+ /* Alternate tab spacing */
22+ #define ALTTABSIZE 1
23+
2124#define is_potential_identifier_start (c ) (\
2225 (c >= 'a' && c <= 'z')\
2326 || (c >= 'A' && c <= 'Z')\
@@ -133,9 +136,6 @@ tok_new(void)
133136 tok -> prompt = tok -> nextprompt = NULL ;
134137 tok -> lineno = 0 ;
135138 tok -> level = 0 ;
136- tok -> altwarning = 1 ;
137- tok -> alterror = 1 ;
138- tok -> alttabsize = 1 ;
139139 tok -> altindstack [0 ] = 0 ;
140140 tok -> decoding_state = STATE_INIT ;
141141 tok -> decoding_erred = 0 ;
@@ -1283,22 +1283,9 @@ PyToken_ThreeChars(int c1, int c2, int c3)
12831283static int
12841284indenterror (struct tok_state * tok )
12851285{
1286- if (tok -> alterror ) {
1287- tok -> done = E_TABSPACE ;
1288- tok -> cur = tok -> inp ;
1289- return 1 ;
1290- }
1291- if (tok -> altwarning ) {
1292- #ifdef PGEN
1293- PySys_WriteStderr ("inconsistent use of tabs and spaces "
1294- "in indentation\n" );
1295- #else
1296- PySys_FormatStderr ("%U: inconsistent use of tabs and spaces "
1297- "in indentation\n" , tok -> filename );
1298- #endif
1299- tok -> altwarning = 0 ;
1300- }
1301- return 0 ;
1286+ tok -> done = E_TABSPACE ;
1287+ tok -> cur = tok -> inp ;
1288+ return ERRORTOKEN ;
13021289}
13031290
13041291#ifdef PGEN
@@ -1378,9 +1365,8 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
13781365 col ++ , altcol ++ ;
13791366 }
13801367 else if (c == '\t' ) {
1381- col = (col /tok -> tabsize + 1 ) * tok -> tabsize ;
1382- altcol = (altcol /tok -> alttabsize + 1 )
1383- * tok -> alttabsize ;
1368+ col = (col / tok -> tabsize + 1 ) * tok -> tabsize ;
1369+ altcol = (altcol / ALTTABSIZE + 1 ) * ALTTABSIZE ;
13841370 }
13851371 else if (c == '\014' ) {/* Control-L (formfeed) */
13861372 col = altcol = 0 ; /* For Emacs users */
@@ -1409,9 +1395,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
14091395 if (col == tok -> indstack [tok -> indent ]) {
14101396 /* No change */
14111397 if (altcol != tok -> altindstack [tok -> indent ]) {
1412- if (indenterror (tok )) {
1413- return ERRORTOKEN ;
1414- }
1398+ return indenterror (tok );
14151399 }
14161400 }
14171401 else if (col > tok -> indstack [tok -> indent ]) {
@@ -1422,9 +1406,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
14221406 return ERRORTOKEN ;
14231407 }
14241408 if (altcol <= tok -> altindstack [tok -> indent ]) {
1425- if (indenterror (tok )) {
1426- return ERRORTOKEN ;
1427- }
1409+ return indenterror (tok );
14281410 }
14291411 tok -> pendin ++ ;
14301412 tok -> indstack [++ tok -> indent ] = col ;
@@ -1443,9 +1425,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
14431425 return ERRORTOKEN ;
14441426 }
14451427 if (altcol != tok -> altindstack [tok -> indent ]) {
1446- if (indenterror (tok )) {
1447- return ERRORTOKEN ;
1448- }
1428+ return indenterror (tok );
14491429 }
14501430 }
14511431 }
0 commit comments