svnno****@sourc*****
svnno****@sourc*****
2011年 5月 14日 (土) 23:59:21 JST
Revision: 2674 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2674 Author: dhrname Date: 2011-05-14 23:59:21 +0900 (Sat, 14 May 2011) Log Message: ----------- String型にprevメソッドを追加 Modified Paths: -------------- branches/07x/077/org/w3c/dom/css.js Modified: branches/07x/077/org/w3c/dom/css.js =================================================================== --- branches/07x/077/org/w3c/dom/css.js 2011-05-14 12:57:37 UTC (rev 2673) +++ branches/07x/077/org/w3c/dom/css.js 2011-05-14 14:59:21 UTC (rev 2674) @@ -692,6 +692,23 @@ this.cssRules.splice(index, 1); }; +/*prevメソッド + *String型において、一つずつ前の文字をチェックしていく。パーサのさいに使う + *プロパティの設定上、文字列リテラルに対しては使用できないが、Stringオブジェクトに使用可能。 + * + *new String("d") -> ok + *"d" -> no + */ +/*string*/ String.prototype.prev = function(/*string*/ ch) { + !this._number && (this._number = this.length -1); + var t = this.charAt(this._number); + --this._number; + if (ch && (ch !== t)) { + throw new Error("文法エラー(Syntax Error)") + } else { + return t; + } +}; /*getComputedStyle関数 *最近の計算値を取得する。Document.defaultViewはSafariがグローバル(window)にサポートしていないため付ける。