Package com.github.jknack.antlr4ide.lang

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


    verify(mocks);
  }

  @Test
  public void terminalSource() {
    Terminal element = createMock(Terminal.class);
    expect(element.getLiteral()).andReturn("'hello'");

    Object[] mocks = {element };

    replay(mocks);
View Full Code Here


    expect(socket.getInputStream()).andReturn(in);
    socket.close();

    Rule parserRule = createMock(ParserRule.class);
    Rule lexerRule = createMock(LexerRule.class);
    Terminal three = createMock(Terminal.class);

    PowerMock.mockStatic(ModelExtensions.class);

    Map<String, EObject> ruleMap = new HashMap<String, EObject>();
    ruleMap.put("parserRule", parserRule);
View Full Code Here

    verify(mocks);
  }

  private RuleBlock literal(final String literal) {
    Terminal terminal = createMock(Terminal.class);
    expect(terminal.getLiteral()).andReturn(literal);

    EList<EObject> body = new BasicEList<EObject>();
    RuleBlock block = createMock(RuleBlock.class);

    body.add(terminal);
View Full Code Here

    return block;
  }

  private LexerRuleBlock lexerBlock(final String literal) {
    Terminal terminal = createMock(Terminal.class);
    expect(terminal.getLiteral()).andReturn(literal);

    EList<EObject> body = new BasicEList<EObject>();
    LexerRuleBlock block = createMock(LexerRuleBlock.class);

    body.add(terminal);
View Full Code Here

    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);

    expect(returns.getBody()).andReturn(returnBody);

    expect(locals.getBody()).andReturn(localsBody);

    ruleBodyList.add(labeledElement);
    ruleBodyList.add(terminal);
    ruleBodyList.add(actionElement);
    ruleBodyList.add(actionOption);

    expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));
    expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));

    expect(terminal.getReference()).andReturn(ID);

    expect(labeledElement.getName()).andReturn("var");

    expect(ID.getName()).andReturn("ID");
View Full Code Here

    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);

    expect(returns.getBody()).andReturn(returnBody);

    expect(locals.getBody()).andReturn(localsBody);

    ruleBodyList.add(labeledElement);
    ruleBodyList.add(terminal);
    ruleBodyList.add(actionElement);
    ruleBodyList.add(actionOption);

    expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));
    expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));

    expect(terminal.getReference()).andReturn(ID);

    expect(labeledElement.getName()).andReturn("var");

    expect(ID.getName()).andReturn("ID");
View Full Code Here

TOP

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

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.