From 8d1cc709340da845d76f84220fe92c11e6217ff3 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 09:36:14 -0700 Subject: Made use of semicolons consistent and updated new files to use the new RDGE namespace --- js/lib/rdge/materials/material-parser.js | 81 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 41 deletions(-) (limited to 'js/lib/rdge/materials/material-parser.js') diff --git a/js/lib/rdge/materials/material-parser.js b/js/lib/rdge/materials/material-parser.js index b334c05d..c078c3af 100755 --- a/js/lib/rdge/materials/material-parser.js +++ b/js/lib/rdge/materials/material-parser.js @@ -4,66 +4,65 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ -var MaterialParser = function MaterialParser( theStr ) { +var MaterialParser = function MaterialParser(theStr) { - this._strBuffer = theStr; + this._strBuffer = theStr; - this.nextValue = function( prop, endKeyArg, advanceBufferArg ) { - if (!this._strBuffer) return; + this.nextValue = function (prop, endKeyArg, advanceBufferArg) { + if (!this._strBuffer) return; - // make the 2 & 3rd argument optional. default is to advance the string - var endKey = "\n", advanceBuffer = true; - if (endKeyArg) { - endKey = endKeyArg; + // make the 2 & 3rd argument optional. default is to advance the string + var endKey = "\n", advanceBuffer = true; + if (endKeyArg) { + endKey = endKeyArg; } - if (advanceBufferArg) { - advanceBuffer = advanceBufferArg; + if (advanceBufferArg) { + advanceBuffer = advanceBufferArg; } - var iStart = this._strBuffer.indexOf( prop ); - if (iStart < 0) return; + var iStart = this._strBuffer.indexOf(prop); + if (iStart < 0) return; - var iEnd = this._strBuffer.indexOf( endKey, iStart ); - if (iEnd < 0) throw new Error( "property " + prop + " improperly terminated: " + this._strBuffer); + var iEnd = this._strBuffer.indexOf(endKey, iStart); + if (iEnd < 0) throw new Error("property " + prop + " improperly terminated: " + this._strBuffer); - iStart += prop.length; - var nChars = iEnd - iStart; - var rtnStr = this._strBuffer.substr( iStart, nChars ); + iStart += prop.length; + var nChars = iEnd - iStart; + var rtnStr = this._strBuffer.substr(iStart, nChars); - if (advanceBuffer) { - this._strBuffer = this._strBuffer.substr( iEnd + endKey.length ); + if (advanceBuffer) { + this._strBuffer = this._strBuffer.substr(iEnd + endKey.length); } - return rtnStr; - }; + return rtnStr; + }; - this.nextToken = function() { - if (!this._strBuffer) return; + this.nextToken = function () { + if (!this._strBuffer) return; - // find the limits - var index = this._strBuffer.search( /\S/ ); // first non-whitespace character - if (index > 0) this._strBuffer = this._strBuffer.slice(index); - index = this._strBuffer.search( /\s/ ); // first whitespace character marking the end of the token + // find the limits + var index = this._strBuffer.search(/\S/); // first non-whitespace character + if (index > 0) this._strBuffer = this._strBuffer.slice(index); + index = this._strBuffer.search(/\s/); // first whitespace character marking the end of the token - var token; - if (index > 0) { - token = this._strBuffer.slice(0, index); - this._strBuffer = this._strBuffer.slice( index ); - } + var token; + if (index > 0) { + token = this._strBuffer.slice(0, index); + this._strBuffer = this._strBuffer.slice(index); + } - return token; - }; + return token; + }; - this.advancePastToken = function( token ) { - var index = this._strBuffer.indexOf( token ); - if (index < 0) { - console.log( "could not find token: " + token + " in string: " + this._strBuffer ); + this.advancePastToken = function (token) { + var index = this._strBuffer.indexOf(token); + if (index < 0) { + console.log("could not find token: " + token + " in string: " + this._strBuffer); } else { - this._strBuffer = this._strBuffer.substr( index + token.length ); + this._strBuffer = this._strBuffer.substr(index + token.length); } - } - + }; }; if (typeof exports === "object") { -- cgit v1.2.3