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

Bash File names with periods #547

Closed
shawnsparks opened this issue Mar 12, 2015 · 4 comments
Closed

Bash File names with periods #547

shawnsparks opened this issue Mar 12, 2015 · 4 comments

Comments

@shawnsparks
Copy link
Contributor

Bash syntax highlighting struggles with files with version numbers. The line below will highlight the .7 as a number.

sudo dpkg -i vagrant_1.7.2_x86_64.deb
@shawnsparks
Copy link
Contributor Author

Adding this to bash component seems to work for me, but didn't see a test suite to feel comfortable just submitting pull request.

number: {
    pattern: /(\s|=)-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
    lookbehind: true
}

@Golmote
Copy link
Contributor

Golmote commented Mar 12, 2015

I think your suggestion would not work for expressions like z=$(($z+3)) (http://tldp.org/LDP/abs/html/arithexp.html).

Maybe we just need to consider the dot . as a word-character and do something like:

number: {
    pattern: /([^\w\.])-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
    lookbehind: true
}

What do you think?

(Regarding test suite, it's a known problem. For now, the closest thing we have is the Examples page... So I'll add an example for this specific issue once we agree on the way to fix it.)

@shawnsparks
Copy link
Contributor Author

That's where I started, but wasn't sure on the regex and switched to what I posted. What you posted works for my few brief examples. Would you say this is a clike problem or a bash problem? Let me know if you'd prefer I submit the pull request.

@Golmote
Copy link
Contributor

Golmote commented Mar 13, 2015

I'll commit this directly. For now, I'll consider this only applies to bash, because I don't think the case can happen in all c-like languages.

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

No branches or pull requests

2 participants