Skip to content

Commit 83c4776

Browse files
authored
Merge branch 'main' into premake
2 parents 2c286bc + 05fa138 commit 83c4776

File tree

24 files changed

+1169
-0
lines changed

24 files changed

+1169
-0
lines changed

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
[submodule "vendor/grammars/Jails"]
7171
path = vendor/grammars/Jails
7272
url = https://github.com/SogoCZE/Jails.git
73+
[submodule "vendor/grammars/K-VSCode"]
74+
path = vendor/grammars/K-VSCode
75+
url = https://github.com/LucianCumpata/K-VSCode.git
7376
[submodule "vendor/grammars/LOLCODE-grammar-vscode"]
7477
path = vendor/grammars/LOLCODE-grammar-vscode
7578
url = https://github.com/KrazIvan/LOLCODE-grammar-vscode.git
@@ -755,6 +758,9 @@
755758
[submodule "vendor/grammars/language-kotlin"]
756759
path = vendor/grammars/language-kotlin
757760
url = https://github.com/nishtahir/language-kotlin
761+
[submodule "vendor/grammars/language-langium"]
762+
path = vendor/grammars/language-langium
763+
url = https://github.com/eclipse-langium/language-langium.git
758764
[submodule "vendor/grammars/language-less"]
759765
path = vendor/grammars/language-less
760766
url = https://github.com/atom/language-less.git
@@ -1410,6 +1416,9 @@
14101416
[submodule "vendor/grammars/vscode-just"]
14111417
path = vendor/grammars/vscode-just
14121418
url = https://github.com/nefrob/vscode-just.git
1419+
[submodule "vendor/grammars/vscode-kcl"]
1420+
path = vendor/grammars/vscode-kcl
1421+
url = https://github.com/kcl-lang/vscode-kcl.git
14131422
[submodule "vendor/grammars/vscode-kdl"]
14141423
path = vendor/grammars/vscode-kdl
14151424
url = https://github.com/kdl-org/vscode-kdl.git

grammars.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ vendor/grammars/JSyntax:
5454
- source.j
5555
vendor/grammars/Jails:
5656
- source.jai
57+
vendor/grammars/K-VSCode:
58+
- text.k
5759
vendor/grammars/LOLCODE-grammar-vscode:
5860
- source.lolcode
5961
vendor/grammars/Ligo-grammar:
@@ -701,6 +703,8 @@ vendor/grammars/language-kickstart:
701703
- source.kickstart
702704
vendor/grammars/language-kotlin:
703705
- source.kotlin
706+
vendor/grammars/language-langium:
707+
- source.langium
704708
vendor/grammars/language-less:
705709
- source.css.less
706710
vendor/grammars/language-m68k:
@@ -1262,6 +1266,8 @@ vendor/grammars/vscode-jsonc-syntax-highlighting:
12621266
- source.json.comments
12631267
vendor/grammars/vscode-just:
12641268
- source.just
1269+
vendor/grammars/vscode-kcl:
1270+
- source.kcl
12651271
vendor/grammars/vscode-kdl:
12661272
- source.kdl
12671273
vendor/grammars/vscode-kolmafia-ash:

lib/linguist/generated.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def generated?
7575
esy_lock? ||
7676
npm_shrinkwrap_or_package_lock? ||
7777
pnpm_lock? ||
78+
bun_lock? ||
7879
terraform_lock? ||
7980
generated_yarn_plugnplay? ||
8081
godeps? ||
@@ -503,6 +504,13 @@ def pnpm_lock?
503504
!!name.match(/pnpm-lock\.yaml/)
504505
end
505506

507+
# Internal: Is the blob a generated bun lockfile?
508+
#
509+
# Returns true or false.
510+
def bun_lock?
511+
!!name.match(/(?:^|\/)bun\.lockb?$/)
512+
end
513+
506514
# Internal: Is the blob a generated Yarn Plug'n'Play?
507515
#
508516
# Returns true or false.

lib/linguist/heuristics.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ disambiguations:
139139
and:
140140
- pattern: '(?i)^[ \t]*return '
141141
- negative_pattern: '(?i)[ \t]*gosub '
142+
- language: QuickBASIC
143+
named_pattern: quickbasic
142144
- extensions: ['.bs']
143145
rules:
144146
- language: Bikeshed
@@ -425,6 +427,18 @@ disambiguations:
425427
- language: OASv3-json
426428
pattern: '"openapi":\s?"3.[0-9.]+"'
427429
- language: JSON
430+
- extensions: ['.k']
431+
rules:
432+
- language: KCL
433+
pattern:
434+
- '^schema [A-Za-z0-9_-]+'
435+
- '^\}$'
436+
- '\s*\}\s*'
437+
- language: KFramework
438+
pattern:
439+
- '^requires\s+"[^"]+"$'
440+
- '^syntax\s+\w+\s+::=.*'
441+
- '^endmodule$'
428442
- extensions: ['.l']
429443
rules:
430444
- language: Common Lisp

lib/linguist/languages.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,6 +3518,7 @@ JSON with Comments:
35183518
- ".sublime-workspace"
35193519
- ".sublime_metrics"
35203520
- ".sublime_session"
3521+
- ".tsconfig.json"
35213522
filenames:
35223523
- ".babelrc"
35233524
- ".devcontainer.json"
@@ -3828,6 +3829,17 @@ Just:
38283829
- ".just"
38293830
ace_mode: text
38303831
language_id: 128447695
3832+
KCL:
3833+
type: programming
3834+
color: "#7ABABF"
3835+
tm_scope: source.kcl
3836+
extensions:
3837+
- ".k"
3838+
filenames:
3839+
- kcl.mod
3840+
- kcl.mod.lock
3841+
ace_mode: text
3842+
language_id: 1052003890
38313843
KDL:
38323844
type: data
38333845
color: "#ffb3b3"
@@ -3838,6 +3850,14 @@ KDL:
38383850
codemirror_mode: yacas
38393851
codemirror_mime_type: text/x-yacas
38403852
language_id: 931123626
3853+
KFramework:
3854+
type: programming
3855+
color: "#4195c5"
3856+
tm_scope: text.k
3857+
extensions:
3858+
- ".k"
3859+
ace_mode: text
3860+
language_id: 9479532
38413861
KRL:
38423862
type: programming
38433863
color: "#28430A"
@@ -4027,6 +4047,14 @@ LabVIEW:
40274047
codemirror_mode: xml
40284048
codemirror_mime_type: text/xml
40294049
language_id: 194
4050+
Langium:
4051+
type: programming
4052+
color: "#2c8c87"
4053+
extensions:
4054+
- ".langium"
4055+
tm_scope: source.langium
4056+
ace_mode: text
4057+
language_id: 548603830
40304058
Lark:
40314059
type: data
40324060
color: "#2980B9"
@@ -4290,6 +4318,7 @@ Lua:
42904318
- ".luacheckrc"
42914319
interpreters:
42924320
- lua
4321+
- luajit
42934322
language_id: 213
42944323
Luau:
42954324
type: programming
@@ -5729,6 +5758,7 @@ Pip Requirements:
57295758
type: data
57305759
color: "#FFD343"
57315760
filenames:
5761+
- dev-requirements.txt
57325762
- requirements-dev.txt
57335763
- requirements.lock.txt
57345764
- requirements.txt
@@ -6157,6 +6187,7 @@ QuickBASIC:
61576187
color: "#008080"
61586188
extensions:
61596189
- ".bas"
6190+
- ".bi"
61606191
tm_scope: source.QB64
61616192
aliases:
61626193
- qb
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"jsx": "react",
4+
"target": "ES2019",
5+
"emitDecoratorMetadata": false // coverage broke if true
6+
},
7+
"include": [],
8+
"exclude": ["node_modules","npm"]
9+
}

samples/KCL/complex.k

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
schema App:
2+
"""The application model."""
3+
name: str
4+
replicas: int = 1
5+
labels?: {str:str} = {app = name}
6+
service?: Service
7+
containers?: {str: Container}
8+
9+
schema Service:
10+
"""The service model."""
11+
$type?: str
12+
ports: [Port]
13+
14+
schema Port:
15+
"""The port model."""
16+
port: int
17+
protocol: "TCP" | "UDP" | "SCTP" = "TCP"
18+
targetPort?: int | str
19+
20+
schema Container:
21+
"""The container model."""
22+
image: str
23+
command?: [str]
24+
args?: [str]
25+
env?: [Env]
26+
volumes?: [Volume]
27+
resources?: Resource
28+
ports: [ContainerPort]
29+
30+
schema ContainerPort:
31+
"""The container port model."""
32+
name?: str
33+
protocol: "TCP" | "UDP" | "SCTP" = "TCP"
34+
containerPort: int
35+
36+
check:
37+
1 <= containerPort <= 65535, "containerPort must be between 1 and 65535, inclusive"
38+
39+
schema Env:
40+
name: str
41+
value: str
42+
43+
schema Volume:
44+
source: str
45+
path: str
46+
target: str
47+
readOnly?: bool = False
48+
49+
schema Resource:
50+
limits?: {str:}
51+
requests?: {str:}
52+
53+
import manifests
54+
55+
# Convert the `App` model into Kubernetes Deployment and Service Manifests
56+
kubernetesRender = lambda a: App {
57+
# Construct the deployment manifest.
58+
deployment = {
59+
apiVersion = "apps/v1"
60+
kind = "Deployment"
61+
metadata.name = a.name
62+
metadata.labels = a.labels
63+
spec = {
64+
replicas = a.replicas
65+
selector.matchLabels = a.labels
66+
template.metadata.labels = a.labels
67+
template.spec.containers = [
68+
{
69+
name = name
70+
image = c.image
71+
command = c.command
72+
args = c.args
73+
env = c.env
74+
volumeMounts = c.volumes
75+
resources: c.resources
76+
ports = c.ports
77+
} for name, c in a.containers
78+
]
79+
}
80+
}
81+
# Construct the service manifest.
82+
service = {
83+
apiVersion = "v1"
84+
kind = "Service"
85+
metadata.name = a.name
86+
metadata.labels = a.labels
87+
spec = {
88+
type = a.service?.$type
89+
selector = a.labels
90+
ports = a.service?.ports
91+
}
92+
}
93+
# Returns Kubernetes manifests
94+
[deployment, if a.service: service]
95+
}
96+
97+
98+
App {
99+
name = "app"
100+
containers.nginx = {
101+
image = "nginx"
102+
ports = [{containerPort = 80}]
103+
}
104+
service.ports = [{ port = 80 }]
105+
}
106+
107+
manifests.yaml_stream(sum([kubernetesRender(a) for a in App.instances()], []))

samples/KCL/simple.k

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
schema App:
2+
"""The application model."""
3+
name: str
4+
replicas: int
5+
labels?: {str:str} = {app = name}
6+
7+
app: App {
8+
name = "app"
9+
replicas = 1
10+
labels.key = "value"
11+
}

samples/KFramework/sample1.k

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
2+
3+
module RAND-SYNTAX
4+
imports DOMAINS-SYNTAX
5+
6+
syntax Pgm ::= ".Pgm" | Int ";" Pgm | runRand ( )
7+
endmodule
8+
9+
10+
module RAND
11+
imports RAND-SYNTAX
12+
imports DOMAINS
13+
14+
configuration <k> /home/mihai/git/linguist/samples/KFrameworkgm </k>
15+
<rands> .List </rands>
16+
17+
rule <k> I ; P => srandInt(I) ~> runRand() ~> P ... </k>
18+
19+
rule <k> runRand() => .K ... </k>
20+
<rands> ... .List => ListItem(randInt(1000)) </rands>
21+
endmodule

samples/KFramework/sample2.k

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
2+
module IMP-SYNTAX
3+
imports DOMAINS-SYNTAX
4+
5+
syntax Pgm ::= Int
6+
endmodule
7+
8+
9+
module IMP
10+
imports IMP-SYNTAX
11+
imports DOMAINS
12+
syntax KResult ::= Int | Bool
13+
14+
configuration <T color="yellow">
15+
<k color="green"> /home/mihai/git/linguist/samples/KFrameworkgm </k>
16+
<cpp-enums>
17+
<cppenum multiplicity="*" type="Map">
18+
<enum-id> .K </enum-id>
19+
<enum-type> .K </enum-type>
20+
<scoped> false </scoped>
21+
</cppenum>
22+
</cpp-enums>
23+
</T>
24+
25+
syntax Enum
26+
27+
syntax CppenumCell
28+
syntax IncompleteInfo ::= "#incomplete"
29+
syntax EnumInfo ::= CppenumCell | IncompleteInfo
30+
syntax EnumInfo ::= #getEnumInfo(Enum) [function]
31+
32+
rule [[ #getEnumInfo(X::Enum) => <cppenum> <enum-id> X </enum-id> B </cppenum> ]]
33+
<cppenum> <enum-id> X </enum-id> B::Bag </cppenum>
34+
35+
rule #getEnumInfo(_) => #incomplete [owise]
36+
37+
endmodule

0 commit comments

Comments
 (0)