Search in sources :

Example 21 with LexerlessGrammarBuilder

use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.

the class TryStatementTest method ok.

@Test
public void ok() {
    LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
    assertThat(b, JavaLexer.STATEMENT).matches("try {} catch (Exception e) {} catch (Exception e) {} finally {}").matches("try {} catch (Exception e) {} finally {}").matches("try {} catch (Exception e) {}").matches("try {} finally {}");
}
Also used : LexerlessGrammarBuilder(org.sonar.sslr.grammar.LexerlessGrammarBuilder) Test(org.junit.Test)

Example 22 with LexerlessGrammarBuilder

use of org.sonar.sslr.grammar.LexerlessGrammarBuilder in project sonar-java by SonarSource.

the class TypeParameterTest method ok.

@Test
public void ok() {
    LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
    assertThat(b, JavaLexer.TYPE_PARAMETER).matches("identifier").matches("identifier extends Foo").matches("identifier extends Foo & Bar");
}
Also used : LexerlessGrammarBuilder(org.sonar.sslr.grammar.LexerlessGrammarBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)22 LexerlessGrammarBuilder (org.sonar.sslr.grammar.LexerlessGrammarBuilder)22 ActionParser (com.sonar.sslr.api.typed.ActionParser)1 JavaNodeBuilder (org.sonar.java.ast.parser.JavaNodeBuilder)1 TreeFactory (org.sonar.java.ast.parser.TreeFactory)1 AnnotationTreeImpl (org.sonar.java.model.declaration.AnnotationTreeImpl)1 EnumConstantTreeImpl (org.sonar.java.model.declaration.EnumConstantTreeImpl)1 IdentifierTree (org.sonar.plugins.java.api.tree.IdentifierTree)1 Tree (org.sonar.plugins.java.api.tree.Tree)1