mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	A bunch of minor stuff.
Lots of support for new macros defined in myformat.sty; including the new indexing macros, seealso environment & friends, and the byte code instruction support.
This commit is contained in:
		
							parent
							
								
									05dd3c09ab
								
							
						
					
					
						commit
						a4541af0ba
					
				
					 2 changed files with 230 additions and 18 deletions
				
			
		
							
								
								
									
										124
									
								
								Doc/partparse.py
									
										
									
									
									
								
							
							
						
						
									
										124
									
								
								Doc/partparse.py
									
										
									
									
									
								
							|  | @ -1063,6 +1063,9 @@ def do_funcdesc(length, buf, pp, i): | ||||||
|     elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: |     elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: | ||||||
| 	command = 'deffn' | 	command = 'deffn' | ||||||
| 	cat_class = 'function of ' + string.join(idxsi[1:]) | 	cat_class = 'function of ' + string.join(idxsi[1:]) | ||||||
|  |     elif len(idxsi) > 3 and idxsi[:2] == ['in', 'modules']: | ||||||
|  | 	command = 'deffn' | ||||||
|  | 	cat_class = 'function of ' + string.join(idxsi[1:]) | ||||||
| 
 | 
 | ||||||
|     if not command: |     if not command: | ||||||
| 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | ||||||
|  | @ -1110,9 +1113,11 @@ def do_excdesc(length, buf, pp, i): | ||||||
| 	command = 'defcv' | 	command = 'defcv' | ||||||
| 	cat_class = 'exception' | 	cat_class = 'exception' | ||||||
| 	class_class = string.join(idxsi[2:]) | 	class_class = string.join(idxsi[2:]) | ||||||
| 
 |     elif idxsi == ['built-in', 'exception', 'base', 'class']: | ||||||
| 
 | 	command = 'defcv' | ||||||
|     if not command: | 	cat_class = 'exception' | ||||||
|  | 	class_class = "exception base class" | ||||||
|  |     else: | ||||||
| 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | ||||||
| 
 | 
 | ||||||
|     ch.chtype = chunk_type[CSLINE] |     ch.chtype = chunk_type[CSLINE] | ||||||
|  | @ -1177,6 +1182,31 @@ def do_datadesc(length, buf, pp, i): | ||||||
|     return length, i |     return length, i | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def do_opcodedesc(length, buf, pp, i): | ||||||
|  |     startpoint = i-1 | ||||||
|  |     ch = pp[startpoint] | ||||||
|  |     wh = ch.where | ||||||
|  |     length, newi = getnextarg(length, buf, pp, i) | ||||||
|  |     dataname = chunk(GROUP, wh, pp[i:newi]) | ||||||
|  |     del pp[i:newi] | ||||||
|  |     length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  |     ch.chtype = chunk_type[CSLINE] | ||||||
|  |     ch.data = "defcv" | ||||||
|  | 
 | ||||||
|  |     cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, "data")]), | ||||||
|  | 		 chunk(PLAIN, wh, ' '), | ||||||
|  | 		 chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]), | ||||||
|  | 		 chunk(PLAIN, wh, ' '), | ||||||
|  | 		 dataname, | ||||||
|  | 		 ] | ||||||
|  | 
 | ||||||
|  |     pp.insert(i, chunk(GROUP, wh, cslinearg)) | ||||||
|  |     i, length = i+1, length+1 | ||||||
|  |     hist.command = ch.data | ||||||
|  |     return length, i | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # regular indices: those that are not set in tt font by default.... | # regular indices: those that are not set in tt font by default.... | ||||||
| regindices = ('cindex', ) | regindices = ('cindex', ) | ||||||
| 
 | 
 | ||||||
|  | @ -1378,6 +1408,22 @@ def changeit(buf, pp): | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
| 		length, i = do_datadesc(length, buf, pp, i) | 		length, i = do_datadesc(length, buf, pp, i) | ||||||
| 
 | 
 | ||||||
|  | 	    elif envname == 'opcodedesc': | ||||||
|  | 		pp.insert(i, chunk(PLAIN, ch.where, '')) | ||||||
|  | 		i, length = i+1, length+1 | ||||||
|  | 		length, i = do_opcodedesc(length, buf, pp, i) | ||||||
|  | 
 | ||||||
|  | 	    elif envname == 'seealso': | ||||||
|  | 		chunks = [chunk(ENDLINE, ch.where, "\n"), | ||||||
|  | 			  chunk(CSNAME, ch.where, "b"), | ||||||
|  | 			  chunk(GROUP, ch.where, [ | ||||||
|  | 			      chunk(PLAIN, ch.where, "See also: ")]), | ||||||
|  | 			  chunk(ENDLINE, ch.where, "\n"), | ||||||
|  | 			  chunk(ENDLINE, ch.where, "\n")] | ||||||
|  | 		pp[i-1:i] = chunks | ||||||
|  | 		length = length + len(chunks) - 1 | ||||||
|  | 		i = i + len(chunks) - 1 | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print 'WARNING: don\'t know what to do with env ' + `envname` | 		print 'WARNING: don\'t know what to do with env ' + `envname` | ||||||
| 
 | 
 | ||||||
|  | @ -1430,8 +1476,12 @@ def changeit(buf, pp): | ||||||
| 			  chunk(GROUP, ch.where, [ | 			  chunk(GROUP, ch.where, [ | ||||||
| 			  chunk(PLAIN, ch.where, hist.command)])] | 			  chunk(PLAIN, ch.where, hist.command)])] | ||||||
| 		i, length = i+2, length+2 | 		i, length = i+2, length+2 | ||||||
|  | 
 | ||||||
|  | 	    elif envname in ('seealso', 'opcodedesc'): | ||||||
|  | 		pass | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print 'WARNING: ending env ' + `envname` + 'has no actions' | 		print 'WARNING: ending env %s has no actions' % `envname` | ||||||
| 
 | 
 | ||||||
| 	elif ch.chtype == chunk_type[CSNAME]: | 	elif ch.chtype == chunk_type[CSNAME]: | ||||||
| 	    # control name transformations | 	    # control name transformations | ||||||
|  | @ -1753,7 +1803,7 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'bimodindex': | 	    elif s_buf_data in ('bimodindex', 'refbimodindex'): | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		ch.data = 'pindex' | 		ch.data = 'pindex' | ||||||
| 		length, newi = getnextarg(length, buf, pp, i) | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | @ -1770,10 +1820,27 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'refmodindex': | ||||||
|  | 		ch.chtype = chunk_type[CSLINE] | ||||||
|  | 		ch.data = 'pindex' | ||||||
|  | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | 		ingroupch = pp[i:newi] | ||||||
|  | 		del pp[i:newi] | ||||||
|  | 		length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  | ## 		ingroupch.append(chunk(PLAIN, ch.where, ' ')) | ||||||
|  | ## 		ingroupch.append(chunk(CSNAME, ch.where, 'r')) | ||||||
|  | ## 		ingroupch.append(chunk(GROUP, ch.where, [ | ||||||
|  | ## 			  chunk(PLAIN, ch.where, | ||||||
|  | ## 			  '(built-in)')])) | ||||||
|  | 
 | ||||||
|  | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
|  | 		length, i = length+1, i+1 | ||||||
|  | 
 | ||||||
| 	    elif s_buf_data == 'sectcode': | 	    elif s_buf_data == 'sectcode': | ||||||
| 		ch.data = 'code' | 		ch.data = 'code' | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'stmodindex': | 	    elif s_buf_data in ('stmodindex', 'refstmodindex'): | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		# use the program index as module index | 		# use the program index as module index | ||||||
| 		ch.data = 'pindex' | 		ch.data = 'pindex' | ||||||
|  | @ -1791,8 +1858,27 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'stindex': | 	    elif s_buf_data in ('stmodindex', 'refstmodindex'): | ||||||
|  | 		ch.chtype = chunk_type[CSLINE] | ||||||
|  | 		# use the program index as module index | ||||||
|  | 		ch.data = 'pindex' | ||||||
|  | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | 		ingroupch = pp[i:newi] | ||||||
|  | 		del pp[i:newi] | ||||||
|  | 		length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  | 		ingroupch.append(chunk(PLAIN, ch.where, ' ')) | ||||||
|  | 		ingroupch.append(chunk(CSNAME, ch.where, 'r')) | ||||||
|  | 		ingroupch.append(chunk(GROUP, ch.where, [ | ||||||
|  | 			  chunk(PLAIN, ch.where, | ||||||
|  | 			  '(standard)')])) | ||||||
|  | 
 | ||||||
|  | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
|  | 		length, i = length+1, i+1 | ||||||
|  | 
 | ||||||
|  | 	    elif s_buf_data in ('stindex', 'kwindex'): | ||||||
| 		# XXX must actually go to newindex st | 		# XXX must actually go to newindex st | ||||||
|  | 		what = (s_buf_data[:2] == "st") and "statement" or "keyword" | ||||||
| 		wh = ch.where | 		wh = ch.where | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		ch.data = 'cindex' | 		ch.data = 'cindex' | ||||||
|  | @ -1804,7 +1890,7 @@ def changeit(buf, pp): | ||||||
| 		length = length - (newi-i) | 		length = length - (newi-i) | ||||||
| 
 | 
 | ||||||
| 		t = ingroupch[:] | 		t = ingroupch[:] | ||||||
| 		t.append(chunk(PLAIN, wh, ' statement')) | 		t.append(chunk(PLAIN, wh, ' ' + what)) | ||||||
| 
 | 
 | ||||||
| 		pp.insert(i, chunk(GROUP, wh, t)) | 		pp.insert(i, chunk(GROUP, wh, t)) | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
|  | @ -1813,7 +1899,7 @@ def changeit(buf, pp): | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
| 
 | 
 | ||||||
| 		t = ingroupch[:] | 		t = ingroupch[:] | ||||||
| 		t.insert(0, chunk(PLAIN, wh, 'statement, ')) | 		t.insert(0, chunk(PLAIN, wh, what + ', ')) | ||||||
| 
 | 
 | ||||||
| 		pp.insert(i, chunk(GROUP, wh, t)) | 		pp.insert(i, chunk(GROUP, wh, t)) | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
|  | @ -1947,9 +2033,29 @@ def changeit(buf, pp): | ||||||
| ## 		ch.data = flattext(buf, [ch]) | ## 		ch.data = flattext(buf, [ch]) | ||||||
| ## 		ch.chtype = chunk_type[PLAIN] | ## 		ch.chtype = chunk_type[PLAIN] | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'seemodule': | ||||||
|  | 		ch.data = "code" | ||||||
|  | 		data = pp[i+1].data | ||||||
|  | 		data.insert(0, chunk(PLAIN, ch.where, " (")) | ||||||
|  | 		data.append(chunk(PLAIN, ch.where, ")")) | ||||||
|  | 		pp[i+1:i+2] = data | ||||||
|  | 		length = length + len(data) - 1 | ||||||
|  | 
 | ||||||
|  | 	    elif s_buf_data == 'seetext': | ||||||
|  | 		data = pp[i].data | ||||||
|  | 		data.insert(0, chunk(ENDLINE, ch.where, "\n")) | ||||||
|  | 		pp[i-1:i+1] = data | ||||||
|  | 		i = i - 1 | ||||||
|  | 		length = length + len(data) - 2 | ||||||
|  | 
 | ||||||
| 	    elif s_buf_data in ('noindent', 'indexsubitem'): | 	    elif s_buf_data in ('noindent', 'indexsubitem'): | ||||||
| 		pass | 		pass | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'label': | ||||||
|  | 		del pp[i-1:i+1] | ||||||
|  | 		length = length - 2 | ||||||
|  | 		i = i - 1 | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print "don't know what to do with keyword " + s_buf_data | 		print "don't know what to do with keyword " + s_buf_data | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1063,6 +1063,9 @@ def do_funcdesc(length, buf, pp, i): | ||||||
|     elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: |     elif len(idxsi) == 3 and idxsi[:2] == ['in', 'module']: | ||||||
| 	command = 'deffn' | 	command = 'deffn' | ||||||
| 	cat_class = 'function of ' + string.join(idxsi[1:]) | 	cat_class = 'function of ' + string.join(idxsi[1:]) | ||||||
|  |     elif len(idxsi) > 3 and idxsi[:2] == ['in', 'modules']: | ||||||
|  | 	command = 'deffn' | ||||||
|  | 	cat_class = 'function of ' + string.join(idxsi[1:]) | ||||||
| 
 | 
 | ||||||
|     if not command: |     if not command: | ||||||
| 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | ||||||
|  | @ -1110,9 +1113,11 @@ def do_excdesc(length, buf, pp, i): | ||||||
| 	command = 'defcv' | 	command = 'defcv' | ||||||
| 	cat_class = 'exception' | 	cat_class = 'exception' | ||||||
| 	class_class = string.join(idxsi[2:]) | 	class_class = string.join(idxsi[2:]) | ||||||
| 
 |     elif idxsi == ['built-in', 'exception', 'base', 'class']: | ||||||
| 
 | 	command = 'defcv' | ||||||
|     if not command: | 	cat_class = 'exception' | ||||||
|  | 	class_class = "exception base class" | ||||||
|  |     else: | ||||||
| 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | 	raise error, 'don\'t know what to do with indexsubitem ' + `idxsi` | ||||||
| 
 | 
 | ||||||
|     ch.chtype = chunk_type[CSLINE] |     ch.chtype = chunk_type[CSLINE] | ||||||
|  | @ -1177,6 +1182,31 @@ def do_datadesc(length, buf, pp, i): | ||||||
|     return length, i |     return length, i | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def do_opcodedesc(length, buf, pp, i): | ||||||
|  |     startpoint = i-1 | ||||||
|  |     ch = pp[startpoint] | ||||||
|  |     wh = ch.where | ||||||
|  |     length, newi = getnextarg(length, buf, pp, i) | ||||||
|  |     dataname = chunk(GROUP, wh, pp[i:newi]) | ||||||
|  |     del pp[i:newi] | ||||||
|  |     length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  |     ch.chtype = chunk_type[CSLINE] | ||||||
|  |     ch.data = "defcv" | ||||||
|  | 
 | ||||||
|  |     cslinearg = [chunk(GROUP, wh, [chunk(PLAIN, wh, "data")]), | ||||||
|  | 		 chunk(PLAIN, wh, ' '), | ||||||
|  | 		 chunk(GROUP, wh, [chunk(PLAIN, wh, "byte code instruction")]), | ||||||
|  | 		 chunk(PLAIN, wh, ' '), | ||||||
|  | 		 dataname, | ||||||
|  | 		 ] | ||||||
|  | 
 | ||||||
|  |     pp.insert(i, chunk(GROUP, wh, cslinearg)) | ||||||
|  |     i, length = i+1, length+1 | ||||||
|  |     hist.command = ch.data | ||||||
|  |     return length, i | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # regular indices: those that are not set in tt font by default.... | # regular indices: those that are not set in tt font by default.... | ||||||
| regindices = ('cindex', ) | regindices = ('cindex', ) | ||||||
| 
 | 
 | ||||||
|  | @ -1378,6 +1408,22 @@ def changeit(buf, pp): | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
| 		length, i = do_datadesc(length, buf, pp, i) | 		length, i = do_datadesc(length, buf, pp, i) | ||||||
| 
 | 
 | ||||||
|  | 	    elif envname == 'opcodedesc': | ||||||
|  | 		pp.insert(i, chunk(PLAIN, ch.where, '')) | ||||||
|  | 		i, length = i+1, length+1 | ||||||
|  | 		length, i = do_opcodedesc(length, buf, pp, i) | ||||||
|  | 
 | ||||||
|  | 	    elif envname == 'seealso': | ||||||
|  | 		chunks = [chunk(ENDLINE, ch.where, "\n"), | ||||||
|  | 			  chunk(CSNAME, ch.where, "b"), | ||||||
|  | 			  chunk(GROUP, ch.where, [ | ||||||
|  | 			      chunk(PLAIN, ch.where, "See also: ")]), | ||||||
|  | 			  chunk(ENDLINE, ch.where, "\n"), | ||||||
|  | 			  chunk(ENDLINE, ch.where, "\n")] | ||||||
|  | 		pp[i-1:i] = chunks | ||||||
|  | 		length = length + len(chunks) - 1 | ||||||
|  | 		i = i + len(chunks) - 1 | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print 'WARNING: don\'t know what to do with env ' + `envname` | 		print 'WARNING: don\'t know what to do with env ' + `envname` | ||||||
| 
 | 
 | ||||||
|  | @ -1430,8 +1476,12 @@ def changeit(buf, pp): | ||||||
| 			  chunk(GROUP, ch.where, [ | 			  chunk(GROUP, ch.where, [ | ||||||
| 			  chunk(PLAIN, ch.where, hist.command)])] | 			  chunk(PLAIN, ch.where, hist.command)])] | ||||||
| 		i, length = i+2, length+2 | 		i, length = i+2, length+2 | ||||||
|  | 
 | ||||||
|  | 	    elif envname in ('seealso', 'opcodedesc'): | ||||||
|  | 		pass | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print 'WARNING: ending env ' + `envname` + 'has no actions' | 		print 'WARNING: ending env %s has no actions' % `envname` | ||||||
| 
 | 
 | ||||||
| 	elif ch.chtype == chunk_type[CSNAME]: | 	elif ch.chtype == chunk_type[CSNAME]: | ||||||
| 	    # control name transformations | 	    # control name transformations | ||||||
|  | @ -1753,7 +1803,7 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'bimodindex': | 	    elif s_buf_data in ('bimodindex', 'refbimodindex'): | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		ch.data = 'pindex' | 		ch.data = 'pindex' | ||||||
| 		length, newi = getnextarg(length, buf, pp, i) | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | @ -1770,10 +1820,27 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'refmodindex': | ||||||
|  | 		ch.chtype = chunk_type[CSLINE] | ||||||
|  | 		ch.data = 'pindex' | ||||||
|  | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | 		ingroupch = pp[i:newi] | ||||||
|  | 		del pp[i:newi] | ||||||
|  | 		length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  | ## 		ingroupch.append(chunk(PLAIN, ch.where, ' ')) | ||||||
|  | ## 		ingroupch.append(chunk(CSNAME, ch.where, 'r')) | ||||||
|  | ## 		ingroupch.append(chunk(GROUP, ch.where, [ | ||||||
|  | ## 			  chunk(PLAIN, ch.where, | ||||||
|  | ## 			  '(built-in)')])) | ||||||
|  | 
 | ||||||
|  | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
|  | 		length, i = length+1, i+1 | ||||||
|  | 
 | ||||||
| 	    elif s_buf_data == 'sectcode': | 	    elif s_buf_data == 'sectcode': | ||||||
| 		ch.data = 'code' | 		ch.data = 'code' | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'stmodindex': | 	    elif s_buf_data in ('stmodindex', 'refstmodindex'): | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		# use the program index as module index | 		# use the program index as module index | ||||||
| 		ch.data = 'pindex' | 		ch.data = 'pindex' | ||||||
|  | @ -1791,8 +1858,27 @@ def changeit(buf, pp): | ||||||
| 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
| 		length, i = length+1, i+1 | 		length, i = length+1, i+1 | ||||||
| 
 | 
 | ||||||
| 	    elif s_buf_data == 'stindex': | 	    elif s_buf_data in ('stmodindex', 'refstmodindex'): | ||||||
|  | 		ch.chtype = chunk_type[CSLINE] | ||||||
|  | 		# use the program index as module index | ||||||
|  | 		ch.data = 'pindex' | ||||||
|  | 		length, newi = getnextarg(length, buf, pp, i) | ||||||
|  | 		ingroupch = pp[i:newi] | ||||||
|  | 		del pp[i:newi] | ||||||
|  | 		length = length - (newi-i) | ||||||
|  | 
 | ||||||
|  | 		ingroupch.append(chunk(PLAIN, ch.where, ' ')) | ||||||
|  | 		ingroupch.append(chunk(CSNAME, ch.where, 'r')) | ||||||
|  | 		ingroupch.append(chunk(GROUP, ch.where, [ | ||||||
|  | 			  chunk(PLAIN, ch.where, | ||||||
|  | 			  '(standard)')])) | ||||||
|  | 
 | ||||||
|  | 		pp.insert(i, chunk(GROUP, ch.where, ingroupch)) | ||||||
|  | 		length, i = length+1, i+1 | ||||||
|  | 
 | ||||||
|  | 	    elif s_buf_data in ('stindex', 'kwindex'): | ||||||
| 		# XXX must actually go to newindex st | 		# XXX must actually go to newindex st | ||||||
|  | 		what = (s_buf_data[:2] == "st") and "statement" or "keyword" | ||||||
| 		wh = ch.where | 		wh = ch.where | ||||||
| 		ch.chtype = chunk_type[CSLINE] | 		ch.chtype = chunk_type[CSLINE] | ||||||
| 		ch.data = 'cindex' | 		ch.data = 'cindex' | ||||||
|  | @ -1804,7 +1890,7 @@ def changeit(buf, pp): | ||||||
| 		length = length - (newi-i) | 		length = length - (newi-i) | ||||||
| 
 | 
 | ||||||
| 		t = ingroupch[:] | 		t = ingroupch[:] | ||||||
| 		t.append(chunk(PLAIN, wh, ' statement')) | 		t.append(chunk(PLAIN, wh, ' ' + what)) | ||||||
| 
 | 
 | ||||||
| 		pp.insert(i, chunk(GROUP, wh, t)) | 		pp.insert(i, chunk(GROUP, wh, t)) | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
|  | @ -1813,7 +1899,7 @@ def changeit(buf, pp): | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
| 
 | 
 | ||||||
| 		t = ingroupch[:] | 		t = ingroupch[:] | ||||||
| 		t.insert(0, chunk(PLAIN, wh, 'statement, ')) | 		t.insert(0, chunk(PLAIN, wh, what + ', ')) | ||||||
| 
 | 
 | ||||||
| 		pp.insert(i, chunk(GROUP, wh, t)) | 		pp.insert(i, chunk(GROUP, wh, t)) | ||||||
| 		i, length = i+1, length+1 | 		i, length = i+1, length+1 | ||||||
|  | @ -1947,9 +2033,29 @@ def changeit(buf, pp): | ||||||
| ## 		ch.data = flattext(buf, [ch]) | ## 		ch.data = flattext(buf, [ch]) | ||||||
| ## 		ch.chtype = chunk_type[PLAIN] | ## 		ch.chtype = chunk_type[PLAIN] | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'seemodule': | ||||||
|  | 		ch.data = "code" | ||||||
|  | 		data = pp[i+1].data | ||||||
|  | 		data.insert(0, chunk(PLAIN, ch.where, " (")) | ||||||
|  | 		data.append(chunk(PLAIN, ch.where, ")")) | ||||||
|  | 		pp[i+1:i+2] = data | ||||||
|  | 		length = length + len(data) - 1 | ||||||
|  | 
 | ||||||
|  | 	    elif s_buf_data == 'seetext': | ||||||
|  | 		data = pp[i].data | ||||||
|  | 		data.insert(0, chunk(ENDLINE, ch.where, "\n")) | ||||||
|  | 		pp[i-1:i+1] = data | ||||||
|  | 		i = i - 1 | ||||||
|  | 		length = length + len(data) - 2 | ||||||
|  | 
 | ||||||
| 	    elif s_buf_data in ('noindent', 'indexsubitem'): | 	    elif s_buf_data in ('noindent', 'indexsubitem'): | ||||||
| 		pass | 		pass | ||||||
| 
 | 
 | ||||||
|  | 	    elif s_buf_data == 'label': | ||||||
|  | 		del pp[i-1:i+1] | ||||||
|  | 		length = length - 2 | ||||||
|  | 		i = i - 1 | ||||||
|  | 
 | ||||||
| 	    else: | 	    else: | ||||||
| 		print "don't know what to do with keyword " + s_buf_data | 		print "don't know what to do with keyword " + s_buf_data | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake