Skip to content

Commit

Permalink
feat: allow to omit IDs and derive them instead
Browse files Browse the repository at this point in the history
Similar to Rust basic enums, the identifier for each variant doesn't
have to be specified explicitly. Instead it can be derived by continuing
to count upwards from the last explicit value.

Therefore, now the field IDs as well as enum variant IDs can be omitted
and are derived by the compiler. They can be mixed as well to create
gaps in the ID range.
  • Loading branch information
dnaka91 committed Dec 29, 2023
1 parent facee4a commit 76a8649
Show file tree
Hide file tree
Showing 32 changed files with 2,535 additions and 456 deletions.
20 changes: 19 additions & 1 deletion book/highlight/src/languages/stef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ export function stef(hljs: HLJSApi): Language {
4: "symbol",
5: "punctuation",
},
relevance: 2,
relevance: 4,
},
{
match: [/[a-z0-9_]+/, ":", /[a-zA-Z0-9_<>:,& ]+?/, /,?/],
scope: {
1: "attr",
2: "punctuation",
3: "type",
4: "punctuation",
},
relevance: 3,
},
{
match: [/[a-zA-Z0-9_<>,& ]+/, /@\d+/, /,?/],
Expand All @@ -107,6 +117,14 @@ export function stef(hljs: HLJSApi): Language {
2: "symbol",
3: "punctuation",
},
relevance: 2,
},
{
match: [/[a-zA-Z0-9_<>,& ]+?/, /,?/],
scope: {
1: "type",
2: "punctuation",
},
relevance: 1,
},
{
Expand Down
Loading

0 comments on commit 76a8649

Please sign in to comment.