Add D2 language support (#6435)
Add d2 language support Co-authored-by: Colin Seymour <colin@github.com>
This commit is contained in:
Родитель
5a628308bb
Коммит
60a76ee4fe
|
@ -407,6 +407,9 @@
|
|||
[submodule "vendor/grammars/d.tmbundle"]
|
||||
path = vendor/grammars/d.tmbundle
|
||||
url = https://github.com/textmate/d.tmbundle
|
||||
[submodule "vendor/grammars/d2-vscode"]
|
||||
path = vendor/grammars/d2-vscode
|
||||
url = https://github.com/terrastruct/d2-vscode.git
|
||||
[submodule "vendor/grammars/dart-syntax-highlight"]
|
||||
path = vendor/grammars/dart-syntax-highlight
|
||||
url = https://github.com/dart-lang/dart-syntax-highlight
|
||||
|
|
|
@ -333,6 +333,9 @@ vendor/grammars/cython:
|
|||
- source.cython
|
||||
vendor/grammars/d.tmbundle:
|
||||
- source.d
|
||||
vendor/grammars/d2-vscode:
|
||||
- source.d2
|
||||
- text.html.markdown.d2
|
||||
vendor/grammars/dart-syntax-highlight:
|
||||
- source.dart
|
||||
vendor/grammars/data-weave-tmLanguage:
|
||||
|
|
|
@ -1398,6 +1398,16 @@ D-ObjDump:
|
|||
tm_scope: objdump.x86asm
|
||||
ace_mode: assembly_x86
|
||||
language_id: 81
|
||||
D2:
|
||||
type: markup
|
||||
color: "#526ee8"
|
||||
extensions:
|
||||
- ".d2"
|
||||
aliases:
|
||||
- d2lang
|
||||
tm_scope: source.d2
|
||||
ace_mode: text
|
||||
language_id: 37531557
|
||||
DIGITAL Command Language:
|
||||
type: programming
|
||||
aliases:
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
direction: down
|
||||
|
||||
classes: {
|
||||
containers: {
|
||||
shape: rectangle
|
||||
}
|
||||
}
|
||||
|
||||
user: "User" {
|
||||
shape: person
|
||||
}
|
||||
|
||||
database: "SQLite3" {
|
||||
shape: cylinder
|
||||
}
|
||||
|
||||
a {
|
||||
label: null
|
||||
style.fill: transparent
|
||||
style.stroke: transparent
|
||||
}
|
||||
|
||||
b {
|
||||
label: null
|
||||
style.fill: transparent
|
||||
style.stroke: transparent
|
||||
}
|
||||
|
||||
b.display: "Display (Monitor or TV)" {
|
||||
style.3d: true
|
||||
}
|
||||
|
||||
anthias-nginx.class: containers
|
||||
b.anthias-viewer.class: containers
|
||||
a.anthias-server.class: containers
|
||||
a.anthias-websocket.class: containers
|
||||
a.anthias-celery.class: containers
|
||||
a.redis.class: containers
|
||||
|
||||
user -> anthias-nginx
|
||||
anthias-nginx <-> a.anthias-server
|
||||
anthias-nginx -> a.anthias-websocket
|
||||
|
||||
a.anthias-server <-> a.anthias-celery
|
||||
a.anthias-websocket <-> a.anthias-server
|
||||
a.anthias-celery -> a.redis: "in-memory data"
|
||||
a.redis <-> a.anthias-server
|
||||
|
||||
b.anthias-viewer <-> database: "assets data"
|
||||
|
||||
a.anthias-server <-> b.anthias-viewer: "assets data"
|
||||
a.anthias-server <-> database
|
||||
a.anthias-celery <-> database
|
||||
|
||||
b.anthias-viewer -> b.display: "current asset"
|
|
@ -0,0 +1,148 @@
|
|||
|
||||
cTrnDao: CalcTrnDao {
|
||||
q: Query {
|
||||
ByTime
|
||||
ByCategory
|
||||
ByAccount
|
||||
ByPurpose
|
||||
}
|
||||
sql: "SQL: O(trns.count) time | O(trns.notDel.count) space" {
|
||||
"SELECT amount, currency, type FROM transactions WHERE ..."
|
||||
}
|
||||
trns: "List<CalcTrn>" {
|
||||
CalcTrn {
|
||||
shape: class
|
||||
|
||||
amount: Double
|
||||
currency: String
|
||||
type: TransactionType
|
||||
}
|
||||
}
|
||||
|
||||
q -> sql -> trns
|
||||
}
|
||||
|
||||
rawStatsFlow: RawStatsFlow {
|
||||
in: Input {
|
||||
shape: class
|
||||
trns: List<CalcTrn>
|
||||
}
|
||||
|
||||
p: "Process: O(trns.count) time | O(currs.unique.count) space" {
|
||||
"trns.forEach { aggregate incomes, expense by currencies + count them }"
|
||||
}
|
||||
|
||||
out: RawStats {
|
||||
shape: class
|
||||
incomes: Map<CurrencyCode, Double>
|
||||
expenses: Map<CurrencyCode, Double>
|
||||
incomesCount: Int
|
||||
expensesCount: Int
|
||||
}
|
||||
|
||||
in -> p -> out
|
||||
}
|
||||
|
||||
cTrndao.trns -> rawStatsFlow.in.trns
|
||||
|
||||
# RatesFlow
|
||||
ratesDao: RatesDao {
|
||||
sql: "SQL: O(rates.count) time | O(rates.baseCurr.count) space" {
|
||||
"SELECT rate, currency FROM exchange_rates WHERE baseCurrency = ?"
|
||||
}
|
||||
out: "List<Rate>" {
|
||||
Rate {
|
||||
shape: class
|
||||
rate: Double
|
||||
currency: String
|
||||
}
|
||||
}
|
||||
sql -> out
|
||||
}
|
||||
|
||||
ratesOverrideDao: RateOverrideDao {
|
||||
sql: "SQL: O(rates.override.count) time | O(rates.override.baseCurr.count) space" {
|
||||
"SELECT rate, currency FROM exchange_rates_override WHERE baseCurrency = ? AND sync != $DELETING"
|
||||
}
|
||||
out: "List<Rate>" {
|
||||
Rate {
|
||||
shape: class
|
||||
rate: Double
|
||||
currency: String
|
||||
}
|
||||
}
|
||||
sql -> out
|
||||
}
|
||||
|
||||
ratesFlow: RatesFlow {
|
||||
deps: Dependencies {
|
||||
ratesDao
|
||||
ratesOverrideDao
|
||||
baseCurrencyFlow
|
||||
}
|
||||
p: "Process: O(rates.override.count) time | O(1) space" {
|
||||
1: "baseCurrency.flatMapLatest {}"
|
||||
2: "combine(rateDao.findByBaseCurr(), ratesOverridedao.findByBaseCurr())"
|
||||
3: "Override rate with the manual set ones"
|
||||
|
||||
1 -> 2 -> 3
|
||||
|
||||
}
|
||||
out: "RatesData" {
|
||||
shape: class
|
||||
baseCurrency: String
|
||||
rates: Map<CurrencyCode, Double>
|
||||
}
|
||||
|
||||
deps.ratesDao -> p: Reacts
|
||||
deps.ratesOverrideDao -> p: Reacts
|
||||
deps.baseCurrencyFlow -> p: Reacts
|
||||
p -> out
|
||||
}
|
||||
|
||||
ratesDao -> ratesFlow.deps
|
||||
ratesOverrideDao -> ratesFlow.deps
|
||||
|
||||
|
||||
# ExchangeStatsFlow
|
||||
exFlow: ExchangeStatsFlow {
|
||||
deps: Dependencies {
|
||||
ratesFlow: "rates: RatesFlow"
|
||||
}
|
||||
|
||||
in: Input {
|
||||
shape: class
|
||||
rawStats: RawStats
|
||||
outputCurrency: String
|
||||
}
|
||||
|
||||
p: "Process: O(curr.unique.count) space-time" {
|
||||
incs_loop: "rawStats.incomes.forEach {}"
|
||||
incs_exchange: "exchange to output currency"
|
||||
incs_sum: "sum & count"
|
||||
|
||||
incs_loop -> incs_exchange -> incs_sum
|
||||
|
||||
exps_loop: "rawStats.expenses.forEach {}"
|
||||
exps_exchange: "exchange to output currency"
|
||||
exps_sum: "sum & count"
|
||||
|
||||
exps_loop -> exps_exchange -> exps_sum
|
||||
}
|
||||
|
||||
out: Stats {
|
||||
shape: class
|
||||
income: Value
|
||||
expense: Value
|
||||
incomesCount: Int
|
||||
expensesCount: Int
|
||||
}
|
||||
|
||||
deps.ratesFlow -> p: Reacts to rates changes
|
||||
in.rawStats -> p
|
||||
p.incs_sum -> out
|
||||
p.exps_sum -> out
|
||||
}
|
||||
|
||||
ratesFlow.out -> exFlow.deps.ratesFlow: Reacts
|
||||
rawStatsFlow.out -> exFlow.in.rawStats
|
|
@ -126,6 +126,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
|||
- **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle)
|
||||
- **D:** [textmate/d.tmbundle](https://github.com/textmate/d.tmbundle)
|
||||
- **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle)
|
||||
- **D2:** [terrastruct/d2-vscode](https://github.com/terrastruct/d2-vscode)
|
||||
- **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams)
|
||||
- **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile)
|
||||
- **DTrace:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8f1fef4f732ffbf8a2cf70676c15bc9791c010a7
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
name: d2-vscode
|
||||
version: 8f1fef4f732ffbf8a2cf70676c15bc9791c010a7
|
||||
type: git_submodule
|
||||
homepage: https://github.com/terrastruct/d2-vscode.git
|
||||
license: bsd-3-clause
|
||||
licenses:
|
||||
- sources: LICENSE.txt
|
||||
text: |
|
||||
Copyright 2022 Terrastruct, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
notices: []
|
Загрузка…
Ссылка в новой задаче