use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class ResourceTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.RESOURCE).matches("final List<Integer> foo = 0").matches("final @Nullable List<Integer> foo = 0").matches("List<Integer> foo[] = foo");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class InterfaceDeclarationTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.INTERFACE_DECLARATION).matches("interface identifier <T, U extends Foo & Bar> extends Foo, Bar<Integer> {}").matches("interface identifier <T, U extends Foo & Bar> {}").matches("interface identifier {}");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class FormalParameterDeclsRestTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.FORMAL_PARAMETERS_DECLS_REST).matches("foo").matches("this").matches("foo , type bar").matches("this , type bar").matches("Main.this , type bar").matches(// invalid syntax but supported by our grammar
"foo, type this").matches("... foo").matches("@Foo ... foo");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class FormalParametersTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.FORMAL_PARAMETERS).matches("( )").matches("( int foo, int... bar )").matches("( int enum, int... bar )");
}
use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.
the class ModifiersTest method ok.
@Test
public void ok() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
assertThat(b, JavaLexer.MODIFIERS).matches("@Nullable").matches("public").matches("protected").matches("private").matches("static").matches("abstract").matches("final").matches("native").matches("synchronized").matches("transient").matches("volatile").matches("strictfp").matches("@NotNull public static @Nullable final");
}
Aggregations