Package com.github.jknack.antlr4ide.lang

Examples of com.github.jknack.antlr4ide.lang.Grammar


    String args = "[Arg a, Arg b]";
    String returnBody = "[Return r;]";
    String localsBody = "{\nLocal l;\n}";

    Grammar grammar = createMock(Grammar.class);
    ParserRule rule1 = createMock(ParserRule.class);
    Return returns = createMock(Return.class);
    LocalVars locals = createMock(LocalVars.class);
    RuleBlock ruleBody = createMock(RuleBlock.class);
    LabeledElement labeledElement = createMock(LabeledElement.class);
    Terminal terminal = createMock(Terminal.class);
    LexerRule ID = createMock(LexerRule.class);
    ActionElement actionElement = createMock(ActionElement.class);
    ActionOption actionOption = createMock(ActionOption.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getRules()).andReturn(rules);

    expect(rule1.getArgs()).andReturn(args);
    expect(rule1.getReturn()).andReturn(returns);
    expect(rule1.getLocals()).andReturn(locals);
    expect(rule1.getBody()).andReturn(ruleBody).times(2);
View Full Code Here


    String args = "[Arg a, Arg b]";
    String returnBody = "[Return r;]";
    String localsBody = "{\nLocal l;\n}";

    Grammar grammar = createMock(Grammar.class);
    ParserRule rule1 = createMock(ParserRule.class);
    Return returns = createMock(Return.class);
    LocalVars locals = createMock(LocalVars.class);
    RuleBlock ruleBody = createMock(RuleBlock.class);
    LabeledElement labeledElement = createMock(LabeledElement.class);
    Terminal terminal = createMock(Terminal.class);
    LexerRule ID = createMock(LexerRule.class);
    ActionElement actionElement = createMock(ActionElement.class);
    ActionOption actionOption = createMock(ActionOption.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getRules()).andReturn(rules);

    expect(rule1.getArgs()).andReturn(args);
    expect(rule1.getReturn()).andReturn(returns);
    expect(rule1.getLocals()).andReturn(locals);
    expect(rule1.getBody()).andReturn(ruleBody).times(2);
View Full Code Here

  @Test
  public void checkEmptyLexerGrammar() throws Exception {
    EList<Rule> rules = new BasicEList<Rule>();

    Grammar grammar = createMock(Grammar.class);
    EClass eClass = createMock(EClass.class);
    EStructuralFeature feature = createMock(EStructuralFeature.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getType()).andReturn(GrammarType.LEXER);
    expect(grammar.getRules()).andReturn(rules);
    expect(grammar.getName()).andReturn("G");
    expect(grammar.eClass()).andReturn(eClass);
    expect(eClass.getEStructuralFeature("name")).andReturn(feature);

    PowerMock.expectPrivate(validator, "error", "grammar 'G' has no rules",
        grammar, feature);
View Full Code Here

  @Test
  public void checkEmptyLexerGrammarWithParserRules() throws Exception {
    EList<Rule> rules = new BasicEList<Rule>();

    Grammar grammar = createMock(Grammar.class);
    Rule rule = createMock(Rule.class);
    EClass eClass = createMock(EClass.class);
    EStructuralFeature feature = createMock(EStructuralFeature.class);
    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    expect(grammar.getType()).andReturn(GrammarType.LEXER);
    expect(grammar.getRules()).andReturn(rules);
    expect(grammar.getName()).andReturn("G");
    expect(grammar.eClass()).andReturn(eClass);
    expect(eClass.getEStructuralFeature("name")).andReturn(feature);

    PowerMock.expectPrivate(validator, "error", "grammar 'G' has no rules",
        grammar, feature);
View Full Code Here

TOP

Related Classes of com.github.jknack.antlr4ide.lang.Grammar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.