Changeset 2337 for lang/javascript/jsruby
- Timestamp:
- 12/03/07 16:08:52 (5 years ago)
- Files:
-
- 1 modified
-
lang/javascript/jsruby/trunk/src/parse.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/jsruby/trunk/src/parse.js
r2328 r2337 11 11 // CompStmt: Stmt (Term+ Stmt)* 12 12 RubyEngine.Parser.prototype.compstmt = function() { 13 var x, y; 14 x=this.stmt(); 15 if (x==null || typeof(x)=="undefined") return undefined; 13 var x; 14 if ((x=this.stmt())==undefined) return undefined; 16 15 var ret = [x]; 17 16 var prebody = this.body; 18 while ( x=this.term()) {17 while (this.term()) { 19 18 while(this.term()); 20 if (!( y=this.stmt())) break;19 if (!(x=this.stmt())) break; 21 20 prebody = this.body; 22 ret.push( y);21 ret.push(x); 23 22 } 24 23 this.body = prebody; … … 34 33 RubyEngine.Parser.prototype.expr = function() { 35 34 var x, y; 36 x=this.expr2(); 37 if (x==null || typeof(x)=="undefined") return undefined; 35 if ((x=this.expr2())==undefined) return undefined; 38 36 var ret = [x] 39 37 while (this.body.match(/^[ \t]*(if|unless|while|until)/)) { … … 52 50 // Expr2: Command | Arg 53 51 RubyEngine.Parser.prototype.expr2 = function() { 54 var x, y, z; 55 var prebody = this.body; 56 if (x=this.command()) return x; 57 x=this.arg() 58 if (x!=null && typeof(x)!="undefined") return x; 59 this.body = prebody; 52 var x; 53 if ((x=this.command())!=undefined) return x; 54 if ((x=this.arg())!=undefined) return x; 60 55 return undefined; 61 56 } … … 69 64 this.body=prebody; 70 65 } 71 x=this.primary() 72 if ( x!=null && typeof(x)!="undefined") {66 67 if ((x=this.primary())!=undefined) { 73 68 if (this.body.match(/^[ \t]*\./)) { 74 69 this.body = RegExp.rightContext; … … 88 83 RubyEngine.Parser.prototype.args = function() { 89 84 var x, y; 90 if ( !(x=this.arg())) return undefined;85 if ((x=this.arg())==undefined) return undefined; 91 86 var ret = [x]; 92 87 var prebody = this.body; … … 110 105 this.body=prebody; 111 106 } 112 x=this.primary(); 113 if ( x!=null && typeof(x)!="undefined") {107 108 if ((x=this.primary())!=undefined) { 114 109 var ret = [x]; 115 110 prebody = this.body; 116 while ((x=this.operator()) && ((y=this.primary())!= null)) {111 while ((x=this.operator()) && ((y=this.primary())!=undefined)) { 117 112 prebody = this.body; 118 113 ret.push(x, y); … … 223 218 return x; 224 219 } 220 221 // if Arg Then CompStmt (elsif Arg Then CompStmt)* (else CompStmt)? end 225 222 if (this.body.match(/^[ \t]*(if)/)) { 226 223 this.body = RegExp.rightContext;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)