use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class CatchClauseTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.CATCH_CLAUSE).matches("catch (Exception e) {}").matches("catch (Exception | Error e) {}");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class VariableDeclaratorTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.VARIABLE_DECLARATOR).matches("identifier [] [] = 0").notMatches(// FIXME missing bracket token
"identifier [] []").matches("identifier [] = {}").notMatches(// FIXME missing bracket token
"identifier []").matches("identifier = 0").matches("identifier").matches("enum");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class TypeParametersTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.TYPE_PARAMETERS).matches("< T >").matches("< T , U extends Foo & Bar >");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class TypeDeclarationTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.TYPE_DECLARATION).matches("class Foo {}").matches("enum Foo {}").matches("interface Foo {}").matches("@interface Foo {}").matches("public class Foo {}").matches("public private class Foo {}").matches(";");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class FormalParameterTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.FORMAL_PARAMETER).matches("int foo").notMatches(// FIXME missing [] tokens
"final List<Integer> foo[]").matches("@Foo int foo").notMatches("@Foo Type this").matches("final final int foo").matches("@Foo @Bar int foo").matches("@Foo final @Bar final int foo");
}
Aggregations