use of antlr.Token in project hibernate-orm by hibernate.
the class SqlASTFactory method createUsingCtor.
@SuppressWarnings("unchecked")
protected AST createUsingCtor(Token token, String className) {
Class c;
AST t;
try {
c = Class.forName(className);
Class[] tokenArgType = new Class[] { antlr.Token.class };
Constructor ctor = c.getConstructor(tokenArgType);
if (ctor != null) {
t = (AST) ctor.newInstance(token);
initializeSqlNode(t);
} else {
// just do the regular thing if you can't find the ctor
// Your AST must have default ctor to use this.
t = create(c);
}
} catch (Exception e) {
throw new IllegalArgumentException("Invalid class or can't make instance, " + className);
}
return t;
}
use of antlr.Token in project groovy by apache.
the class LexerFrame method actionPerformed.
public void actionPerformed(ActionEvent ae) {
Token token = (Token) ((JComponent) ae.getSource()).getClientProperty("token");
if (token.getType() == Token.EOF_TYPE) {
scriptPane.select(0, 0);
return;
}
try {
int start = scriptPane.getLineStartOffset(token.getLine() - 1) + token.getColumn() - 1;
scriptPane.select(start, start + token.getText().length());
scriptPane.requestFocus();
} catch (BadLocationException ex) {
// IGNORE
}
}
use of antlr.Token in project sonarqube by SonarSource.
the class ValidWhenLexer method mLESSTHANSIGN.
public final void mLESSTHANSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = LESSTHANSIGN;
int _saveIndex;
match('<');
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
use of antlr.Token in project sonarqube by SonarSource.
the class ValidWhenLexer method mEQUALSIGN.
public final void mEQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = EQUALSIGN;
int _saveIndex;
match('=');
match('=');
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
use of antlr.Token in project sonarqube by SonarSource.
the class ValidWhenLexer method mGREATEREQUALSIGN.
public final void mGREATEREQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = GREATEREQUALSIGN;
int _saveIndex;
match('>');
match('=');
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
_returnToken = _token;
}
Aggregations