Package com.github.jknack.antlr4ide.lang

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


    expect(ref.getId()).andReturn("VAR").times(2);

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    Object[] mocks = {rule, command, args, ref, validator };
View Full Code Here


    expect(ref.getName()).andReturn("VAR").times(2);

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    Object[] mocks = {rule, command, args, ref, validator };
View Full Code Here

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);
    expect(args.eClass()).andReturn(eClass);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "warning");

    PowerMock.expectPrivate(validator, "warning",
        "rule 'RULE' contains a lexer command with an unrecognized " +
View Full Code Here

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);
    expect(args.eClass()).andReturn(eClass);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "warning");

    PowerMock.expectPrivate(validator, "warning",
        "rule 'RULE' contains a lexer command with an unrecognized " +
View Full Code Here

    EStructuralFeature feature = createMock(EStructuralFeature.class);

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    INode node = createMock(INode.class);
    expect(node.getText()).andReturn("HIDDEN");

    PowerMock.mockStatic(NodeModelUtils.class);
View Full Code Here

    LexerCommandExpr args = createMock(LexerCommandExpr.class);
    expect(args.getRef()).andReturn(ref);
    expect(args.eClass()).andReturn(eClass);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getArgs()).andReturn(args);
    expect(command.eContainer()).andReturn(rule);

    INode node = createMock(INode.class);
    expect(node.getText()).andReturn("Something");

    PowerMock.mockStatic(NodeModelUtils.class);
View Full Code Here

  @Test
  public void validCommands() throws Exception {
    String[] commands = {"skip", "more", "popMode", "type", "channel", "mode", "pushMode" };
    for (String comamndName : commands) {
      LexerCommand command = createMock(LexerCommand.class);
      expect(command.getName()).andReturn(comamndName);

      Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

      Object[] mocks = {command, validator };
View Full Code Here

    EStructuralFeature feature = createMock(EStructuralFeature.class);

    EClass eClass = createMock(EClass.class);
    expect(eClass.getEStructuralFeature("name")).andReturn(feature);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getName()).andReturn(commandName);
    expect(command.getArgs()).andReturn(null);
    expect(command.eClass()).andReturn(eClass);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    PowerMock.expectPrivate(validator, "error", "missing argument for lexer command '"
        + commandName + "' ", command, feature);
View Full Code Here

    LexerCommandExpr args = createMock(LexerCommandExpr.class);

    EClass eClass = createMock(EClass.class);
    expect(eClass.getEStructuralFeature("name")).andReturn(feature);

    LexerCommand command = createMock(LexerCommand.class);
    expect(command.getName()).andReturn(commandName);
    expect(command.getArgs()).andReturn(args);
    expect(command.eClass()).andReturn(eClass);

    Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");

    PowerMock.expectPrivate(validator, "error", "lexer command '" + commandName
        + "' does not take any arguments", command, feature);
View Full Code Here

public class Antlr4MissingReferenceMessageProviderTest {

  @Test
  public void defaultModesOK() {
    ILinkingDiagnosticContext diagnosticContext = createMock(ILinkingDiagnosticContext.class);
    LexerCommand command = createMock(LexerCommand.class);
    LexerCommands commands = createMock(LexerCommands.class);

    expect(diagnosticContext.getLinkText()).andReturn("HIDDEN");
    expect(diagnosticContext.getContext()).andReturn(command);

    expect(command.eContainer()).andReturn(commands);

    Object[] mocks = {diagnosticContext, command, commands };

    replay(mocks);
View Full Code Here

TOP

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

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.