﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AQuorn%2FSyntaxHighlight</id>
	<title>利用者:Quorn/SyntaxHighlight - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AQuorn%2FSyntaxHighlight"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Quorn/SyntaxHighlight&amp;action=history"/>
	<updated>2026-04-30T02:51:23Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Quorn/SyntaxHighlight&amp;diff=77399&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Quorn/SyntaxHighlight&amp;diff=77399&amp;oldid=prev"/>
		<updated>2018-06-28T18:36:20Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 18:36時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Quorn/SyntaxHighlight&amp;diff=77398&amp;oldid=prev</id>
		<title>2008年7月28日 (月) 15:39にwiki&gt;Quornによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Quorn/SyntaxHighlight&amp;diff=77398&amp;oldid=prev"/>
		<updated>2008-07-28T15:39:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Syntax Highlighting=&lt;br /&gt;
Committed to gsoc-2008-quorn branch: ['''[http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&amp;amp;root=bf-blender&amp;amp;revision=15837 rev. 15837]''']&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
Calculating syntax highlighting for the whole document for every typed key is&lt;br /&gt;
crazy. Since Python is line based, only the current line needs reparsing, with&lt;br /&gt;
added consideration for multi-line statements.&lt;br /&gt;
&lt;br /&gt;
Lines only affect the other lines in the following cases:&lt;br /&gt;
* Triple quoted strings:&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Some text in here...&lt;br /&gt;
           ...&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
* Explicit line joining in other strings:&lt;br /&gt;
        &amp;quot;This is a string \&lt;br /&gt;
        over multiple \&lt;br /&gt;
        lines. &amp;quot; + 'So \&lt;br /&gt;
        is this.'&lt;br /&gt;
&lt;br /&gt;
The method render_string(st, str) populates temp_char_buf with the string str&lt;br /&gt;
(rendered with spaces in place of tabs). The format string is currently the same&lt;br /&gt;
length as this for each line.&lt;br /&gt;
&lt;br /&gt;
I propose to keep the linep-&amp;gt;format one char longer than temp_char_buf so that&lt;br /&gt;
we may keep a flag at the end:&lt;br /&gt;
 1 0 0 &amp;quot; S o m e   t e x t   i n   t h e   l i n e &amp;quot;\0&lt;br /&gt;
 n n n l l l l l l l l l l l l l l l l l l l l l l l\0\x&lt;br /&gt;
&lt;br /&gt;
Here x is a line continuation flag indicating the starting state of the line to&lt;br /&gt;
follow. So lines forming the first part of a multi-line string will end with a&lt;br /&gt;
non-zero flag. The value of the flag will indicate the type of string open:&lt;br /&gt;
 0x00    No strings open&lt;br /&gt;
 0x01    Single-quoted string open ('...')&lt;br /&gt;
 0x02    Double-quoted string open (&amp;quot;...&amp;quot;)&lt;br /&gt;
 0x05    Triple single-quoted string open ('''...''')&lt;br /&gt;
 0x06    Triple double-quoted string open (&amp;quot;&amp;quot;&amp;quot;...&amp;quot;&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 Line:   1 0 0 &amp;quot; &amp;quot; &amp;quot; M u l t i - l i n e\0&lt;br /&gt;
 Format: n n n l l l l l l l l l l l l l\0\6&lt;br /&gt;
 Line:   s t a t e m e n t s\0&lt;br /&gt;
 Format: l l l l l l l l l l\0\6&lt;br /&gt;
 Line:   g o   l i k e   t h i s . &amp;quot; &amp;quot; &amp;quot;\0&lt;br /&gt;
 Format: l l l l l l l l l l l l l l l l\0\0&lt;br /&gt;
&lt;br /&gt;
With this system, a line being edited need only look at the end of the previous&lt;br /&gt;
line to work out how to format itself. If its format ends with a continuation&lt;br /&gt;
(different to how it started) the next line should be reformatted, and so on&lt;br /&gt;
until a non-continuation line is reached (or the continuation doesn't change).&lt;br /&gt;
&lt;br /&gt;
This vastly reduces the need for parsing and will speed up editing of large&lt;br /&gt;
files.&lt;br /&gt;
&lt;br /&gt;
==Results==&lt;br /&gt;
The original &amp;lt;code&amp;gt;get_format_string&amp;lt;/code&amp;gt; method was unnecessarily large and&lt;br /&gt;
difficult to understand. Rewriting it I now have two, well commented methods&lt;br /&gt;
that are easy to follow: &amp;lt;code&amp;gt;txt_format_line(...)&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;txt_format_text(...)&amp;lt;/code&amp;gt;, the latter of which achieves the same result&lt;br /&gt;
as &amp;lt;code&amp;gt;get_format_string(...)&amp;lt;/code&amp;gt; but in much quicker time.&lt;br /&gt;
&lt;br /&gt;
The numbers speak for themselves...&lt;br /&gt;
&lt;br /&gt;
Timing results for 100,000 iterations of the whole document (all lines&lt;br /&gt;
reparsed):&lt;br /&gt;
 Timing syntax highlighting...    (small script)&lt;br /&gt;
     New system took: 2.209049&lt;br /&gt;
     Old system took: 5.150172&lt;br /&gt;
     New system took: 2.207988&lt;br /&gt;
     Old system took: 5.115926&lt;br /&gt;
 Timing syntax highlighting...    (large script)&lt;br /&gt;
     New system took: 34.184102&lt;br /&gt;
     Old system took: 81.666011&lt;br /&gt;
     New system took: 34.200491&lt;br /&gt;
     Old system took: 80.773203&lt;br /&gt;
&lt;br /&gt;
Since the new system also minimizes the number of lines parsed, this is only the&lt;br /&gt;
worst case! Memory is now also allocated in one place reducing the chances of&lt;br /&gt;
error.&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
New format chars:&lt;br /&gt;
 '_'   Whitespace&lt;br /&gt;
 '#'   Comment text&lt;br /&gt;
 '!'   Punctuation and other symbols&lt;br /&gt;
 'n'   Numerals&lt;br /&gt;
 'l'   String letters&lt;br /&gt;
 'v'   Special variables (class, def)&lt;br /&gt;
 'b'   Built-in names (print, for, etc.)&lt;br /&gt;
 'q'   Other text (identifiers, etc.)&lt;br /&gt;
 &lt;br /&gt;
Format chars in prior versions:&lt;br /&gt;
 'l'   Letters (strings)&lt;br /&gt;
 'b'   Built in functions (keywords)&lt;br /&gt;
 '#'   Comments&lt;br /&gt;
 'v'   Special variables (&amp;quot;class&amp;quot; and &amp;quot;def&amp;quot;) except&lt;br /&gt;
       that these are covered by 'b' above so 'v' is&lt;br /&gt;
       never actually used.&lt;br /&gt;
 'n'   Numbers&lt;br /&gt;
 'q'   Other text, symbols, etc&lt;br /&gt;
 ' '   Whitespace&lt;/div&gt;</summary>
		<author><name>wiki&gt;Quorn</name></author>
		
	</entry>
</feed>