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

Added HDL (Hardware Description Language) support #1710

Merged
merged 6 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@
"title": "HCL",
"owner": "outsideris"
},
"hdl": {
"title": "HDL",
"owner": "stephanmax"
},
"http": {
"title": "HTTP",
"peerDependencies": [
Expand Down
18 changes: 18 additions & 0 deletions components/prism-hdl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Prism.languages.hdl = {
'comment': [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
lookbehind: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
'keyword': /\b(?:CHIP|IN|OUT|PARTS|BUILTIN|CLOCKED)\b/,
'boolean': /\b(?:true|false)\b/,
'number': /\b\d+\b/i,
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved
'operator': /=/,
'punctuation': /[{}[\];(),.:]/
};
1 change: 1 addition & 0 deletions components/prism-hdl.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (!Prism.plugins.toolbar) {
}

// The languages map is built automatically with gulp
var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","arff":"ARFF","asciidoc":"AsciiDoc","asm6502":"6502 Assembly","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","autoit":"AutoIt","shell":"Shell","basic":"BASIC","csharp":"C#","cpp":"C++","cil":"CIL","coffeescript":"CoffeeScript","csp":"Content-Security-Policy","css-extras":"CSS Extras","django":"Django/Jinja2","erb":"ERB","fsharp":"F#","gcode":"G-code","gedcom":"GEDCOM","glsl":"GLSL","gml":"GameMaker Language","graphql":"GraphQL","hcl":"HCL","http":"HTTP","hpkp":"HTTP Public-Key-Pins","hsts":"HTTP Strict-Transport-Security","ichigojam":"IchigoJam","inform7":"Inform 7","javastacktrace":"Java stack trace","json":"JSON","jsonp":"JSONP","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","markup-templating":"Markup templating","matlab":"MATLAB","mel":"MEL","n1ql":"N1QL","n4js":"N4JS","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","opencl":"OpenCL","parigp":"PARI/GP","objectpascal":"Object Pascal","php":"PHP","php-extras":"PHP Extras","plsql":"PL/SQL","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","q":"Q (kdb+ database)","jsx":"React JSX","tsx":"React TSX","renpy":"Ren'py","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","soy":"Soy (Closure Template)","tap":"TAP","toml":"TOML","tt2":"Template Toolkit 2","typescript":"TypeScript","vbnet":"VB.Net","vhdl":"VHDL","vim":"vim","visual-basic":"Visual Basic","wasm":"WebAssembly","wiki":"Wiki markup","xeoracube":"XeoraCube","xojo":"Xojo (REALbasic)","xquery":"XQuery","yaml":"YAML"}/*]*/;
var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","arff":"ARFF","asciidoc":"AsciiDoc","asm6502":"6502 Assembly","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","autoit":"AutoIt","shell":"Shell","basic":"BASIC","csharp":"C#","cpp":"C++","cil":"CIL","coffeescript":"CoffeeScript","csp":"Content-Security-Policy","css-extras":"CSS Extras","django":"Django/Jinja2","erb":"ERB","fsharp":"F#","gcode":"G-code","gedcom":"GEDCOM","glsl":"GLSL","gml":"GameMaker Language","graphql":"GraphQL","hcl":"HCL","hdl":"HDL","http":"HTTP","hpkp":"HTTP Public-Key-Pins","hsts":"HTTP Strict-Transport-Security","ichigojam":"IchigoJam","inform7":"Inform 7","javastacktrace":"Java stack trace","json":"JSON","jsonp":"JSONP","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","markup-templating":"Markup templating","matlab":"MATLAB","mel":"MEL","n1ql":"N1QL","n4js":"N4JS","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","opencl":"OpenCL","parigp":"PARI/GP","objectpascal":"Object Pascal","php":"PHP","php-extras":"PHP Extras","plsql":"PL/SQL","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","q":"Q (kdb+ database)","jsx":"React JSX","tsx":"React TSX","renpy":"Ren'py","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","soy":"Soy (Closure Template)","tap":"TAP","toml":"TOML","tt2":"Template Toolkit 2","typescript":"TypeScript","vbnet":"VB.Net","vhdl":"VHDL","vim":"vim","visual-basic":"Visual Basic","wasm":"WebAssembly","wiki":"Wiki markup","xeoracube":"XeoraCube","xojo":"Xojo (REALbasic)","xquery":"XQuery","yaml":"YAML"}/*]*/;
Prism.plugins.toolbar.registerButton('show-language', function(env) {
var pre = env.element.parentNode;
if (!pre || !/pre/i.test(pre.nodeName)) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/languages/hdl/boolean_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
true
false
trueVal
RunDevelopment marked this conversation as resolved.
Show resolved Hide resolved

----------------------------------------------------

[
["boolean", "true"],
["boolean", "false"],
"\r\ntrueVal"
]

----------------------------------------------------

Checks for booleans (outside of identifiers).
20 changes: 20 additions & 0 deletions tests/languages/hdl/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// foobar
/**/
/* foo
bar */
/*
* foobar
*/

----------------------------------------------------

[
["comment", "// foobar"],
["comment", "/**/"],
["comment", "/* foo\r\nbar */"],
["comment", "/*\r\n * foobar\r\n */"]
]

----------------------------------------------------

Checks for single-line and multi-line comments.
23 changes: 23 additions & 0 deletions tests/languages/hdl/keyword_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CHIP
IN
OUT
PARTS
BUILTIN
CLOCKED
myCHIP

----------------------------------------------------

[
["keyword", "CHIP"],
["keyword", "IN"],
["keyword", "OUT"],
["keyword", "PARTS"],
["keyword", "BUILTIN"],
["keyword", "CLOCKED"],
"\r\nmyCHIP"
]

----------------------------------------------------

Checks for all keywords (outside of identifiers).
17 changes: 17 additions & 0 deletions tests/languages/hdl/number_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
0
16
32
num65

----------------------------------------------------

[
["number", "0"],
["number", "16"],
["number", "32"],
"\r\nnum65"
]

----------------------------------------------------

Checks for integer numbers (outside of identifiers).
11 changes: 11 additions & 0 deletions tests/languages/hdl/operator_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=

----------------------------------------------------

[
["operator", "="]
]

----------------------------------------------------

Checks for all operators.
25 changes: 25 additions & 0 deletions tests/languages/hdl/punctuation_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
( )
{ }
[ ]
,
.
;
:

----------------------------------------------------

[
["punctuation", "("],
["punctuation", ")"],
["punctuation", "{"],
["punctuation", "}"],
["punctuation", "["],
["punctuation", "]"],
["punctuation", ","],
["punctuation", "."],
["punctuation", ";"],
["punctuation", ":"]
]
----------------------------------------------------

Checks for punctuation.