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

Fix glob patterns when absolute paths are used #1378

Merged
merged 2 commits into from Feb 2, 2020
Merged

Fix glob patterns when absolute paths are used #1378

merged 2 commits into from Feb 2, 2020

Conversation

catatonicprime
Copy link
Contributor

@catatonicprime catatonicprime commented Feb 1, 2020

When lexing an apache config the following example illustrates the issue of lexing a glob pattern which is also an absolute path:

Include /etc/httpd/conf.d/*.conf

This lexs to:

(Token.Name.Builtin, 'Include')
(Token.Text, ' ')
(Token.Literal.String.Other, '/etc/httpd/conf.d/')
(Token.Text, '*.conf')
(Token.Text, '')
(Token.Text, '\n')

The (Token.Text, '*.conf') seems like it should really be part of the String.Other, like so (Token.Literal.String.Other, '/etc/httpd/conf.d/*.conf')

This PR adds the '*' to the acceptable character list for these type of absolute file path/glob patterns. Tests have been included to address:

  • one original absolute file path from the examplefiles/apache2.conf
  • one basic glob pattern
  • one multi-glob pattern
  • one root level multi-glob pattern

@Anteru Anteru merged commit 0cea713 into pygments:master Feb 2, 2020
@Anteru
Copy link
Collaborator

Anteru commented Feb 2, 2020

Merged, thanks a lot for your contribution!

@Anteru Anteru added this to the 2.6 milestone Feb 2, 2020
@Anteru Anteru self-assigned this Feb 2, 2020
@Anteru Anteru added the A-lexing area: changes to individual lexers label Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants