java - How to make the StreamTokenizer to recognize chars blending with numbers as Words -


everything in question :) i'm developing calculator wich uses reverse polish notation. works fine except when streamtokenizer encounters 354a or 1b. want here streamtokenizer sees word , not number followed word. here code :

st = new streamtokenizer(f); st.resetsyntax(); st.eolissignificant(false); st.wordchars('a', 'z'); st.wordchars('a', 'z'); st.whitespacechars(32, 32); st.parsenumbers();  while (st.ttype != streamtokenizer.tt_eof){     int ttype = st.ttype; if (ttype == streamtokenizer.tt_number) {       calc.empile(st.nval); }        else{   if (!calc.stack.isempty()) {     switch (ttype) {     case '+':           calc.plus();       break;     case '-':       calc.moins();       break;     case '*':       calc.mult();       break;     case '/':       calc.div();       break;       }     }   }   st.nexttoken(); } 

there answer: streamtokenizer splits 001_to_003 2 tokens; how can prevent doing so?

but think this: how sidestep tt_number streamtokenizer

...and try parse doubles or ints iterating result.

hope helps, though there no clear answer question here...


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -