@kurrawongai/codemirror-lang-turtle12 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +25 -0
- package/README.md +42 -0
- package/dist/complete.d.ts +35 -0
- package/dist/highlight.d.ts +17 -0
- package/dist/index.cjs +235 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +220 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
- package/src/complete.ts +150 -0
- package/src/grammar.d.ts +13 -0
- package/src/highlight.ts +76 -0
- package/src/index.ts +124 -0
- package/src/turtle.grammar +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { syntaxTree, indentNodeProp, delimitedIndent, foldNodeProp, foldInside, LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import { LRParser } from '@lezer/lr';
|
|
3
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
4
|
+
|
|
5
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
6
|
+
const parser$1 = LRParser.deserialize({
|
|
7
|
+
version: 14,
|
|
8
|
+
states: "5fQYQPOOQ!WQPOOQ!bQPOOQ!bQPOOOOQO'#Ce'#CeOOQO'#EX'#EXO!jQPO'#CaO!oQPO'#CgO!zQPO'#CiO!oQPO'#CkO#PQPO'#CmO#UQPO'#CmOOQO'#C_'#C_OOQO'#Cv'#CvO$[QQO'#C{O$cQPO'#DOO$qQPO'#DbO$cQPO'#CqO%VQPO'#CqOOQO'#EW'#EWO%kQPO'#EWOOQO'#D{'#D{QYQPOOOOQO'#Dn'#DnO%pQPO'#DqO%}QPO'#DlO&`QPO'#DsO&qQPO'#DsO'SQPO'#DtO$cQPO'#DtOOQO'#Ea'#EaOOQO'#E`'#E`OOQO'#EQ'#EQQ!WQPOOOOQO'#Ec'#EcOOQO'#ER'#ERQ!bQPOOO!oQPO'#Dv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Ofh#PSkPq`!X^!Q![#b#y$Y$Z$_Q!]`R#g!|[#`!z#O#a#j#v$OR#}#hQ#d!zS$T#v$OR$]#O]#`!z#O#a#j#v$OTnPqSjPqR!eiSnPqQ!fjR#R!eQ!dhR#k#PTsQtTvRwR#p#YQfOR!afQ!Q^R!s!QS#a!z#vS#j#O$OT#u#a#jQ#c!zW#w#c#x$[$^Q#x#dQ$[#OR$^$]Q#f!{S#z#f$aR$a$bQqPR!jqQtQR!ktQwRR!mwTeOfWaOfh#PUgPiqQzVQ|X`!X^!Q![#b#y$Y$Z$_h!Y_abjklm!^!x#_#e$`Q!]`Q!luQ!nxQ!oyQ!q{Q!w!WQ#[!uQ#g!|Q#q#]V#s#^#i#{S!P^!QS!z![#yS#O$Y$_Q#v#bR$O$ZR!x!WR#r#]R!^`R#h!|TpPqQ#X!lQ#Y!nR$W$PSuQtSxRwR#l#W",
|
|
11
|
+
nodeNames: "⚠ Comment TurtleDoc Directive . PrefixID AtPrefix PNameNS IRIRef PrefixedName PNameLN Base AtBase SparqlPrefix KwPrefix SparqlBase KwBase Version KwVersion VersionSpecifier AtVersion Triples PredicateObjectList Verb KeywordA ObjectList BlankNode BlankNodeLabel Anon ) ( Collection ] [ BlankNodePropertyList RDFLiteral String LangDir Datatype ^^ NumericLiteral Integer Decimal Double BooleanLiteral True False )>> <<( TripleTerm >> << ReifiedTriple Reifier ~ Annotation |} {| AnnotationBlock , ; TrigDoc GraphStatement KwGraph LabelOrSubject } { WrappedGraph TriplesBlock TriplesOrGraph Triples2 NTriplesDoc NTriple NTripleTerm NQuadsDoc NQuad GraphLabel",
|
|
12
|
+
maxTerm: 99,
|
|
13
|
+
nodeProps: [
|
|
14
|
+
["openedBy", 29,"(",32,"[",47,"<<(",50,"<<",56,"{|",65,"{"],
|
|
15
|
+
["closedBy", 30,")",33,"]",48,")>>",51,">>",57,"|}",66,"}"]
|
|
16
|
+
],
|
|
17
|
+
skippedNodes: [0,1],
|
|
18
|
+
repeatNodeCount: 8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ase KwGraph KwVersion KeywordA": tags.keyword,
|
|
28
|
+
IRIRef: tags.url,
|
|
29
|
+
"PNameNS PNameLN": tags.namespace,
|
|
30
|
+
"BlankNodeLabel Anon": tags.propertyName,
|
|
31
|
+
"String VersionSpecifier": tags.string,
|
|
32
|
+
"Integer Decimal Double": tags.number,
|
|
33
|
+
"True False": tags.bool,
|
|
34
|
+
LangDir: tags.annotation,
|
|
35
|
+
"Datatype/IRIRef Datatype/PrefixedName/PNameNS Datatype/PrefixedName/PNameLN": tags.typeName,
|
|
36
|
+
'Datatype/"^^"': tags.typeName,
|
|
37
|
+
/*
|
|
38
|
+
* The RDF 1.2 term brackets are tagged apart from ordinary grouping, because
|
|
39
|
+
* `<< s p o >>` and `<<( s p o )>>` differ by one character and mean quite
|
|
40
|
+
* different things — a statement you can refer to, versus an object that *is*
|
|
41
|
+
* a triple. A style that cannot separate them cannot help a reader see that.
|
|
42
|
+
*
|
|
43
|
+
* Each is a `special()` of the standard tag its glyphs actually are, so the
|
|
44
|
+
* fallback chain does the work: a theme that knows nothing about RDF 1.2 and
|
|
45
|
+
* styles `bracket` (or `brace`/`paren`/`angleBracket`) still colours all of
|
|
46
|
+
* them, and one that wants the distinction overrides the specific tag.
|
|
47
|
+
*/
|
|
48
|
+
/*
|
|
49
|
+
* Every token *inside* an RDF 1.2 nested-triple construct also carries
|
|
50
|
+
* `quote`, so a style can shade the whole thing and not just its brackets —
|
|
51
|
+
* which is what "colour reified triples differently" usually means. The
|
|
52
|
+
* `/...` form applies to descendants and *combines* with each token's own
|
|
53
|
+
* tag, so an IRI inside a reified triple is `quote url`, not one or the
|
|
54
|
+
* other. A style that never mentions `quote` sees no change at all.
|
|
55
|
+
*
|
|
56
|
+
* One tag for all three constructs, rather than three: the brackets above
|
|
57
|
+
* already say which kind it is, and a style wanting per-kind regions can add
|
|
58
|
+
* its own props to the exported parser.
|
|
59
|
+
*/
|
|
60
|
+
"ReifiedTriple/... TripleTerm/... NTripleTerm/... AnnotationBlock/...": tags.quote,
|
|
61
|
+
'"<<" ">>"': tags.special(tags.angleBracket),
|
|
62
|
+
'"<<(" ")>>"': tags.special(tags.paren),
|
|
63
|
+
'"{|" "|}"': tags.special(tags.brace),
|
|
64
|
+
'"{" "}"': tags.brace,
|
|
65
|
+
'"[" "]"': tags.squareBracket,
|
|
66
|
+
'"(" ")"': tags.paren,
|
|
67
|
+
// The reifier marker only ever introduces a reifier, so it is worth telling
|
|
68
|
+
// from arithmetic; it falls back to `operator`.
|
|
69
|
+
'"~"': tags.special(tags.operator),
|
|
70
|
+
'";" ","': tags.separator,
|
|
71
|
+
'"."': tags.punctuation
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const DIRECTIVES = ["@prefix", "@base", "PREFIX", "BASE"];
|
|
75
|
+
const TRIG_DIRECTIVES = [...DIRECTIVES, "GRAPH"];
|
|
76
|
+
const TERM_KEYWORDS = ["a", "true", "false"];
|
|
77
|
+
const INERT = /* @__PURE__ */ new Set(["Comment", "String", "VersionSpecifier", "IRIRef"]);
|
|
78
|
+
function documentPrefixes(state) {
|
|
79
|
+
const prefixes = {};
|
|
80
|
+
const tree = syntaxTree(state);
|
|
81
|
+
tree.iterate({
|
|
82
|
+
enter: (node) => {
|
|
83
|
+
if (node.name !== "PrefixID" && node.name !== "SparqlPrefix") return;
|
|
84
|
+
let label = null;
|
|
85
|
+
let iri = null;
|
|
86
|
+
for (let child = node.node.firstChild; child; child = child.nextSibling) {
|
|
87
|
+
if (child.name === "PNameNS" && label === null) {
|
|
88
|
+
label = state.sliceDoc(child.from, child.to).slice(0, -1);
|
|
89
|
+
} else if (child.name === "IRIRef" && iri === null) {
|
|
90
|
+
iri = state.sliceDoc(child.from + 1, child.to - 1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (label !== null) prefixes[label] = iri ?? "";
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return prefixes;
|
|
97
|
+
}
|
|
98
|
+
function resolveSource(source, state) {
|
|
99
|
+
if (!source) return {};
|
|
100
|
+
return typeof source === "function" ? source(state) : source;
|
|
101
|
+
}
|
|
102
|
+
function knownPrefixes(state, options = {}) {
|
|
103
|
+
return { ...resolveSource(options.prefixSource, state), ...documentPrefixes(state) };
|
|
104
|
+
}
|
|
105
|
+
function prefixCompletions(state, options) {
|
|
106
|
+
const prefixes = knownPrefixes(state, options);
|
|
107
|
+
return Object.entries(prefixes).map(([label, iri]) => ({
|
|
108
|
+
label: `${label}:`,
|
|
109
|
+
type: "namespace",
|
|
110
|
+
detail: iri || void 0
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
function keywordCompletions(words) {
|
|
114
|
+
return words.map((label) => ({ label, type: "keyword" }));
|
|
115
|
+
}
|
|
116
|
+
function inUnterminatedTerm(state, pos) {
|
|
117
|
+
const line = state.doc.lineAt(pos);
|
|
118
|
+
const text = line.text.slice(0, pos - line.from);
|
|
119
|
+
let quote = null;
|
|
120
|
+
let angle = false;
|
|
121
|
+
for (let i = 0; i < text.length; i++) {
|
|
122
|
+
const ch = text[i];
|
|
123
|
+
if (quote) {
|
|
124
|
+
if (ch === "\\") i++;
|
|
125
|
+
else if (ch === quote) quote = null;
|
|
126
|
+
} else if (angle) {
|
|
127
|
+
if (ch === ">" || ch === " " || ch === " ") angle = false;
|
|
128
|
+
} else if (ch === '"' || ch === "'") {
|
|
129
|
+
quote = ch;
|
|
130
|
+
} else if (ch === "<" && text[i + 1] !== "<") {
|
|
131
|
+
angle = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return quote !== null || angle;
|
|
135
|
+
}
|
|
136
|
+
function turtleCompletionSource(options = {}, dialect = "turtle") {
|
|
137
|
+
return (context) => {
|
|
138
|
+
const word = context.matchBefore(/[@A-Za-z_][\w.-]*:?/);
|
|
139
|
+
if (!word && !context.explicit) return null;
|
|
140
|
+
const from = word ? word.from : context.pos;
|
|
141
|
+
const node = syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
142
|
+
if (INERT.has(node.name)) return null;
|
|
143
|
+
if (inUnterminatedTerm(context.state, context.pos)) return null;
|
|
144
|
+
const directives = dialect === "trig" ? TRIG_DIRECTIVES : DIRECTIVES;
|
|
145
|
+
return {
|
|
146
|
+
from,
|
|
147
|
+
options: [
|
|
148
|
+
...keywordCompletions(directives),
|
|
149
|
+
...keywordCompletions(TERM_KEYWORDS),
|
|
150
|
+
...prefixCompletions(context.state, options)
|
|
151
|
+
],
|
|
152
|
+
validFor: /^[@A-Za-z_][\w.-]*:?$/
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const parser = parser$1;
|
|
158
|
+
const statementFold = (node, state) => {
|
|
159
|
+
const firstLineEnd = state.doc.lineAt(node.from).to;
|
|
160
|
+
if (node.to <= firstLineEnd) return null;
|
|
161
|
+
for (let n = syntaxTree(state).resolveInner(firstLineEnd, -1); n; n = n.parent) {
|
|
162
|
+
if (n.from < node.from) break;
|
|
163
|
+
if (n.type.prop(foldNodeProp) && n.from <= firstLineEnd && n.to > firstLineEnd && n.type !== node.type) return null;
|
|
164
|
+
}
|
|
165
|
+
return { from: firstLineEnd, to: node.to };
|
|
166
|
+
};
|
|
167
|
+
const turtleProps = [
|
|
168
|
+
turtleHighlighting,
|
|
169
|
+
indentNodeProp.add({
|
|
170
|
+
BlankNodePropertyList: delimitedIndent({ closing: "]" }),
|
|
171
|
+
Collection: delimitedIndent({ closing: ")" }),
|
|
172
|
+
WrappedGraph: delimitedIndent({ closing: "}" }),
|
|
173
|
+
AnnotationBlock: delimitedIndent({ closing: "|}" }),
|
|
174
|
+
TripleTerm: delimitedIndent({ closing: ")>>" }),
|
|
175
|
+
ReifiedTriple: delimitedIndent({ closing: ">>" })
|
|
176
|
+
}),
|
|
177
|
+
foldNodeProp.add({
|
|
178
|
+
BlankNodePropertyList: foldInside,
|
|
179
|
+
Collection: foldInside,
|
|
180
|
+
WrappedGraph: foldInside,
|
|
181
|
+
AnnotationBlock: foldInside,
|
|
182
|
+
"Triples Triples2 TriplesOrGraph": statementFold
|
|
183
|
+
})
|
|
184
|
+
];
|
|
185
|
+
const languageData = {
|
|
186
|
+
commentTokens: { line: "#" },
|
|
187
|
+
closeBrackets: { brackets: ["[", "(", "<", '"', "'"] },
|
|
188
|
+
indentOnInput: /^\s*[\]})]$/
|
|
189
|
+
};
|
|
190
|
+
function define(top) {
|
|
191
|
+
return LRLanguage.define({
|
|
192
|
+
name: top === "TurtleDoc" ? "turtle" : top === "TrigDoc" ? "trig" : top === "NTriplesDoc" ? "ntriples" : "nquads",
|
|
193
|
+
parser: parser$1.configure({ top, props: turtleProps }),
|
|
194
|
+
languageData
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const turtleLanguage = define("TurtleDoc");
|
|
198
|
+
const trigLanguage = define("TrigDoc");
|
|
199
|
+
const ntriplesLanguage = define("NTriplesDoc");
|
|
200
|
+
const nquadsLanguage = define("NQuadsDoc");
|
|
201
|
+
function support(language, options, dialect) {
|
|
202
|
+
return new LanguageSupport(language, [
|
|
203
|
+
language.data.of({ autocomplete: turtleCompletionSource(options, dialect) })
|
|
204
|
+
]);
|
|
205
|
+
}
|
|
206
|
+
function turtle(options = {}) {
|
|
207
|
+
return support(turtleLanguage, options, "turtle");
|
|
208
|
+
}
|
|
209
|
+
function trig(options = {}) {
|
|
210
|
+
return support(trigLanguage, options, "trig");
|
|
211
|
+
}
|
|
212
|
+
function ntriples() {
|
|
213
|
+
return new LanguageSupport(ntriplesLanguage);
|
|
214
|
+
}
|
|
215
|
+
function nquads() {
|
|
216
|
+
return new LanguageSupport(nquadsLanguage);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { documentPrefixes, knownPrefixes, nquads, nquadsLanguage, ntriples, ntriplesLanguage, parser, trig, trigLanguage, turtle, turtleCompletionSource, turtleHighlighting, turtleLanguage, turtleProps };
|
|
220
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/turtle.grammar","../src/highlight.ts","../src/complete.ts","../src/index.ts"],"sourcesContent":["// This file was generated by lezer-generator. You probably shouldn't edit it.\nimport {LRParser} from \"@lezer/lr\"\nexport const parser = LRParser.deserialize({\n version: 14,\n states: \"5fQYQPOOQ!WQPOOQ!bQPOOQ!bQPOOOOQO'#Ce'#CeOOQO'#EX'#EXO!jQPO'#CaO!oQPO'#CgO!zQPO'#CiO!oQPO'#CkO#PQPO'#CmO#UQPO'#CmOOQO'#C_'#C_OOQO'#Cv'#CvO$[QQO'#C{O$cQPO'#DOO$qQPO'#DbO$cQPO'#CqO%VQPO'#CqOOQO'#EW'#EWO%kQPO'#EWOOQO'#D{'#D{QYQPOOOOQO'#Dn'#DnO%pQPO'#DqO%}QPO'#DlO&`QPO'#DsO&qQPO'#DsO'SQPO'#DtO$cQPO'#DtOOQO'#Ea'#EaOOQO'#E`'#E`OOQO'#EQ'#EQQ!WQPOOOOQO'#Ec'#EcOOQO'#ER'#ERQ!bQPOOO!oQPO'#DvOOQO'#ES'#ESQ!bQPOOO!oQPO'#DyO!oQPO,58{O'eQPO,59RO!oQPO,59TOOQO,59V,59VOOQO,59X,59XO'jQPO,59XOOQO'#D|'#D|O'oQQO,59gOOQO,59g,59gO([QQO'#DPOOQO'#DU'#DUOOQO'#DY'#DYOOQO'#EZ'#EZO%}QPO'#D_OOQO'#EY'#EYOOQO'#Cs'#CsO)hQPO,59jO#ZQQO'#CrOOQO'#E^'#E^O$cQPO,59|OOQO,59],59]OOQO,5:r,5:rOOQO-E7y-E7yO)mQPO'#DrOOQO,5:],5:]O)uQPO,5:]O&lQPO,5:WOOQO,5:_,5:_O)zQPO,5:_OOQO,5:`,5:`O*PQPO,5:`OOQO-E8O-E8OOOQO-E8P-E8PO*UQQO,5:bOOQO-E8Q-E8QO*UQQO,5:eO*dQPO1G.gOOQO1G.m1G.mOOQO1G.o1G.oOOQO1G.s1G.sOOQO-E7z-E7zOOQO1G/R1G/RO!oQP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RIRef PrefixedName PNameLN Base AtBase SparqlPrefix KwPrefix SparqlBase KwBase Version KwVersion VersionSpecifier AtVersion Triples PredicateObjectList Verb KeywordA ObjectList BlankNode BlankNodeLabel Anon ) ( Collection ] [ BlankNodePropertyList RDFLiteral String LangDir Datatype ^^ NumericLiteral Integer Decimal Double BooleanLiteral True False )>> <<( TripleTerm >> << ReifiedTriple Reifier ~ Annotation |} {| AnnotationBlock , ; TrigDoc GraphStatement KwGraph LabelOrSubject } { WrappedGraph TriplesBlock TriplesOrGraph Triples2 NTriplesDoc NTriple NTripleTerm NQuadsDoc NQuad GraphLabel\",\n maxTerm: 99,\n nodeProps: [\n [\"openedBy\", 29,\"(\",32,\"[\",47,\"<<(\",50,\"<<\",56,\"{|\",65,\"{\"],\n [\"closedBy\", 30,\")\",33,\"]\",48,\")>>\",51,\">>\",57,\"|}\",66,\"}\"]\n ],\n skippedNodes: [0,1],\n repeatNodeCount: 8,\n tokenData: \"#-Z~R!]XY$zYZ$z]^$zpq$zrs%]st,]wx,wxy3kyz3p{|4T|}5{}!O4T!O!P6Q!Q![5^![!]6Y!]!^<j!^!_<o!`!aAZ!b!cAf!c!dL|!d!e! s!e!iL|!i!j!(X!j!rL|!r!s!0_!s!xL|!x!y!:]!y!}L|!}#O!E{#P#Q!Fx#Q#R!F}#R#S!GY#T#U!KW#U#V! s#V#YL|#Y#Z!Ln#Z#[!(X#[#dL|#d#e!0_#e#hL|#h#i#&_#i#jL|#j#k!:]#k#oL|#o#p#,g#p#q#,t#q#r#-P#r#s#-U%W%oL|%p&aL|&b1pL|4U4dL|4e$ISL|$I`$IbL|$Kh%#tL|&/x&EtL|&FV;'SL|?&r?AhL|?BY?MnL|~%PS!y~XY$zYZ$z]^$zpq$zR%`XOY%{Z]%{^r%{rs)os#O%{#O#P&r#P;'S%{;'S;=`)i<%lO%{R&OXOY%{Z]%{^r%{rs&ks#O%{#O#P&r#P;'S%{;'S;=`)i<%lO%{R&rOtQcPR&uYrs%{wx%{!w!x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%#tL|&/x&EtL|&FV;'SL|?&r?AhL|?BY?MnL|~#+Ue}~}!OL|!O!PNb!Q![L|![!]6Y!c!}L|#R#SL|#T#oL|$}%OL|%W%oL|%p&aL|&b1pL|1p4UL|4U4dL|4e$ISL|$I`$IbL|$Je$JgL|$Kh%#tL|&/x&EtL|&FV;'SL|?&r?AhL|?BY?MnL|V#,lP!dP#p#q#,oU#,tO!ZU~#,wP#q#r#,z~#-PO!Y~~#-UO!c~~#-ZO!W~\",\n tokenizers: [0, 1, 2],\n topRules: {\"TurtleDoc\":[0,2],\"TrigDoc\":[1,61],\"NTriplesDoc\":[2,71],\"NQuadsDoc\":[3,74]},\n tokenPrec: 931\n})\n","import type { NodePropSource } from '@lezer/common';\nimport { styleTags, tags as t } from '@lezer/highlight';\n\n/**\n * The shared highlight-tag table, Turtle half.\n *\n * `docs/highlight-tags.md` is the canonical table and `test/highlight.test.ts`\n * asserts this against it, so a consumer can keep one `HighlightStyle` for all\n * three languages. Two conventions are worth knowing:\n *\n * - an IRI and a prefixed name are tagged differently (`url` / `namespace`)\n * but denote the same kind of thing, so a style is free to colour them the\n * same — which is what the reference style does;\n * - a datatype IRI is tagged `typeName` rather than `url`, because it\n * qualifies the literal rather than being a term the document is about. The\n * parent-path rules below are more specific than the bare token rules, so\n * they win inside `Datatype`.\n */\nexport const turtleHighlighting: NodePropSource = styleTags({\n Comment: t.comment,\n\n 'AtPrefix AtBase AtVersion KwPrefix KwBase KwGraph KwVersion KeywordA': t.keyword,\n\n IRIRef: t.url,\n 'PNameNS PNameLN': t.namespace,\n\n 'BlankNodeLabel Anon': t.propertyName,\n\n 'String VersionSpecifier': t.string,\n 'Integer Decimal Double': t.number,\n 'True False': t.bool,\n\n LangDir: t.annotation,\n 'Datatype/IRIRef Datatype/PrefixedName/PNameNS Datatype/PrefixedName/PNameLN': t.typeName,\n 'Datatype/\"^^\"': t.typeName,\n\n /*\n * The RDF 1.2 term brackets are tagged apart from ordinary grouping, because\n * `<< s p o >>` and `<<( s p o )>>` differ by one character and mean quite\n * different things — a statement you can refer to, versus an object that *is*\n * a triple. A style that cannot separate them cannot help a reader see that.\n *\n * Each is a `special()` of the standard tag its glyphs actually are, so the\n * fallback chain does the work: a theme that knows nothing about RDF 1.2 and\n * styles `bracket` (or `brace`/`paren`/`angleBracket`) still colours all of\n * them, and one that wants the distinction overrides the specific tag.\n */\n\n /*\n * Every token *inside* an RDF 1.2 nested-triple construct also carries\n * `quote`, so a style can shade the whole thing and not just its brackets —\n * which is what \"colour reified triples differently\" usually means. The\n * `/...` form applies to descendants and *combines* with each token's own\n * tag, so an IRI inside a reified triple is `quote url`, not one or the\n * other. A style that never mentions `quote` sees no change at all.\n *\n * One tag for all three constructs, rather than three: the brackets above\n * already say which kind it is, and a style wanting per-kind regions can add\n * its own props to the exported parser.\n */\n 'ReifiedTriple/... TripleTerm/... NTripleTerm/... AnnotationBlock/...': t.quote,\n\n '\"<<\" \">>\"': t.special(t.angleBracket),\n '\"<<(\" \")>>\"': t.special(t.paren),\n '\"{|\" \"|}\"': t.special(t.brace),\n '\"{\" \"}\"': t.brace,\n '\"[\" \"]\"': t.squareBracket,\n '\"(\" \")\"': t.paren,\n\n // The reifier marker only ever introduces a reifier, so it is worth telling\n // from arithmetic; it falls back to `operator`.\n '\"~\"': t.special(t.operator),\n\n '\";\" \",\"': t.separator,\n '\".\"': t.punctuation,\n});\n","import { syntaxTree } from '@codemirror/language';\nimport type { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';\nimport type { EditorState } from '@codemirror/state';\n\n/** A prefix label (without the colon) mapped to the IRI it expands to. */\nexport type PrefixMap = Record<string, string>;\n\n/** Where `turtle()` and friends may look for prefixes beyond the document. */\nexport type PrefixSource = PrefixMap | ((state: EditorState) => PrefixMap);\n\nexport interface CompletionOptions {\n /**\n * Prefixes the editor should offer even when the document has not declared\n * them — an application's own prefix manager, typically. Document\n * declarations win on conflict, because what the document says is what the\n * document means.\n */\n prefixSource?: PrefixSource;\n}\n\nconst DIRECTIVES = ['@prefix', '@base', 'PREFIX', 'BASE'];\nconst TRIG_DIRECTIVES = [...DIRECTIVES, 'GRAPH'];\nconst TERM_KEYWORDS = ['a', 'true', 'false'];\n\n/** Nodes whose interior is text, not syntax: no completion belongs there. */\nconst INERT = new Set(['Comment', 'String', 'VersionSpecifier', 'IRIRef']);\n\n/**\n * The prefixes declared by the document itself, read from the syntax tree.\n *\n * Both spellings are read — `@prefix ex: <…>` and `PREFIX ex: <…>` — because a\n * document may mix them, and a reader completing `ex:` does not care which one\n * declared it.\n */\nexport function documentPrefixes(state: EditorState): PrefixMap {\n const prefixes: PrefixMap = {};\n const tree = syntaxTree(state);\n tree.iterate({\n enter: (node) => {\n if (node.name !== 'PrefixID' && node.name !== 'SparqlPrefix') return;\n let label: string | null = null;\n let iri: string | null = null;\n for (let child = node.node.firstChild; child; child = child.nextSibling) {\n if (child.name === 'PNameNS' && label === null) {\n label = state.sliceDoc(child.from, child.to).slice(0, -1);\n } else if (child.name === 'IRIRef' && iri === null) {\n iri = state.sliceDoc(child.from + 1, child.to - 1);\n }\n }\n if (label !== null) prefixes[label] = iri ?? '';\n },\n });\n return prefixes;\n}\n\nfunction resolveSource(source: PrefixSource | undefined, state: EditorState): PrefixMap {\n if (!source) return {};\n return typeof source === 'function' ? source(state) : source;\n}\n\n/** Every prefix the editor knows about: the external source, overlaid by the document's. */\nexport function knownPrefixes(state: EditorState, options: CompletionOptions = {}): PrefixMap {\n return { ...resolveSource(options.prefixSource, state), ...documentPrefixes(state) };\n}\n\nfunction prefixCompletions(state: EditorState, options: CompletionOptions): Completion[] {\n const prefixes = knownPrefixes(state, options);\n return Object.entries(prefixes).map(([label, iri]) => ({\n label: `${label}:`,\n type: 'namespace',\n detail: iri || undefined,\n }));\n}\n\nfunction keywordCompletions(words: readonly string[]): Completion[] {\n return words.map((label) => ({ label, type: 'keyword' }));\n}\n\n/**\n * Is the cursor inside a literal or IRI that has not been closed yet?\n *\n * A half-typed `\"some tex` or `<http://ex` never reaches a `String` or\n * `IRIRef` node — it is error debris, and the error node covers only the last\n * word — so the node name cannot answer this. Scanning the line up to the\n * cursor can, and it is the state a reader is in while typing one.\n *\n * Two details earn their place. `<<` is not an IRI, so it does not open one,\n * which keeps completion alive inside a half-typed reified triple. And an IRI\n * cannot contain a space, so whitespace closes the scan rather than\n * suppressing completion for the rest of the line.\n *\n * The scan is line-local, so an unterminated *long* string (`\"\"\"…`) spanning\n * lines is not detected past its first line. Terminated ones are, through the\n * `String` node above.\n */\nfunction inUnterminatedTerm(state: EditorState, pos: number): boolean {\n const line = state.doc.lineAt(pos);\n const text = line.text.slice(0, pos - line.from);\n let quote: string | null = null;\n let angle = false;\n for (let i = 0; i < text.length; i++) {\n const ch = text[i];\n if (quote) {\n if (ch === '\\\\') i++;\n else if (ch === quote) quote = null;\n } else if (angle) {\n if (ch === '>' || ch === ' ' || ch === '\\t') angle = false;\n } else if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === '<' && text[i + 1] !== '<') {\n angle = true;\n }\n }\n return quote !== null || angle;\n}\n\n/**\n * Completion for Turtle-family documents.\n *\n * Deliberately context-light: it offers directives, the three term keywords and\n * the document's prefixes wherever a word is being typed, rather than trying to\n * work out whether the cursor is in a subject or an object position. In an\n * error-tolerant tree a half-typed statement usually has no reliable position\n * to read, and a wrong context is worse than a slightly long list.\n */\nexport function turtleCompletionSource(\n options: CompletionOptions = {},\n dialect: 'turtle' | 'trig' = 'turtle'\n) {\n return (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/[@A-Za-z_][\\w.-]*:?/);\n if (!word && !context.explicit) return null;\n const from = word ? word.from : context.pos;\n\n const node = syntaxTree(context.state).resolveInner(context.pos, -1);\n if (INERT.has(node.name)) return null;\n if (inUnterminatedTerm(context.state, context.pos)) return null;\n\n const directives = dialect === 'trig' ? TRIG_DIRECTIVES : DIRECTIVES;\n return {\n from,\n options: [\n ...keywordCompletions(directives),\n ...keywordCompletions(TERM_KEYWORDS),\n ...prefixCompletions(context.state, options),\n ],\n validFor: /^[@A-Za-z_][\\w.-]*:?$/,\n };\n };\n}\n","import type { SyntaxNode } from '@lezer/common';\nimport type { EditorState } from '@codemirror/state';\nimport {\n LRLanguage,\n LanguageSupport,\n delimitedIndent,\n foldInside,\n foldNodeProp,\n indentNodeProp,\n syntaxTree,\n} from '@codemirror/language';\nimport type { LRParser } from '@lezer/lr';\nimport { parser as rawParser } from './turtle.grammar';\nimport { turtleHighlighting } from './highlight';\nimport { turtleCompletionSource } from './complete';\nimport type { CompletionOptions } from './complete';\n\nexport type { CompletionOptions, PrefixMap, PrefixSource } from './complete';\nexport { documentPrefixes, knownPrefixes, turtleCompletionSource } from './complete';\nexport { turtleHighlighting } from './highlight';\n\n/** The unconfigured grammar, for callers that want their own `top` or props. */\nexport const parser: LRParser = rawParser;\n\n/**\n * Fold a whole statement from the end of its first line.\n *\n * This is the one fold in Turtle with no brackets around it: a subject with a\n * long `;` list is the common shape a reader wants collapsed, and the structure\n * that shape has is a statement, not a delimiter.\n *\n * It stands aside when a bracket opens on the same line. Folding\n * `ex:s ex:p [` at the statement level would hide the `] .` as well, leaving\n * what is left looking unterminated; the bracket's own fold — which CodeMirror\n * would otherwise never reach, since the statement node encloses it — reads\n * correctly.\n */\nconst statementFold = (node: SyntaxNode, state: EditorState) => {\n const firstLineEnd = state.doc.lineAt(node.from).to;\n if (node.to <= firstLineEnd) return null;\n for (let n: SyntaxNode | null = syntaxTree(state).resolveInner(firstLineEnd, -1); n; n = n.parent) {\n if (n.from < node.from) break;\n if (n.type.prop(foldNodeProp) && n.from <= firstLineEnd && n.to > firstLineEnd && n.type !== node.type) return null;\n }\n return { from: firstLineEnd, to: node.to };\n};\n\n/**\n * Highlighting, folding and indentation, shared by all four dialects.\n *\n * Exported so a consumer can re-configure the parser with props of their own —\n * extra `styleTags`, say, to tag the three RDF 1.2 constructs' regions apart\n * rather than all as `quote`. `codemirror-lang-sparql12` exports `sparqlProps`\n * for the same reason.\n */\nexport const turtleProps = [\n turtleHighlighting,\n indentNodeProp.add({\n BlankNodePropertyList: delimitedIndent({ closing: ']' }),\n Collection: delimitedIndent({ closing: ')' }),\n WrappedGraph: delimitedIndent({ closing: '}' }),\n AnnotationBlock: delimitedIndent({ closing: '|}' }),\n TripleTerm: delimitedIndent({ closing: ')>>' }),\n ReifiedTriple: delimitedIndent({ closing: '>>' }),\n }),\n foldNodeProp.add({\n BlankNodePropertyList: foldInside,\n Collection: foldInside,\n WrappedGraph: foldInside,\n AnnotationBlock: foldInside,\n 'Triples Triples2 TriplesOrGraph': statementFold,\n }),\n];\n\nconst languageData = {\n commentTokens: { line: '#' },\n closeBrackets: { brackets: ['[', '(', '<', '\"', \"'\"] },\n indentOnInput: /^\\s*[\\]})]$/,\n};\n\nfunction define(top: string) {\n return LRLanguage.define({\n name: top === 'TurtleDoc' ? 'turtle' : top === 'TrigDoc' ? 'trig' : top === 'NTriplesDoc' ? 'ntriples' : 'nquads',\n parser: rawParser.configure({ top, props: turtleProps }),\n languageData,\n });\n}\n\nexport const turtleLanguage = define('TurtleDoc');\nexport const trigLanguage = define('TrigDoc');\nexport const ntriplesLanguage = define('NTriplesDoc');\nexport const nquadsLanguage = define('NQuadsDoc');\n\nfunction support(language: LRLanguage, options: CompletionOptions, dialect: 'turtle' | 'trig') {\n return new LanguageSupport(language, [\n language.data.of({ autocomplete: turtleCompletionSource(options, dialect) }),\n ]);\n}\n\n/** RDF 1.2 Turtle. */\nexport function turtle(options: CompletionOptions = {}): LanguageSupport {\n return support(turtleLanguage, options, 'turtle');\n}\n\n/** RDF 1.2 TriG. */\nexport function trig(options: CompletionOptions = {}): LanguageSupport {\n return support(trigLanguage, options, 'trig');\n}\n\n/**\n * RDF 1.2 N-Triples.\n *\n * A strict subset with its own entry point rather than Turtle in a lenient\n * mood: a prefixed name or a `;` list in an N-Triples document is an error, and\n * an editor that colours it as valid is lying about the file it will write.\n */\nexport function ntriples(): LanguageSupport {\n return new LanguageSupport(ntriplesLanguage);\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AM,cAAA,GAAiB,OAAO,WAAW;AAEhD,SAAS,OAAA,CAAQ,QAAA,EAAsB,OAAA,EAA4B,OAAA,EAA4B;AAC7F,EAAA,OAAO,IAAI,gBAAgB,QAAA,EAAU;AAAA,IACnC,QAAA,CAAS,KAAK,EAAA,CAAG,EAAE,cAAc,sBAAA,CAAuB,OAAA,EAAS,OAAO,CAAA,EAAG;AAAA,GAC5E,CAAA;AACH;AAGO,SAAS,MAAA,CAAO,OAAA,GAA6B,EAAC,EAAoB;AACvE,EAAA,OAAO,OAAA,CAAQ,cAAA,EAAgB,OAAA,EAAS,QAAQ,CAAA;AAClD;AAGO,SAAS,IAAA,CAAK,OAAA,GAA6B,EAAC,EAAoB;AACrE,EAAA,OAAO,OAAA,CAAQ,YAAA,EAAc,OAAA,EAAS,MAAM,CAAA;AAC9C;AASO,SAAS,QAAA,GAA4B;AAC1C,EAAA,OAAO,IAAI,gBAAgB,gBAAgB,CAAA;AAC7C;AAGO,SAAS,MAAA,GAA0B;AACxC,EAAA,OAAO,IAAI,gBAAgB,cAAc,CAAA;AAC3C;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kurrawongai/codemirror-lang-turtle12",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "RDF 1.2 Turtle, TriG, N-Triples and N-Quads language support for CodeMirror 6",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "dist/index.cjs",
|
|
11
|
+
"module": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"NOTICE"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"codemirror",
|
|
29
|
+
"lezer",
|
|
30
|
+
"turtle",
|
|
31
|
+
"trig",
|
|
32
|
+
"rdf",
|
|
33
|
+
"n-triples",
|
|
34
|
+
"n-quads",
|
|
35
|
+
"rdf12"
|
|
36
|
+
],
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/Kurrawong/codemirror-lang-rdf.git",
|
|
40
|
+
"directory": "packages/lang-turtle12"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@codemirror/autocomplete": "^6.18.0",
|
|
44
|
+
"@codemirror/language": "^6.10.0",
|
|
45
|
+
"@codemirror/state": "^6.4.0",
|
|
46
|
+
"@lezer/common": "^1.2.0",
|
|
47
|
+
"@lezer/highlight": "^1.2.0",
|
|
48
|
+
"@lezer/lr": "^1.4.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@lezer/generator": "^1.7.1",
|
|
52
|
+
"esbuild": "^0.28.2",
|
|
53
|
+
"rollup": "^4.28.1",
|
|
54
|
+
"typescript": "^7.0.2"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "rollup -c && tsc -p tsconfig.build.json --emitDeclarationOnly"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/complete.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { syntaxTree } from '@codemirror/language';
|
|
2
|
+
import type { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
3
|
+
import type { EditorState } from '@codemirror/state';
|
|
4
|
+
|
|
5
|
+
/** A prefix label (without the colon) mapped to the IRI it expands to. */
|
|
6
|
+
export type PrefixMap = Record<string, string>;
|
|
7
|
+
|
|
8
|
+
/** Where `turtle()` and friends may look for prefixes beyond the document. */
|
|
9
|
+
export type PrefixSource = PrefixMap | ((state: EditorState) => PrefixMap);
|
|
10
|
+
|
|
11
|
+
export interface CompletionOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Prefixes the editor should offer even when the document has not declared
|
|
14
|
+
* them — an application's own prefix manager, typically. Document
|
|
15
|
+
* declarations win on conflict, because what the document says is what the
|
|
16
|
+
* document means.
|
|
17
|
+
*/
|
|
18
|
+
prefixSource?: PrefixSource;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const DIRECTIVES = ['@prefix', '@base', 'PREFIX', 'BASE'];
|
|
22
|
+
const TRIG_DIRECTIVES = [...DIRECTIVES, 'GRAPH'];
|
|
23
|
+
const TERM_KEYWORDS = ['a', 'true', 'false'];
|
|
24
|
+
|
|
25
|
+
/** Nodes whose interior is text, not syntax: no completion belongs there. */
|
|
26
|
+
const INERT = new Set(['Comment', 'String', 'VersionSpecifier', 'IRIRef']);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The prefixes declared by the document itself, read from the syntax tree.
|
|
30
|
+
*
|
|
31
|
+
* Both spellings are read — `@prefix ex: <…>` and `PREFIX ex: <…>` — because a
|
|
32
|
+
* document may mix them, and a reader completing `ex:` does not care which one
|
|
33
|
+
* declared it.
|
|
34
|
+
*/
|
|
35
|
+
export function documentPrefixes(state: EditorState): PrefixMap {
|
|
36
|
+
const prefixes: PrefixMap = {};
|
|
37
|
+
const tree = syntaxTree(state);
|
|
38
|
+
tree.iterate({
|
|
39
|
+
enter: (node) => {
|
|
40
|
+
if (node.name !== 'PrefixID' && node.name !== 'SparqlPrefix') return;
|
|
41
|
+
let label: string | null = null;
|
|
42
|
+
let iri: string | null = null;
|
|
43
|
+
for (let child = node.node.firstChild; child; child = child.nextSibling) {
|
|
44
|
+
if (child.name === 'PNameNS' && label === null) {
|
|
45
|
+
label = state.sliceDoc(child.from, child.to).slice(0, -1);
|
|
46
|
+
} else if (child.name === 'IRIRef' && iri === null) {
|
|
47
|
+
iri = state.sliceDoc(child.from + 1, child.to - 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (label !== null) prefixes[label] = iri ?? '';
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
return prefixes;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function resolveSource(source: PrefixSource | undefined, state: EditorState): PrefixMap {
|
|
57
|
+
if (!source) return {};
|
|
58
|
+
return typeof source === 'function' ? source(state) : source;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Every prefix the editor knows about: the external source, overlaid by the document's. */
|
|
62
|
+
export function knownPrefixes(state: EditorState, options: CompletionOptions = {}): PrefixMap {
|
|
63
|
+
return { ...resolveSource(options.prefixSource, state), ...documentPrefixes(state) };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function prefixCompletions(state: EditorState, options: CompletionOptions): Completion[] {
|
|
67
|
+
const prefixes = knownPrefixes(state, options);
|
|
68
|
+
return Object.entries(prefixes).map(([label, iri]) => ({
|
|
69
|
+
label: `${label}:`,
|
|
70
|
+
type: 'namespace',
|
|
71
|
+
detail: iri || undefined,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function keywordCompletions(words: readonly string[]): Completion[] {
|
|
76
|
+
return words.map((label) => ({ label, type: 'keyword' }));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Is the cursor inside a literal or IRI that has not been closed yet?
|
|
81
|
+
*
|
|
82
|
+
* A half-typed `"some tex` or `<http://ex` never reaches a `String` or
|
|
83
|
+
* `IRIRef` node — it is error debris, and the error node covers only the last
|
|
84
|
+
* word — so the node name cannot answer this. Scanning the line up to the
|
|
85
|
+
* cursor can, and it is the state a reader is in while typing one.
|
|
86
|
+
*
|
|
87
|
+
* Two details earn their place. `<<` is not an IRI, so it does not open one,
|
|
88
|
+
* which keeps completion alive inside a half-typed reified triple. And an IRI
|
|
89
|
+
* cannot contain a space, so whitespace closes the scan rather than
|
|
90
|
+
* suppressing completion for the rest of the line.
|
|
91
|
+
*
|
|
92
|
+
* The scan is line-local, so an unterminated *long* string (`"""…`) spanning
|
|
93
|
+
* lines is not detected past its first line. Terminated ones are, through the
|
|
94
|
+
* `String` node above.
|
|
95
|
+
*/
|
|
96
|
+
function inUnterminatedTerm(state: EditorState, pos: number): boolean {
|
|
97
|
+
const line = state.doc.lineAt(pos);
|
|
98
|
+
const text = line.text.slice(0, pos - line.from);
|
|
99
|
+
let quote: string | null = null;
|
|
100
|
+
let angle = false;
|
|
101
|
+
for (let i = 0; i < text.length; i++) {
|
|
102
|
+
const ch = text[i];
|
|
103
|
+
if (quote) {
|
|
104
|
+
if (ch === '\\') i++;
|
|
105
|
+
else if (ch === quote) quote = null;
|
|
106
|
+
} else if (angle) {
|
|
107
|
+
if (ch === '>' || ch === ' ' || ch === '\t') angle = false;
|
|
108
|
+
} else if (ch === '"' || ch === "'") {
|
|
109
|
+
quote = ch;
|
|
110
|
+
} else if (ch === '<' && text[i + 1] !== '<') {
|
|
111
|
+
angle = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return quote !== null || angle;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Completion for Turtle-family documents.
|
|
119
|
+
*
|
|
120
|
+
* Deliberately context-light: it offers directives, the three term keywords and
|
|
121
|
+
* the document's prefixes wherever a word is being typed, rather than trying to
|
|
122
|
+
* work out whether the cursor is in a subject or an object position. In an
|
|
123
|
+
* error-tolerant tree a half-typed statement usually has no reliable position
|
|
124
|
+
* to read, and a wrong context is worse than a slightly long list.
|
|
125
|
+
*/
|
|
126
|
+
export function turtleCompletionSource(
|
|
127
|
+
options: CompletionOptions = {},
|
|
128
|
+
dialect: 'turtle' | 'trig' = 'turtle'
|
|
129
|
+
) {
|
|
130
|
+
return (context: CompletionContext): CompletionResult | null => {
|
|
131
|
+
const word = context.matchBefore(/[@A-Za-z_][\w.-]*:?/);
|
|
132
|
+
if (!word && !context.explicit) return null;
|
|
133
|
+
const from = word ? word.from : context.pos;
|
|
134
|
+
|
|
135
|
+
const node = syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
136
|
+
if (INERT.has(node.name)) return null;
|
|
137
|
+
if (inUnterminatedTerm(context.state, context.pos)) return null;
|
|
138
|
+
|
|
139
|
+
const directives = dialect === 'trig' ? TRIG_DIRECTIVES : DIRECTIVES;
|
|
140
|
+
return {
|
|
141
|
+
from,
|
|
142
|
+
options: [
|
|
143
|
+
...keywordCompletions(directives),
|
|
144
|
+
...keywordCompletions(TERM_KEYWORDS),
|
|
145
|
+
...prefixCompletions(context.state, options),
|
|
146
|
+
],
|
|
147
|
+
validFor: /^[@A-Za-z_][\w.-]*:?$/,
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
package/src/grammar.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rollup build turns `*.grammar` into a module exporting the compiled
|
|
3
|
+
* parser (and `*.grammar.terms` into its term ids). TypeScript needs to be told
|
|
4
|
+
* that, since it never sees the plugin.
|
|
5
|
+
*/
|
|
6
|
+
declare module '*.grammar' {
|
|
7
|
+
import type { LRParser } from '@lezer/lr';
|
|
8
|
+
export const parser: LRParser;
|
|
9
|
+
}
|
|
10
|
+
declare module '*.grammar.terms' {
|
|
11
|
+
const terms: Record<string, number>;
|
|
12
|
+
export = terms;
|
|
13
|
+
}
|
package/src/highlight.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { NodePropSource } from '@lezer/common';
|
|
2
|
+
import { styleTags, tags as t } from '@lezer/highlight';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The shared highlight-tag table, Turtle half.
|
|
6
|
+
*
|
|
7
|
+
* `docs/highlight-tags.md` is the canonical table and `test/highlight.test.ts`
|
|
8
|
+
* asserts this against it, so a consumer can keep one `HighlightStyle` for all
|
|
9
|
+
* three languages. Two conventions are worth knowing:
|
|
10
|
+
*
|
|
11
|
+
* - an IRI and a prefixed name are tagged differently (`url` / `namespace`)
|
|
12
|
+
* but denote the same kind of thing, so a style is free to colour them the
|
|
13
|
+
* same — which is what the reference style does;
|
|
14
|
+
* - a datatype IRI is tagged `typeName` rather than `url`, because it
|
|
15
|
+
* qualifies the literal rather than being a term the document is about. The
|
|
16
|
+
* parent-path rules below are more specific than the bare token rules, so
|
|
17
|
+
* they win inside `Datatype`.
|
|
18
|
+
*/
|
|
19
|
+
export const turtleHighlighting: NodePropSource = styleTags({
|
|
20
|
+
Comment: t.comment,
|
|
21
|
+
|
|
22
|
+
'AtPrefix AtBase AtVersion KwPrefix KwBase KwGraph KwVersion KeywordA': t.keyword,
|
|
23
|
+
|
|
24
|
+
IRIRef: t.url,
|
|
25
|
+
'PNameNS PNameLN': t.namespace,
|
|
26
|
+
|
|
27
|
+
'BlankNodeLabel Anon': t.propertyName,
|
|
28
|
+
|
|
29
|
+
'String VersionSpecifier': t.string,
|
|
30
|
+
'Integer Decimal Double': t.number,
|
|
31
|
+
'True False': t.bool,
|
|
32
|
+
|
|
33
|
+
LangDir: t.annotation,
|
|
34
|
+
'Datatype/IRIRef Datatype/PrefixedName/PNameNS Datatype/PrefixedName/PNameLN': t.typeName,
|
|
35
|
+
'Datatype/"^^"': t.typeName,
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* The RDF 1.2 term brackets are tagged apart from ordinary grouping, because
|
|
39
|
+
* `<< s p o >>` and `<<( s p o )>>` differ by one character and mean quite
|
|
40
|
+
* different things — a statement you can refer to, versus an object that *is*
|
|
41
|
+
* a triple. A style that cannot separate them cannot help a reader see that.
|
|
42
|
+
*
|
|
43
|
+
* Each is a `special()` of the standard tag its glyphs actually are, so the
|
|
44
|
+
* fallback chain does the work: a theme that knows nothing about RDF 1.2 and
|
|
45
|
+
* styles `bracket` (or `brace`/`paren`/`angleBracket`) still colours all of
|
|
46
|
+
* them, and one that wants the distinction overrides the specific tag.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Every token *inside* an RDF 1.2 nested-triple construct also carries
|
|
51
|
+
* `quote`, so a style can shade the whole thing and not just its brackets —
|
|
52
|
+
* which is what "colour reified triples differently" usually means. The
|
|
53
|
+
* `/...` form applies to descendants and *combines* with each token's own
|
|
54
|
+
* tag, so an IRI inside a reified triple is `quote url`, not one or the
|
|
55
|
+
* other. A style that never mentions `quote` sees no change at all.
|
|
56
|
+
*
|
|
57
|
+
* One tag for all three constructs, rather than three: the brackets above
|
|
58
|
+
* already say which kind it is, and a style wanting per-kind regions can add
|
|
59
|
+
* its own props to the exported parser.
|
|
60
|
+
*/
|
|
61
|
+
'ReifiedTriple/... TripleTerm/... NTripleTerm/... AnnotationBlock/...': t.quote,
|
|
62
|
+
|
|
63
|
+
'"<<" ">>"': t.special(t.angleBracket),
|
|
64
|
+
'"<<(" ")>>"': t.special(t.paren),
|
|
65
|
+
'"{|" "|}"': t.special(t.brace),
|
|
66
|
+
'"{" "}"': t.brace,
|
|
67
|
+
'"[" "]"': t.squareBracket,
|
|
68
|
+
'"(" ")"': t.paren,
|
|
69
|
+
|
|
70
|
+
// The reifier marker only ever introduces a reifier, so it is worth telling
|
|
71
|
+
// from arithmetic; it falls back to `operator`.
|
|
72
|
+
'"~"': t.special(t.operator),
|
|
73
|
+
|
|
74
|
+
'";" ","': t.separator,
|
|
75
|
+
'"."': t.punctuation,
|
|
76
|
+
});
|