Skip to content

Commit

Permalink
add a json schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Feb 2, 2024
1 parent f65f1bf commit 4879f5a
Show file tree
Hide file tree
Showing 7 changed files with 56,298 additions and 7 deletions.
4 changes: 2 additions & 2 deletions LintLanguageDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ OR: {or: [EXPR, EXPR, EXPR]}
NOT: {not: EXPR}

Quantifiers:
FORALL: {all: {value: Variable, where?: EXPR, in: Variable | Value[]}}
EXISTS: {exists: {value: Variable, where?: EXPR, in: Variable | Value[]}}
FORALL: {all: {varbs: Variable[], where?: EXPR, in: Variable | Value[]}}
EXISTS: {exists: {varbs: Variable[], where?: EXPR, in: Variable | Value[]}}

Comparisons (value) => expression
similar: {"similar": {left: Value, right: Value, similarityThreshold: Number}}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ First time you start it up you should also run `yarn prep data`
- [ ] Parser?
- [ ] Integration into main app
- [ ] "Blame" for colors
- [ ] JSON Schema (for validation) (if parser is not used)
- [x] JSON Schema (for validation) (if parser is not used)
- [ ] Add background, roles, etc
- [ ] Add palette level semantics?
- [na] Swap left/right for [a, b] for density
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"build-parser": "lezer-generator src/lib/lint-language/lint.grammar -o src/lib/lint-language/lint-parser.js"
"build-parser": "lezer-generator src/lib/lint-language/lint.grammar -o src/lib/lint-language/lint-parser.js",
"build-schema": "ts-json-schema-generator --path src/lib/lint-language/lint-type.ts LintProgram > src/lib/lint-language/lint-schema.json"
},
"devDependencies": {
"@lezer/generator": "^1.6.0",
Expand All @@ -28,6 +29,7 @@
"postcss": "^8.4.32",
"svelte": "^4.2.3",
"svelte-check": "^3.6.0",
"ts-json-schema-generator": "^1.5.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vega-typings": "^1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/lint-language/lint-language.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cvd_sim from "../blindness";
import { Color, colorPickerConfig } from "../Color";
import { getName } from "../lints/name-discrim";
import type { LintProgram } from "./lint-type";

type RawValues = string | number | Color | string[] | number[] | Color[];
class Environment {
Expand Down Expand Up @@ -768,7 +769,7 @@ const DEFAULT_OPTIONS = {
stages: false,
};
export function LLEval(
root: any,
root: LintProgram,
colors: Color[],
options: Partial<typeof DEFAULT_OPTIONS> = {}
) {
Expand Down
Loading

0 comments on commit 4879f5a

Please sign in to comment.