-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfbe446
commit f9013cb
Showing
11 changed files
with
240 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Prism.languages.hcl = { | ||
'comment': [ | ||
{ | ||
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, | ||
lookbehind: true | ||
}, | ||
{ | ||
pattern: /(^|[^\\:])\/\/.*/, | ||
lookbehind: true, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /#.*/ | ||
} | ||
], | ||
'keyword': [ | ||
{ | ||
pattern: /(resource|data)\s+(")?(\w+)(")?\s+(?=(")?([\w\-]+)(")?\s+{)/i, | ||
inside: { | ||
'type': [ | ||
{ | ||
pattern: /(resource|data)\s+(")?(\w+)(")?\s+/i, | ||
lookbehind: true, | ||
alias: 'variable' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
pattern: /(provider|provisioner|variable|output|module|backend)\s+(")?([\w\-]+)(")?\s+(?={)/i, | ||
inside: { | ||
'type': [ | ||
{ | ||
pattern: /(provider|provisioner|variable|output|module|backend)\s+(")?([\w\-]+)(")?\s+/i, | ||
lookbehind: true, | ||
alias: 'variable' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
pattern: /([\w\-]+)(?=\s+{)/i | ||
} | ||
], | ||
'interpolation': [ | ||
{ | ||
pattern: /\${([\w\[\]\(\+\)\-\*\%\^\"\'\,\?\=\:\/\s]+\.?)+}/i, | ||
inside: { | ||
'type': [ | ||
{ | ||
pattern: /((terraform|var|self|count|module|path|data|local)\.)[\w\*]+/i, | ||
lookbehind: true, | ||
alias: 'variable' | ||
} | ||
], | ||
'keyword': [ | ||
{ | ||
pattern: /(terraform|var|self|count|module|path|data|local)/i | ||
} | ||
], | ||
'operator': [ | ||
{ | ||
pattern: /\${/ | ||
}, | ||
{ | ||
pattern: /}/ | ||
}, | ||
{ | ||
pattern: /\./ | ||
} | ||
], | ||
'function': [ | ||
{ | ||
pattern: /[\w]+(?=\()/i, | ||
alias: 'variable' | ||
} | ||
], | ||
'string': /".*"/i, | ||
'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/, | ||
'number': /-?\d+\.?\d*/, | ||
|
||
'others': [ | ||
{ | ||
pattern: /[\w\*]+/i, | ||
alias: 'string' | ||
} | ||
], | ||
}, | ||
} | ||
], | ||
'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, | ||
'boolean': /\b(?:true|false)\b/i, | ||
'number': /-?\d+\.?\d*([kKmMgG]b?)?/, | ||
'property': /([\w_-]+)(?=\s*(=)\s*)/i | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<h2>Comments</h2> | ||
<pre><code># Configure the AWS Provider | ||
// Configure the AWS Provider | ||
</code></pre> | ||
|
||
<h2>Resources</h2> | ||
<pre><code>resource "aws_instance" "web" { | ||
ami = "${data.aws_ami.ubuntu.id}" | ||
instance_type = "t2.micro" | ||
|
||
tags { | ||
Name = "HelloWorld" | ||
} | ||
}</code></pre> | ||
|
||
<h2>Provider</h2> | ||
<pre><code>resource "aws_instance" "web" { | ||
ami = "${data.aws_ami.ubuntu.id}" | ||
instance_type = "t2.micro" | ||
|
||
tags { | ||
Name = "HelloWorld" | ||
} | ||
}</code></pre> | ||
|
||
<h2>Variables</h2> | ||
<pre><code>variable "images" { | ||
type = "map" | ||
|
||
default = { | ||
us-east-1 = "image-1234" | ||
us-west-2 = "image-4567" | ||
} | ||
}</code></pre> | ||
|
||
<h2>Outputs</h2> | ||
<pre><code>output "address" { | ||
value = "${aws_instance.db.public_dns}" | ||
}</code></pre> | ||
|
||
<h2>Modules</h2> | ||
<pre><code>module "consul" { | ||
source = "hashicorp/consul/aws" | ||
servers = 5 | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# foo bar | ||
// foo bar | ||
/* | ||
* multi line | ||
*/ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "# foo bar"], | ||
["comment", "// foo bar"], | ||
["comment", "/*\r\n * multi line\r\n */"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
resource "aws_db_instance" "main" { | ||
data "terraform_remote_state" "main" { | ||
output "dev_vpc_id" { | ||
config { | ||
terraform { | ||
${data.aws_availability_zones.available.names[0]}" | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", | ||
["resource", | ||
["type", " \"aws_db_instance\" "]]], | ||
["string", "\"main\""], | ||
" {\r\n", | ||
["keyword", | ||
["data", | ||
["type", " \"terraform_remote_state\" "]]], | ||
["string", "\"main\""], | ||
" {\r\n", | ||
["keyword", | ||
["output", | ||
["type", " \"dev_vpc_id\" "]]], | ||
"{\r\n", | ||
["keyword", "config"], | ||
" {\r\n", | ||
["keyword", "terraform"], | ||
" {\r\n", | ||
["interpolation",[ | ||
["operator", "${"], | ||
["keyword", "data"], | ||
["operator", "."], | ||
["type", "aws_availability_zones"], | ||
["operator", "."], | ||
["others", "available"], | ||
["operator", "."], | ||
["others", "names"], | ||
["punctuation", "["], | ||
["number", "0"], | ||
["punctuation", "]"], | ||
["operator", "}"] | ||
]], "\"" | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for all keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
42 | ||
1.02 | ||
4mb | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["number", "42"], | ||
["number", "1.02"], | ||
["number", "4mb"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for numbers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"double quoted\"' % string" | ||
'single quoted"\' % string' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"double quoted\\\"' % string\""], | ||
["string", "'single quoted\"\\' % string'"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for strings. |