Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods BEGIN_rule, END_rule #47

Closed
5 tasks done
balajirama opened this issue Jun 14, 2019 · 0 comments
Closed
5 tasks done

Add methods BEGIN_rule, END_rule #47

balajirama opened this issue Jun 14, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@balajirama
Copy link
Owner

balajirama commented Jun 14, 2019

  • BEGIN_rule must be run before all rules, before the first line is read.

  • END_rule will be run right before read method is finished reading

  • Both BEGIN and END should ignore if key and continue_to_next key.

  • Both of them will append to whatever rule was provided earlier.

  • The $this->this_line should not exist in the BEGIN and END blocks.

These rules are useful for programmers to do specific things right before reading a file, or right after reading it.

@balajirama balajirama added the enhancement New feature or request label Jun 14, 2019
@balajirama balajirama self-assigned this Jun 14, 2019
@balajirama balajirama added this to To do in Rules-based parsing - Extended AWK syntax via automation Jun 14, 2019
@balajirama balajirama changed the title Add functions begin_rule, end_rule Add methods begin_rule, end_rule Jun 14, 2019
@balajirama balajirama changed the title Add methods begin_rule, end_rule Add methods BEGIN_rule, END_rule Jun 14, 2019
balajirama added a commit that referenced this issue Jun 15, 2019
Rules-based parsing - Extended AWK syntax automation moved this from To do to Done Jun 16, 2019
@balajirama balajirama reopened this Jun 16, 2019
Rules-based parsing - Extended AWK syntax automation moved this from Done to In progress Jun 16, 2019
Rules-based parsing - Extended AWK syntax automation moved this from In progress to Done Jun 16, 2019
balajirama added a commit that referenced this issue Jun 17, 2019
  - Changed the primary usage model from inheritance-based to regular use in main.
  - A new class for text parsing rules created Text::Parser::Rule (#17).
  - Import functions from String::Util, Scalar::Util, String::Util::Match, String::Util::Range, and String::Index.
    These can be accessed inside the ExAWK string rules directly (#44)
  - Added new methods to Text::Parser called add_rule to create rules (#37), and clear_rules to delete rules (#40)
  - Added new methods to Text::Parser called BEGIN_rule and END_rule (#47). The current line is not accessible in this rule.
  - Added new method join_range available when auto_split => 1 (#38)
  - Rules support range shortcuts like ${3+}, @{2+}, and \@{3+} (#39), (#45)
  - Added ability to create parse-time variables accessible across rules such as ~var (#48)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

1 participant