Code example for StringBufferInputStream

0
	public boolean parse(String expr) throws IllegalArgumentException {
		CharStream input = null;
		//		if (args.length > 0) input = new ANTLRFileStream(args[0]); 
		//		else  
		try { 
          input = new ANTLRInputStream(new StringBufferInputStream(expr));
        } catch (IOException e1) {
          System.err.println(e1.getMessage());
          return false; 
        } 
		QuestionConditionLexer lex = new QuestionConditionLexer(input);
		CommonTokenStream tokens = new CommonTokenStream(lex);
		QuestionConditionParser parser = new QuestionConditionParser(tokens, interpreter);
		try { 
			try { 
				return parser.expression();				
			} catch (IllegalArgumentException ie) {
				String message = "Invalid Expression: " +ie.getMessage();
                //System.err.println(message); 
                throw new IllegalArgumentException(message, ie);				
Contextual code suggestions in your IDE  Get Codota for Java