Lines 247-262
Link Here
|
247 |
tokens.add(new FunctionPtg(name,(byte)numArgs)); |
247 |
tokens.add(new FunctionPtg(name,(byte)numArgs)); |
248 |
} else if (Look == ':') { // this is a AreaReference |
248 |
} else if (Look == ':') { // this is a AreaReference |
249 |
String first = name; |
249 |
String first = name; |
250 |
GetChar(); |
250 |
Match(':'); |
251 |
String second = GetName(); |
251 |
String second = GetName(); |
252 |
tokens.add(new AreaPtg(first+":"+second)); |
252 |
tokens.add(new AreaPtg(first+":"+second)); |
253 |
//String second = ; |
|
|
254 |
} else { |
253 |
} else { |
255 |
//this can be either a cell ref or a named range !! |
254 |
//this can be either a cell ref or a named range !! |
256 |
|
|
|
257 |
boolean cellRef = true ; //we should probably do it with reg exp?? |
255 |
boolean cellRef = true ; //we should probably do it with reg exp?? |
258 |
if (cellRef) { |
256 |
if (cellRef) { |
259 |
tokens.add(new ReferencePtg(name)); //TODO we need to pass in Name somewhere?? |
257 |
tokens.add(new ReferencePtg(name)); |
260 |
}else { |
258 |
}else { |
261 |
//handle after named range is integrated!! |
259 |
//handle after named range is integrated!! |
262 |
} |
260 |
} |
Lines 270-276
Link Here
|
270 |
numArgs++; |
268 |
numArgs++; |
271 |
Expression(); |
269 |
Expression(); |
272 |
} |
270 |
} |
273 |
while (Look == ',') { |
271 |
while (Look == ',') { //TODO handle EmptyArgs |
274 |
Match(','); |
272 |
Match(','); |
275 |
Expression(); |
273 |
Expression(); |
276 |
numArgs++; |
274 |
numArgs++; |
Lines 289-298
Link Here
|
289 |
} else if (IsAlpha(Look)){ |
287 |
} else if (IsAlpha(Look)){ |
290 |
Ident(); |
288 |
Ident(); |
291 |
}else{ |
289 |
}else{ |
292 |
|
290 |
String number = GetNum(); |
293 |
IntPtg p = new IntPtg(); |
291 |
if (Look=='.') { |
294 |
p.setValue(Short.parseShort(GetNum())); |
292 |
Match('.'); |
295 |
tokens.add(p); |
293 |
String decimalPart = null; |
|
|
294 |
if (IsDigit(Look)) number = number +"."+ GetNum(); //this also takes care of someone entering "1234." |
295 |
tokens.add(new NumberPtg(number)); |
296 |
} else { |
297 |
//IntPtg p = new IntPtg(GetNum()); // removing since a ptg should be able to create itself from parser results. |
298 |
//p.setValue(Short.parseShort(GetNum())); |
299 |
tokens.add(new IntPtg(number)); //TODO:what if the number is too big to be a short? ..add factory to return Int or Number! |
300 |
} |
296 |
} |
301 |
} |
297 |
} |
302 |
} |
298 |
|
303 |
|
Lines 489-494
Link Here
|
489 |
|
494 |
|
490 |
wb.write(out); |
495 |
wb.write(out); |
491 |
out.close(); |
496 |
out.close(); |
|
|
497 |
|
498 |
System.out.println(file.getCanonicalPath()); |
492 |
} catch (java.io.IOException ioe) { |
499 |
} catch (java.io.IOException ioe) { |
493 |
ioe.printStackTrace(); |
500 |
ioe.printStackTrace(); |
494 |
} |
501 |
} |