MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / InputStream

Function InputStream

js/SCASTPY.js:226–256  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

224 }
225
226 function InputStream(input) {
227 var pos = 0, line = 1, col = 0;
228 return {
229 next : next,
230 peek : peek,
231 eof : eof,
232 croak : croak,
233 poi : poi
234 };
235 function next() {
236 var ch = input.charAt(pos++);
237 if (ch == "\n") line++, col = 0; else col++;
238 return ch;
239 }
240 function peek(i=0) {
241 return input.charAt(pos+i);
242 }
243 function poi() {
244 return {
245 line: line,
246 column: col,
247 pos:pos,
248 }
249 }
250 function eof() {
251 return peek() == "";
252 }
253 function croak(msg) {
254 throw new Error(msg + " (" + line + ":" + col + ")");
255 }
256 }
257
258 function parse(input){
259 var isclass=false

Callers 1

getAstFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected