Looks up a word in the symbol table. Returns null if the word is not found.
(String str)
| 114 | |
| 115 | /** Looks up a word in the symbol table. Returns null if the word is not found. */ |
| 116 | Symbol lookupWord(String str) { |
| 117 | Symbol symbol; |
| 118 | String symStr; |
| 119 | for (int i=0; i<=stLoc; i++) { |
| 120 | symbol = table[i]; |
| 121 | if (symbol.type!=STRING_CONSTANT && str.equals(symbol.str)) { |
| 122 | symTabLoc = i; |
| 123 | return symbol; |
| 124 | } |
| 125 | } |
| 126 | return null; |
| 127 | } |
| 128 | |
| 129 | void saveGlobals(Interpreter interp) { |
| 130 | if (interp.topOfStack==-1) |