Updated the token emmission mechanism to include token line/column info

git-svn-id: https://smali.googlecode.com/svn/trunk@100 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-06 18:53:40 +00:00
parent 9cbaa76e44
commit e186646752

View File

@ -161,20 +161,29 @@ import java.util.ArrayDeque;
tokens.add(Token.SKIP_TOKEN);
}
public void emit(Token token) {
tokens.add(token);
}
public void emit(Token token, int type) {
token.setType(type);
tokens.add(token);
}
public void emit(Token token, int type, int channel) {
token.setType(type);
token.setChannel(channel);
tokens.add(token);
}
public void emit(Token token) {
token.setLine(state.tokenStartLine);
token.setText(state.text);
token.setCharPositionInLine(state.tokenStartCharPositionInLine);
tokens.add(token);
}
public void emit(Token token, int type) {
token.setLine(state.tokenStartLine);
token.setText(state.text);
token.setCharPositionInLine(state.tokenStartCharPositionInLine);
token.setType(type);
tokens.add(token);
}
public void emit(Token token, int type, int channel) {
token.setLine(state.tokenStartLine);
token.setText(state.text);
token.setCharPositionInLine(state.tokenStartCharPositionInLine);
token.setType(type);
token.setChannel(channel);
tokens.add(token);
}
public String getErrorHeader(RecognitionException e) {
return getSourceName()+"["+ e.line+","+e.charPositionInLine+"]";