Skip to content

Commit

Permalink
PR suggestions and test
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera committed Sep 16, 2021
1 parent 8035693 commit b84f255
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
11 changes: 2 additions & 9 deletions parser_library/src/parsing/parser_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,8 @@ bool parser_impl::UNKNOWN()

bool parser_impl::ALIAS()
{
static const auto alias_instruction =
opcode_t::opcode_variant(&context::instruction::assembler_instructions.at("ALIAS"));

auto& [format, opcode] = *proc_status;
if (format.form != processing::processing_form::ASM)
return false;

auto i = hlasm_ctx->instruction_map().find(opcode.value);
return i != hlasm_ctx->instruction_map().end() && i->second == alias_instruction;
auto& [_, opcode] = *proc_status;
return *opcode.value == "ALIAS";
}

antlr4::misc::IntervalSet parser_impl::getExpectedTokens()
Expand Down
15 changes: 15 additions & 0 deletions parser_library/test/processing/asm_instr_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,18 @@ J ALIAS C'STRING'

EXPECT_TRUE(a.diags().empty());
}

TEST(asm_instr_processing, ALIAS_with_opsyn)
{
std::string input = R"(
X OPSYN ALIAS
L X C'SOMESTRING'
EXTRN L
)";

analyzer a(input);
a.analyze();
a.collect_diags();

EXPECT_TRUE(a.diags().empty());
}

0 comments on commit b84f255

Please sign in to comment.