mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-09 13:23:51 +02:00
parent
175c35e532
commit
202379826e
@ -37,7 +37,7 @@ translators for Pygments lexers and styles.
|
||||
Prefix | Language
|
||||
:----: | --------
|
||||
A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk
|
||||
B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, BlitzBasic, BNF, Brainfuck
|
||||
B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, Bicep, BlitzBasic, BNF, Brainfuck
|
||||
C | C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython
|
||||
D | D, Dart, Diff, Django/Jinja, Docker, DTD, Dylan
|
||||
E | EBNF, Elixir, Elm, EmacsLisp, Erlang
|
||||
|
113
lexers/b/bicep.go
Normal file
113
lexers/b/bicep.go
Normal file
@ -0,0 +1,113 @@
|
||||
package b
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Bicep lexer.
|
||||
var Bicep = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Bicep",
|
||||
Aliases: []string{"bicep"},
|
||||
Filenames: []string{"*.bicep"},
|
||||
MimeTypes: []string{"application/x-bicep"},
|
||||
},
|
||||
bicepRules,
|
||||
))
|
||||
|
||||
func bicepRules() Rules {
|
||||
bicepFunctions := []string{
|
||||
"any",
|
||||
"array",
|
||||
"concat",
|
||||
"contains",
|
||||
"empty",
|
||||
"first",
|
||||
"intersection",
|
||||
"items",
|
||||
"last",
|
||||
"length",
|
||||
"min",
|
||||
"max",
|
||||
"range",
|
||||
"skip",
|
||||
"take",
|
||||
"union",
|
||||
"dateTimeAdd",
|
||||
"utcNow",
|
||||
"deployment",
|
||||
"environment",
|
||||
"loadFileAsBase64",
|
||||
"loadTextContent",
|
||||
"int",
|
||||
"json",
|
||||
"extensionResourceId",
|
||||
"getSecret",
|
||||
"list",
|
||||
"listKeys",
|
||||
"listKeyValue",
|
||||
"listAccountSas",
|
||||
"listSecrets",
|
||||
"pickZones",
|
||||
"reference",
|
||||
"resourceId",
|
||||
"subscriptionResourceId",
|
||||
"tenantResourceId",
|
||||
"managementGroup",
|
||||
"resourceGroup",
|
||||
"subscription",
|
||||
"tenant",
|
||||
"base64",
|
||||
"base64ToJson",
|
||||
"base64ToString",
|
||||
"dataUri",
|
||||
"dataUriToString",
|
||||
"endsWith",
|
||||
"format",
|
||||
"guid",
|
||||
"indexOf",
|
||||
"lastIndexOf",
|
||||
"length",
|
||||
"newGuid",
|
||||
"padLeft",
|
||||
"replace",
|
||||
"split",
|
||||
"startsWith",
|
||||
"string",
|
||||
"substring",
|
||||
"toLower",
|
||||
"toUpper",
|
||||
"trim",
|
||||
"uniqueString",
|
||||
"uri",
|
||||
"uriComponent",
|
||||
"uriComponentToString",
|
||||
}
|
||||
|
||||
return Rules{
|
||||
"root": {
|
||||
{`//[^\n\r]+`, CommentSingle, nil},
|
||||
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||
{`([']?\w+[']?)(:)`, ByGroups(NameProperty, Punctuation), nil},
|
||||
{`\b('(resourceGroup|subscription|managementGroup|tenant)')\b`, KeywordNamespace, nil},
|
||||
{`'[\w\$\{\(\)\}\.]{1,}?'`, LiteralStringInterpol, nil},
|
||||
{`('''|').*?('''|')`, LiteralString, nil},
|
||||
{`\b(allowed|batchSize|description|maxLength|maxValue|metadata|minLength|minValue|secure)\b`, NameDecorator, nil},
|
||||
{`\b(az|sys)\.`, NameNamespace, nil},
|
||||
{`\b(` + strings.Join(bicepFunctions, "|") + `)\b`, NameFunction, nil},
|
||||
// https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-logical
|
||||
{`\b(bool)(\()`, ByGroups(NameFunction, Punctuation), nil},
|
||||
{`\b(for|if|in)\b`, Keyword, nil},
|
||||
{`\b(module|output|param|resource|var)\b`, KeywordDeclaration, nil},
|
||||
{`\b(array|bool|int|object|string)\b`, KeywordType, nil},
|
||||
// https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/operators
|
||||
{`(>=|>|<=|<|==|!=|=~|!~|::|&&|\?\?|!|-|%|\*|\/|\+)`, Operator, nil},
|
||||
{`[\(\)\[\]\.:\?{}@=]`, Punctuation, nil},
|
||||
{`[\w_-]+`, Text, nil},
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
},
|
||||
}
|
||||
}
|
1
lexers/testdata/bicep/bicep-coalesce-operator.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-coalesce-operator.actual
vendored
Normal file
@ -0,0 +1 @@
|
||||
output nonNullStr string = myObject.isnull1 ?? myObject.string ?? myObject.isnull2
|
25
lexers/testdata/bicep/bicep-coalesce-operator.expected
vendored
Normal file
25
lexers/testdata/bicep/bicep-coalesce-operator.expected
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"nonNullStr"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"isnull1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"??"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"??"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"myObject"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"isnull2"}
|
||||
]
|
9
lexers/testdata/bicep/bicep-comments.actual
vendored
Normal file
9
lexers/testdata/bicep/bicep-comments.actual
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// This is your primary NIC.
|
||||
resource nic1 'Microsoft.Network/networkInterfaces@2020-06-01' = {
|
||||
}
|
||||
|
||||
/*
|
||||
This Bicep file assumes the key vault already exists and
|
||||
is in same subscription and resource group as the deployment.
|
||||
*/
|
||||
param existingKeyVaultName string
|
66
lexers/testdata/bicep/bicep-comments.expected
vendored
Normal file
66
lexers/testdata/bicep/bicep-comments.expected
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
[
|
||||
{"type":"CommentSingle","value":"// This is your primary NIC."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"nic1"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Network/networkInterfaces@2020-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Operator","value":"/*"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Text","value":"This"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"Bicep"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"file"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"assumes"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"the"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"key"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"vault"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"already"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"exists"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"and"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Text","value":"is"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Keyword","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"same"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"subscription"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"and"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"group"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"as"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"the"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"deployment"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Operator","value":"*/"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"existingKeyVaultName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"}
|
||||
]
|
3
lexers/testdata/bicep/bicep-function-any.actual
vendored
Normal file
3
lexers/testdata/bicep/bicep-function-any.actual
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
publicIPAddress: any((pipId == '') ? null : {
|
||||
id: pipId
|
||||
})
|
28
lexers/testdata/bicep/bicep-function-any.expected
vendored
Normal file
28
lexers/testdata/bicep/bicep-function-any.expected
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
[
|
||||
{"type":"NameProperty","value":"publicIPAddress"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"any"},
|
||||
{"type":"Punctuation","value":"(("},
|
||||
{"type":"Text","value":"pipId"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"?"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"null"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"id"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"pipId"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"})"}
|
||||
]
|
1
lexers/testdata/bicep/bicep-function-deployment.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-function-deployment.actual
vendored
Normal file
@ -0,0 +1 @@
|
||||
output deploymentOutput object = deployment()
|
12
lexers/testdata/bicep/bicep-function-deployment.expected
vendored
Normal file
12
lexers/testdata/bicep/bicep-function-deployment.expected
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"deploymentOutput"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"deployment"},
|
||||
{"type":"Punctuation","value":"()"}
|
||||
]
|
4
lexers/testdata/bicep/bicep-function-logical.actual
vendored
Normal file
4
lexers/testdata/bicep/bicep-function-logical.actual
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
output trueString bool = bool('true')
|
||||
output falseString bool = bool('false')
|
||||
output trueInt bool = bool(1)
|
||||
output falseInt bool = bool(0)
|
53
lexers/testdata/bicep/bicep-function-logical.expected
vendored
Normal file
53
lexers/testdata/bicep/bicep-function-logical.expected
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"trueString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralStringInterpol","value":"'true'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"falseString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralStringInterpol","value":"'false'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"trueInt"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"1"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"falseInt"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"bool"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"bool"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"0"},
|
||||
{"type":"Punctuation","value":")"}
|
||||
]
|
30
lexers/testdata/bicep/bicep-module.actual
vendored
Normal file
30
lexers/testdata/bicep/bicep-module.actual
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
@minLength(3)
|
||||
@maxLength(11)
|
||||
param storagePrefix string
|
||||
|
||||
param storageSKU string = 'Standard_LRS'
|
||||
param location string = resourceGroup().location
|
||||
|
||||
var uniqueStorageName = '${storagePrefix}${uniqueString(resourceGroup().id)}'
|
||||
|
||||
resource stg 'Microsoft.Storage/storageAccounts@2019-04-01' = {
|
||||
name: uniqueStorageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
module webModule './webApp.bicep' = {
|
||||
'name': 'webDeploy'
|
||||
'params': {
|
||||
'skuName': 'S1'
|
||||
'location': location
|
||||
}
|
||||
}
|
||||
|
||||
output storageEndpoint object = stg.properties.primaryEndpoints
|
148
lexers/testdata/bicep/bicep-module.expected
vendored
Normal file
148
lexers/testdata/bicep/bicep-module.expected
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameDecorator","value":"minLength"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameDecorator","value":"maxLength"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"11"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storagePrefix"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'Standard_LRS'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"resourceGroup"},
|
||||
{"type":"Punctuation","value":"()."},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'${storagePrefix}${uniqueString(resourceGroup().id)}'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"stg"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-04-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"module"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"webModule"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'./webApp.bicep'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"'name'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'webDeploy'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"'params'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"'skuName'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'S1'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"'location'"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageEndpoint"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"stg"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"properties"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"primaryEndpoints"}
|
||||
]
|
1
lexers/testdata/bicep/bicep-output.actual
vendored
Normal file
1
lexers/testdata/bicep/bicep-output.actual
vendored
Normal file
@ -0,0 +1 @@
|
||||
output storageEndpoint object = stg.properties.primaryEndpoints
|
15
lexers/testdata/bicep/bicep-output.expected
vendored
Normal file
15
lexers/testdata/bicep/bicep-output.expected
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"output"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageEndpoint"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"KeywordType","value":"object"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"stg"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"properties"},
|
||||
{"type":"Punctuation","value":"."},
|
||||
{"type":"Text","value":"primaryEndpoints"}
|
||||
]
|
4
lexers/testdata/bicep/bicep-parameter-decoration.actual
vendored
Normal file
4
lexers/testdata/bicep/bicep-parameter-decoration.actual
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
@description('The name of the instance.')
|
||||
param name string
|
||||
@sys.description('The description of the instance to display.')
|
||||
param description string
|
26
lexers/testdata/bicep/bicep-parameter-decoration.expected
vendored
Normal file
26
lexers/testdata/bicep/bicep-parameter-decoration.expected
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameDecorator","value":"description"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'The name of the instance.'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"name"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameNamespace","value":"sys."},
|
||||
{"type":"NameDecorator","value":"description"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"LiteralString","value":"'The description of the instance to display.'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameDecorator","value":"description"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"}
|
||||
]
|
11
lexers/testdata/bicep/bicep-resource-conditional.actual
vendored
Normal file
11
lexers/testdata/bicep/bicep-resource-conditional.actual
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = if (newOrExisting == 'new') {
|
||||
name: uniqueStorageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}
|
62
lexers/testdata/bicep/bicep-resource-conditional.expected
vendored
Normal file
62
lexers/testdata/bicep/bicep-resource-conditional.expected
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"sa"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Keyword","value":"if"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"newOrExisting"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Operator","value":"=="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'new'"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}"}
|
||||
]
|
12
lexers/testdata/bicep/bicep-resource-multiple.actual
vendored
Normal file
12
lexers/testdata/bicep/bicep-resource-multiple.actual
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
@batchSize(3)
|
||||
resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = [for storageName in storageAccounts: {
|
||||
name: storageName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageSKU
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
supportsHttpsTrafficOnly: true
|
||||
}
|
||||
}]
|
68
lexers/testdata/bicep/bicep-resource-multiple.expected
vendored
Normal file
68
lexers/testdata/bicep/bicep-resource-multiple.expected
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
[
|
||||
{"type":"Punctuation","value":"@"},
|
||||
{"type":"NameDecorator","value":"batchSize"},
|
||||
{"type":"Punctuation","value":"("},
|
||||
{"type":"Text","value":"3"},
|
||||
{"type":"Punctuation","value":")"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"resource"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"sa"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'Microsoft.Storage/storageAccounts@2019-06-01'"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"["},
|
||||
{"type":"Keyword","value":"for"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Keyword","value":"in"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameProperty","value":"storageAccounts"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageName"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"location"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"location"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"sku"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"name"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storageSKU"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"kind"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'StorageV2'"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"properties"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"NameProperty","value":"supportsHttpsTrafficOnly"},
|
||||
{"type":"Punctuation","value":":"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"true"},
|
||||
{"type":"TextWhitespace","value":"\n "},
|
||||
{"type":"Punctuation","value":"}"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Punctuation","value":"}]"}
|
||||
]
|
6
lexers/testdata/bicep/bicep-string-singleline-multiline.actual
vendored
Normal file
6
lexers/testdata/bicep/bicep-string-singleline-multiline.actual
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
param exampleString string = 'test value'
|
||||
|
||||
var comments = '''
|
||||
comments // are included
|
||||
/* because everything is read as-is */
|
||||
'''
|
29
lexers/testdata/bicep/bicep-string-singleline-multiline.expected
vendored
Normal file
29
lexers/testdata/bicep/bicep-string-singleline-multiline.expected
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"param"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"exampleString"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"NameFunction","value":"string"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"'test value'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"comments"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Error","value":"'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"Text","value":"comments"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"CommentSingle","value":"// are included"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"CommentMultiline","value":"/* because everything is read as-is */"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"LiteralString","value":"''"},
|
||||
{"type":"Error","value":"'"}
|
||||
]
|
7
lexers/testdata/bicep/bicep-targetScope.actual
vendored
Normal file
7
lexers/testdata/bicep/bicep-targetScope.actual
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
targetScope = 'resourceGroup'
|
||||
|
||||
targetScope = 'subscription'
|
||||
|
||||
targetScope = 'managementGroup'
|
||||
|
||||
targetScope = 'tenant'
|
25
lexers/testdata/bicep/bicep-targetScope.expected
vendored
Normal file
25
lexers/testdata/bicep/bicep-targetScope.expected
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
[
|
||||
{"type":"Text","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'resourceGroup'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Text","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'subscription'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Text","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'managementGroup'"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"Text","value":"targetScope"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'tenant'"}
|
||||
]
|
2
lexers/testdata/bicep/bicep-variable-string-interpolation.actual
vendored
Normal file
2
lexers/testdata/bicep/bicep-variable-string-interpolation.actual
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
var storagePrefix = 'dev'
|
||||
var uniqueStorageName = '${storagePrefix}${uniqueString(resourceGroup().id)}'
|
17
lexers/testdata/bicep/bicep-variable-string-interpolation.expected
vendored
Normal file
17
lexers/testdata/bicep/bicep-variable-string-interpolation.expected
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
[
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"storagePrefix"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'dev'"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"KeywordDeclaration","value":"var"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Text","value":"uniqueStorageName"},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"Punctuation","value":"="},
|
||||
{"type":"TextWhitespace","value":" "},
|
||||
{"type":"LiteralStringInterpol","value":"'${storagePrefix}${uniqueString(resourceGroup().id)}'"}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user