public void issue(Token token, int number, params object[] inf) { string location = ""; if ( token != null ) location = "(" + (token.begin.number+1).ToString() + "," + (token.begin.position+1).ToString() + ") "; string message = String.Format(templates[number],inf); pool.Add("error: " + location + message); count++; }
public void fatal(Token token, int number, params object[] inf) { issue(token,number,inf); throw new FatalError(); }
public Token skipUntil(TokenCode stop) { Token token; while (true) { token = getToken(); if ( token.code == stop ) break; if ( token.code == TokenCode.EOF ) errors.fatal(token,10); forget(); } current = token; return token; }
public Token get() { if ( current == null ) current = getToken(); return current; }
public void forget() { current = null; }
public Lexer(Source source, Errors errors) { this.source = source; this.errors = errors; this.current = null; }