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 Util/Lexer.pas #337

Merged
merged 4 commits into from
Aug 24, 2024
Merged

Add Util/Lexer.pas #337

merged 4 commits into from
Aug 24, 2024

Conversation

w7sst
Copy link
Owner

@w7sst w7sst commented Aug 21, 2024

Adding a general-purpose Lexer to MRCE. This will be extended for parsing the ARRL Sweepstakes exchange. See #336 for additional details.

@w7sst w7sst added this to the v1.85 - next release milestone Aug 21, 2024
@w7sst w7sst requested review from f6fvy, jr8ppg and K6OK August 21, 2024 23:03
@w7sst w7sst self-assigned this Aug 21, 2024
@w7sst w7sst linked an issue Aug 21, 2024 that may be closed by this pull request
Util/Lexer.pas Outdated
LexerRules: array[0..2] of TTokenRuleDef = (
(R: '[A-Z]+'; T: Ord(ttAlpha)),
(R: '\d+'; T: Ord(ttNumeric)),
(R: '[A-Z][A-Z\d]*'; T: Ord(ttAlphaNumeric))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unless I miss something it must start with a letter, so it's not "AlphaNumeric" per se. "1A" won't match for example. I understand it's only examples, but it's a bit confusing.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point. I initially started thinking the ttAlphaNumeric and ttNumericAlpha tokens would be useful, but they weren't. In the end for ARRL SS Contest, I converged on three token types: ttAlpha, ttDigits (numeric), and ttCallsign. I will update the above example to remove the ttAlphaNumeric. I will update this example later today or tonight.

In the few days, I'll post the ARRL SS Contest for review. It will show the tables used for SS and will hopefully be more clear. Parsing has never been my strength, so my examples may not be the best to provide.

Thank you for the feedback.

@f6fvy

Copy link
Owner Author

Choose a reason for hiding this comment

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

I updated the comments and pushed an updated version.

@w7sst w7sst requested a review from f6fvy August 22, 2024 22:59
@w7sst w7sst merged commit 7f48975 into main Aug 24, 2024
@w7sst w7sst deleted the 336-add-general-purpose-lexer branch August 24, 2024 19:30
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.

Add general-purpose Lexer
2 participants