@@ -0,0 +1,1940 @@
+/*******************************************************************************%0A * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A *******************************************************************************/%0Apackage org.eclipse.xtext.lexer;%0A%0Aimport org.antlr.runtime.ANTLRStringStream;%0Aimport org.antlr.runtime.CommonToken;%0Aimport org.antlr.runtime.CommonTokenStream;%0Aimport org.eclipse.xtext.testlanguages.parser.internal.InternalSimpleExpressionsLexer;%0A%0Aimport junit.framework.TestCase;%0A%0A/**%0A * @author Dennis Hbner - Initial contribution and API%0A * %0A */%0Apublic class LexerSLComment extends TestCase %7B%0A%09public void testSlComment() %7B%0A%09%09String model = %22//sl comment%5Cna%22;%0A%09%09InternalSimpleExpressionsLexer lexer = new InternalSimpleExpressionsLexer();%0A%09%09lexer.setCharStream(new ANTLRStringStream(model));%0A%09%09CommonTokenStream stream = new CommonTokenStream(lexer);%0A%09%09Object inLineComment = stream.getTokens().get(0);%0A%09%09assertTrue(inLineComment instanceof CommonToken);%0A%09%09assertEquals(InternalSimpleExpressionsLexer.RULE_SL_COMMENT, ((CommonToken) inLineComment).getType());%0A%09%7D%0A%0A%09/**%0A%09 * see BUG 234135: Comments on EOF not detected%0A%09 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=234135%0A%09 */%0A%09public void testSlCommentEOF() %7B%0A%09%09String model = %22a%5Cn//sl comment%22;%0A%09%09InternalSimpleExpressionsLexer lexer = new InternalSimpleExpressionsLexer();%0A%09%09lexer.setCharStream(new ANTLRStringStream(model));%0A%09%09CommonTokenStream stream = new CommonTokenStream(lexer);%0A%09%09Object eofLineComment = stream.getTokens().get(2);%0A%09%09assertTrue(eofLineComment instanceof CommonToken);%0A%09%09assertEquals(InternalSimpleExpressionsLexer.RULE_SL_COMMENT, ((CommonToken) eofLineComment).getType());%0A%09%7D%0A%7D%0A

FIX for BUG 234135: Comments on EOF not detected https://bugs.eclipse.org/bugs/show_bug.cgi?id=234135