use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class ClassDeclarationTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.CLASS_DECLARATION).matches("class identifier <T, U extends Foo & Bar> extends Foo implements Foo, Bar<Integer> {}").matches("class identifier <T, U extends Foo & Bar> extends Foo {}").matches("class identifier <T, U extends Foo & Bar> {}").matches("class identifier {}");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class FormalParameterDeclsTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.FORMAL_PARAMETER_DECLS).matches("type foo").matches("final type foo, type bar").matches("@Foo type ... foo").matches("final final type foo").matches("@Foo @Bar type foo").matches("@Foo Foo this").matches("@Foo final @Bar final type foo");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class BlockStatementsTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.BLOCK_STATEMENTS).notMatches(// FIXME should match but issue in the way we test matching
"").matches(";").matches("int a; foo();");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class VariableDeclaratorsTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.VARIABLE_DECLARATORS).matches("foo , foo[] , foo[] = {}, foo = 42").matches("foo[] = 42 , foo").matches("foo");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class BlockStatementTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.BLOCK_STATEMENT).matches("int a;").matches("public class A {}").matches("private enum A {}").matches(";").matches("foo();");
}
Aggregations