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

Parser: add RegisterSingleUseKeyword #441

Open
IhateTrains opened this issue Jun 2, 2024 · 0 comments
Open

Parser: add RegisterSingleUseKeyword #441

IhateTrains opened this issue Jun 2, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@IhateTrains
Copy link
Member

IhateTrains commented Jun 2, 2024

In lots of cases where we use the parser, each keyword is expected to appear only once.

Below is an example of a CK3 dynasty definition. prefix, name, culture, motto are all expected to appear only once.

695 = {
	prefix = "dynnp_ua"
	name = "dynn_Briain"
	culture = "irish"
	motto = dynn_Briain_motto
}

By unregistering the keywords after they are matched, we can improve the performance of the parser. The first token will have to be matched against 4 keywords, but the second against 3, third against 2 and the last one against just 1 keyword.

Should probably be benchmarked, though.

@IhateTrains IhateTrains added the enhancement New feature or request label Jun 2, 2024
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
None yet
Development

No branches or pull requests

1 participant