Skip to content

Commit c4d2c5b

Browse files
author
James Brundage
committed
feat: Conf Language Definition ( Fixes #864 )
1 parent d42aacc commit c4d2c5b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Languages/Conf/Conf-Language.ps.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Language function Conf {
2+
<#
3+
.SYNOPSIS
4+
Conf PipeScript Language Definition
5+
.DESCRIPTION
6+
Allows PipeScript to generate conf files
7+
#>
8+
[ValidatePattern('\.conf$')]
9+
param()
10+
11+
$FilePattern = '\.conf'
12+
13+
# Conf supports single line comments only. They start with `;` or `#`
14+
$SingleLineCommentStart = "[;#]"
15+
16+
# Any Language can be parsed with a series of regular expresssions.
17+
# For languages that only support single comments:
18+
# * The capture group IsSingleLine must be defined.
19+
# * Whitespace should not be allowed (it makes nested blocks hard to end)
20+
$startComment = "(?>(?<IsSingleLine>$SingleLineCommentStart)(?>PipeScript|PS)?\{)"
21+
$endComment = "(?>$SingleLineCommentStart(?:PipeScript)?\})"
22+
23+
# To support templates, a language has to declare `$StartPattern` and `$EndPattern`:
24+
$StartPattern = "(?<PSStart>${startComment})"
25+
$EndPattern = "(?<PSEnd>${endComment})"
26+
27+
# Conf files are a data language
28+
$DataLanguage = $true
29+
# and are generally case sensitive.
30+
$CaseSensitive = $true
31+
}

0 commit comments

Comments
 (0)