Package org.antlr.runtime

Examples of org.antlr.runtime.Lexer


   * @return a descriptor representing the outcoming of this operation
   *
   * @throws Throwable in case of any errors
   */
  public ParsingResult run() throws Throwable {
    Lexer lexer = getLexer();
    ParsingResult parsingResult;

    if ( grammarRuleTestGroup.getRuleType() == RuleType.LEXER ) {
      Method rule = lexer.getClass().getMethod( "m" + grammarRuleTestGroup.getName() );

      parsingResult = invokeRule( lexer, rule );
    }
    else {
      CommonTokenStream tokens = new CommonTokenStream( lexer );
View Full Code Here


   * @return a descriptor representing the outcoming of this operation
   *
   * @throws Throwable in case of any errors
   */
  public ParsingResult run() throws Throwable {
    Lexer lexer = getLexer();
    ParsingResult parsingResult = null;

    if ( grammarRuleTestGroup.getRuleType() == RuleType.LEXER ) {
      Method rule = lexer.getClass().getMethod( "m" + grammarRuleTestGroup.getName() );

      parsingResult = invokeRule( lexer, rule );
    }
    else {
      CommonTokenStream tokens = new CommonTokenStream( lexer );
View Full Code Here

            }
        };

        // TODO: is it very inefficient to create a new lexer and parser for each input string?
        CharStream s = new ANTLRStringStream(expression);
        Lexer lexer = new QuietLexer(s);
        CommonTokenStream tokens = new CommonTokenStream();
        tokens.setTokenSource(lexer);
        AfterthoughtParser parser = new AfterthoughtParser(tokens);
        parser.setHelper(helper);
View Full Code Here

   * @return a descriptor representing the outcoming of this operation
   *
   * @throws Throwable in case of any errors
   */
  public ParsingResult run() throws Throwable {
    Lexer lexer = getLexer();
    ParsingResult parsingResult = null;

    if ( grammarRuleTestGroup.getRuleType() == RuleType.LEXER ) {
      Method rule = lexer.getClass().getMethod( "m" + grammarRuleTestGroup.getName() );

      parsingResult = invokeRule( lexer, rule );
    }
    else {
      CommonTokenStream tokens = new CommonTokenStream( lexer );
View Full Code Here

            String txt;
            String expecting;
            // bleh same exception class has different fields set depending on
            // where it occurred
            if (antlr instanceof Lexer) {
                Lexer lexer = (Lexer) antlr;
                txt = lexer.getCharErrorDisplay(re.c);
                expecting = lexer.getCharErrorDisplay(mte.expecting);
            } else {
                if (mte.token.getText() != null) {
                    txt = "'" + mte.token.getText() + "'";
                } else {
                    txt = names[mte.token.getType()];
View Full Code Here

    private static final Log log = LogFactory.getLog(ParserUtil.class.getName());

    public static HBqlParser newHBqlParser(final String sql) throws ParseException {
        try {
            log.debug("Parsing: " + sql);
            final Lexer lex = new HBqlLexer(new ANTLRStringStream(sql));
            final CommonTokenStream tokens = new CommonTokenStream(lex);
            return new HBqlParser(tokens);
        }
        catch (LexerRecognitionException e) {
            throw new ParseException(e.getRecognitionExecption(), e.getMessage());
View Full Code Here

TOP

Related Classes of org.antlr.runtime.Lexer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.