Skip to content

Commit

Permalink
mostly whitespace, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Derohanian committed Oct 10, 2012
1 parent 9c4b4b8 commit d29d50e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/JBrowse/parse.js
Expand Up @@ -22,45 +22,45 @@ function parseGBConfig(data){


//Process each line
for (var i = 0; i < n; i++){
if(this.regex.comment.test(this.lines[i])){ // #this is a comment
for (var i = 0; i < n; i++) {
if (this.regex.comment.test(this.lines[i])) { // #this is a comment
// do nothing, since it's a comment.
}else if(this.regex.halfParam.test(this.lines[i])){ // name =
i = isMultiLine(i); // skips lines, so get where to continue
}else if(this.regex.param.test(this.lines[i])){ // name = value
isParam(i);
}else if(this.regex.section.test(this.lines[i])){ // [section_name]
isSection(i);
} else if (this.regex.halfParam.test(this.lines[i])) { // name =
i = MultiLine(i); // skips lines, so get where to continue
} else if (this.regex.param.test(this.lines[i])) { // name = value
Param(i);
} else if (this.regex.section.test(this.lines[i])) { // [section_name]
Section(i);
}
};


return this.value; //Returns the JS object
}

function isParam(i){
function Param(i) {
var match = this.lines[i].match(this.regex.param);
if(this.section){
if (!isNaN(match[2])){
if (this.section) {
if (!isNaN(match[2])) {
match[2] = parseInt(match[2]);
}
this.value[this.section][match[1].trim()] = match[2];
}else{
if (!isNaN(match[2].trim())){
} else {
if (!isNaN(match[2].trim())) {
match[2] = parseInt(match[2].trim());
}
this.value[match[1].trim()] = match[2].trim();
}
}

function isMultiLine (i){
line = this.lines; rx = this.regex;
function MultiLine (i){
var line = this.lines; var rx = this.regex;
var lineNum = i+1;
var tmpStrVal = '';
// while (line is defined, not a parameter or function)
while (typeof line[lineNum] !== 'undefined' && (! ( rx.param.test(line[lineNum]) || rx.section.test(line[lineNum])))){
//if (line not comment or empty)
if (! ( rx.comment.test(line[lineNum]) || rx.emptyLine.test(line[lineNum]) )){
if (! ( rx.comment.test(line[lineNum]) || rx.emptyLine.test(line[lineNum]) )) {
if (tmpStrVal === ''){
tmpStrVal += line[lineNum].trim();
} else {
Expand All @@ -70,15 +70,15 @@ function isMultiLine (i){
lineNum++;
}
var match = this.lines[i].match(this.regex.param);
if(this.section){
if (this.section) {
this.value[this.section][match[1].trim()] = tmpStrVal;
}else{
} else {
this.value[match[1].trim()] = tmpStrVal;
}
return lineNum - 1; //The line it should continue at.
}

function isSection (i){
function Section (i) {
var match = this.lines[i].match(this.regex.section);
this.value[match[1].trim()] = {};
this.section = match[1].trim();
Expand Down

0 comments on commit d29d50e

Please sign in to comment.