()
| 90 | |
| 91 | |
| 92 | function InfixtoPostfix() |
| 93 | { |
| 94 | var postfix=[]; |
| 95 | var temp=0; |
| 96 | push('@'); |
| 97 | infixstring= document.getElementById("infixvalue").value; |
| 98 | var infixval=[]; |
| 99 | var temp2=""; |
| 100 | for(var i=0;i<infixstring.length;i++) |
| 101 | { |
| 102 | if(operator(infixstring[i])) |
| 103 | { |
| 104 | infixval.push(temp2); |
| 105 | infixval.push(infixstring[i]); |
| 106 | temp2=""; |
| 107 | } |
| 108 | else temp2+=infixstring[i]; |
| 109 | } |
| 110 | if(temp2!=="") |
| 111 | { |
| 112 | infixval.push(temp2); |
| 113 | } |
| 114 | |
| 115 | for(var i=0;i<infixval.length;i++) |
| 116 | { |
| 117 | var el=infixval[i]; |
| 118 | if(operator(el)) |
| 119 | { |
| 120 | if (el ==')') { |
| 121 | while (stackarr[topp] != "(") { |
| 122 | postfix[temp++] = pop(); |
| 123 | postfix[temp++]="$"; |
| 124 | } |
| 125 | pop(); |
| 126 | } |
| 127 | else if(el=='(') |
| 128 | { |
| 129 | push(el); |
| 130 | } |
| 131 | |
| 132 | else if(precedency(el)>precedency(stackarr[topp])) |
| 133 | { |
| 134 | push(el); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | while(precedency(el)<=precedency(stackarr[topp])&&topp>-1) |
| 139 | { |
| 140 | postfix[temp++]=pop(); |
| 141 | postfix[temp++]="$" |
| 142 | } |
| 143 | push(el); |
| 144 | } |
| 145 | } |
| 146 | else{ |
| 147 | postfix[temp++]=el; |
| 148 | postfix[temp++]="$" |
| 149 | } |
nothing calls this directly
no test coverage detected