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

Why do we use syn match instead of syn keyword? #119

Closed
petdance opened this issue Jun 5, 2013 · 1 comment
Closed

Why do we use syn match instead of syn keyword? #119

petdance opened this issue Jun 5, 2013 · 1 comment

Comments

@petdance
Copy link
Contributor

petdance commented Jun 5, 2013

In vim 7.0, the keyword lines in syntax/perl.vim look like so:

syn keyword perlStatementScalar chomp chop chr crypt index lc lcfirst length ord pack reverse rindex sprintf substr uc ucfirst

In 7.3 and above they are:

syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|uc\%(first\)\=\)\>"

Why? Is that an improvement of some kind? My gut feel is that doing matches rather than letting vim do its own determination of what is a keyword would be slower.

@petdance
Copy link
Contributor Author

petdance commented Jun 5, 2013

From freenode #perl:

donri: match is slower but more powerful, and keywords can prevent other syntax rules to match

donri: for example if you have syn keyword import, you then can't have a syn match /import .../

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant