Skip to content

identifier init#2

Merged
ninjaro merged 6 commits into
masterfrom
parser
Jul 15, 2025
Merged

identifier init#2
ninjaro merged 6 commits into
masterfrom
parser

Conversation

@ninjaro
Copy link
Copy Markdown
Owner

@ninjaro ninjaro commented Jul 14, 2025

No description provided.

@ninjaro ninjaro requested a review from Copilot July 14, 2025 20:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the parsing pipeline by splitting raw grouping from identifier-based AST construction, renames parse_group to parse, updates reader position tracking, enriches error contexts, and adjusts all dependent tests and interfaces accordingly.

  • Renamed parse_group to parse and split out a two-phase parse+identify workflow.
  • Enhanced reader with get_position/jump_to_position and filename tracking.
  • Overhauled AST node interfaces (get, first, get_start, squeeze, pop_back) and placeholder logic.
  • Updated CMake and all tests to use the new parse API and expanded identifier tests.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/identify_tests.cpp Added new identifier tests for control structures and calls.
tests/grouper_tests.cpp Updated tests to call parse() instead of parse_group().
tests/ast_tests.cpp Split AST dump tests into partial and full dumps with limits.
src/reader.cpp Added token::dump, filename member, get_position, and resets.
src/main.cpp Changed main to use g.parse() and removed unused include.
src/grouper.cpp Major refactor: private parse_group, public parse + identify.
src/ast.cpp Extended AST node interfaces and placeholder/squeeze logic.
include/token.hpp Adjusted dump signature formatting.
include/reader.hpp Introduced position, token_kind, and updated method signatures.
include/grouper.hpp Renamed method to parse, declared identify/peek.
include/ast.hpp Expanded AST node classes with new methods and removed duplicates.
CMakeLists.txt Linked OpenMP conditionally and reordered test sources.
Comments suppressed due to low confidence (4)

tests/identify_tests.cpp:41

  • [nitpick] The variable name 'halt' is ambiguous; consider renaming it to 'rootGroup' or 'fileGroup' to improve readability.
        auto* halt = dynamic_cast<group_node*>(res->nodes[0].get());

tests/identify_tests.cpp:53

  • [nitpick] The variable name 'els' is not descriptive; consider renaming it to 'elseNode' or 'controlNode'.
        auto* els = dynamic_cast<control_node*>(halt->nodes.back().get());

include/grouper.hpp:39

  • [nitpick] The member variable current is ambiguous; renaming it to currentToken would make its purpose clearer.
    token current;

include/grouper.hpp:34

  • [nitpick] Renaming parse_group to parse could break existing integrations. Consider providing a deprecated parse_group alias or forwarding to maintain backward compatibility.
    group_ptr parse(group_kind kind = group_kind::file);

Comment thread src/grouper.cpp
return current;
}

void grouper::identify(const group_ptr& group, const group_ptr& result) const {
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The identify method is very large and complex. Consider breaking it into smaller helper functions (e.g., identifyControlKeywords, identifySecondaryKeywords) to improve readability and testability.

Copilot uses AI. Check for mistakes.
@ninjaro ninjaro requested a review from Copilot July 15, 2025 13:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@ninjaro ninjaro merged commit a9f9cee into master Jul 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants