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

adding vhdl language #595

Merged
merged 4 commits into from
Jun 18, 2015
Merged

adding vhdl language #595

merged 4 commits into from
Jun 18, 2015

Conversation

a-rey
Copy link
Contributor

@a-rey a-rey commented Jun 12, 2015

Hello!

I use some hardware description languages in a website of mine and was sad to see they are not supported by Prism. Here is my proposed Prism support for the VHDL language. Let me know if there are any issues!

sample code below borrowed from here

screen shot 2015-06-12 at 4 00 58 pm

@@ -0,0 +1,24 @@
Prism.languages.vhdl = {
'comment': /(--[^\r\n]+)/,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not .+ instead of [^\r\n]+? And there is no need for the parentheses.

@Golmote
Copy link
Contributor

Golmote commented Jun 12, 2015

Thanks for contributing!

Please take a look at my comments ;)

@a-rey
Copy link
Contributor Author

a-rey commented Jun 13, 2015

Thank you for your comments!

I made the changes you brought up. Let me know if you see anything else.

@LeaVerou
Copy link
Member

I left the [01uxzwlh-] part in the number pattern and not in the vhdl-vectors pattern to avoid the issue of a '0' inside of a string (example: "blah blah '1' blah") being highlighted before strings had their chance.

Not sure what you mean here exactly, but strings are processed before numbers, since the string token comes earlier in your definition.

@Golmote
Copy link
Contributor

Golmote commented Jun 14, 2015

Alright, this makes sense. Since vhdl-vectors are processed before strings, he wanted to prevent those single-quoted numbers from breaking the highlighting of strings.

'comment': /--.+/,
// support for all logic vectors
'vhdl-vectors': {
'pattern': /(\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+")/i,
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for the enclosing parentheses here.

@Golmote
Copy link
Contributor

Golmote commented Jun 14, 2015

I added a couple of comments. Apart from them, this looks good to me.

@a-rey
Copy link
Contributor Author

a-rey commented Jun 14, 2015

Made the requested changes. Thanks again!

@LeaVerou
Copy link
Member

LGTM! Please add a minified version? Also, examples in the examples page would be nice, but not required.

Thanks for the contribution!!

@Golmote
Copy link
Contributor

Golmote commented Jun 18, 2015

If needed, I can merge, build the minified version and add the example given in the first message of this PR, when I get back from work.

@a-rey
Copy link
Contributor Author

a-rey commented Jun 18, 2015

minified and example ready!

@Golmote
Copy link
Contributor

Golmote commented Jun 18, 2015

This looks great, thanks. As it looks good to @LeaVerou too, I'll merge now.

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.

None yet

3 participants