Ruby GTK3移行後のメインリポジトリ
Revisão | 181e975fc1fd6943c24c47a8aba3bba8b9ac8cfb (tree) |
---|---|
Hora | 2016-01-04 05:11:38 |
Autor | Shyouzou Sugitani <shy@user...> |
Commiter | Shyouzou Sugitani |
update misaka.rb
@@ -1,3 +1,6 @@ | ||
1 | +Mon January 4 2015 Shyouzou Sugitani <shy@users.osdn.me> | |
2 | + * 美坂互換モジュールのLexerクラスの動作速度を改善した. | |
3 | + | |
1 | 4 | Sun January 3 2015 Shyouzou Sugitani <shy@users.osdn.me> |
2 | 5 | * シグナル処理のコールバックブロックの戻り値を明示的に与えるようにした. |
3 | 6 | * otherghostnameイベントの引数が間違っていたのを修正した. |
@@ -195,20 +195,19 @@ module Misaka | ||
195 | 195 | end |
196 | 196 | |
197 | 197 | def _match(data, line, column, path) |
198 | - pos = 0 | |
199 | - end_ = data.length | |
200 | - while pos < end_ | |
198 | + temp = data.clone | |
199 | + while temp.length > 0 | |
201 | 200 | if column == 0 |
202 | - match = Re_comment.match(data[pos..-1]) | |
201 | + match = Re_comment.match(temp) | |
203 | 202 | if match != nil |
204 | 203 | column = column + match[0].length |
205 | - pos += match.end(0) | |
204 | + temp = match.post_match | |
206 | 205 | next |
207 | 206 | end |
208 | 207 | end |
209 | 208 | break_flag = false |
210 | 209 | for token, pattern in Patterns |
211 | - match = pattern.match(data[pos..-1]) | |
210 | + match = pattern.match(temp) | |
212 | 211 | if match != nil |
213 | 212 | lexeme = match[0] |
214 | 213 | if token == TOKEN_TEXT and \ |
@@ -222,13 +221,13 @@ module Misaka | ||
222 | 221 | else |
223 | 222 | @buffer << [token, lexeme, [line, column]] |
224 | 223 | end |
225 | - pos += match.end(0) | |
224 | + temp = match.post_match | |
226 | 225 | break_flag = true |
227 | 226 | break |
228 | 227 | end |
229 | 228 | end |
230 | 229 | if not break_flag |
231 | - ###print(data[pos..pos + 100 - 1]) | |
230 | + ###print(temp[0..100 - 1]) | |
232 | 231 | Misaka.lexical_error(:path => path, :position => [line, column]) |
233 | 232 | end |
234 | 233 | if token == TOKEN_NEWLINE |