@op-ted/efx-syntax-highlighter 0.3.0 → 0.4.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.
Files changed (40) hide show
  1. package/README.md +15 -10
  2. package/dist/efx1/efx1Highlighting.js +45 -0
  3. package/dist/efx1/generated/lexer.js +1772 -0
  4. package/dist/efx1/lexer.js +26 -0
  5. package/dist/efx1/parser.js +23 -0
  6. package/dist/efx1/parser.terms.js +118 -0
  7. package/dist/{completion → efx2/completion}/CompletionItems.js +1 -1
  8. package/dist/{completion → efx2/completion}/EfxCompletions.js +2 -2
  9. package/dist/{completion → efx2/completion}/ExpectedTokens.js +14 -14
  10. package/dist/{efxHighlighting.js → efx2/efx2Highlighting.js} +5 -5
  11. package/dist/{generated → efx2/generated}/completions.js +1 -1
  12. package/dist/efx2/generated/lexer.js +3880 -0
  13. package/dist/efx2/generated/words.js +213 -0
  14. package/dist/efx2/lexer.js +49 -0
  15. package/dist/efx2/parser.js +23 -0
  16. package/dist/efx2/parser.terms.js +318 -0
  17. package/dist/efxLanguage.js +66 -17
  18. package/dist/lexer/AntlrLexer.js +427 -0
  19. package/dist/lexer/EditorLexer.js +134 -0
  20. package/dist/lexer/EditorParser.js +69 -0
  21. package/dist/lexer/Lexing.js +238 -0
  22. package/dist/lexer/ParseRanges.js +22 -0
  23. package/package.json +5 -4
  24. package/dist/efx-parser.js +0 -26
  25. package/dist/efx-parser.terms.js +0 -319
  26. package/dist/generated/words.js +0 -215
  27. package/dist/lexer/ExpressionMode.js +0 -44
  28. package/dist/lexer/FormatMode.js +0 -31
  29. package/dist/lexer/IdentifierMode.js +0 -12
  30. package/dist/lexer/LabelMode.js +0 -27
  31. package/dist/lexer/LexerContext.js +0 -76
  32. package/dist/lexer/LexerInput.js +0 -188
  33. package/dist/lexer/LexerMode.js +0 -24
  34. package/dist/lexer/LexerModes.js +0 -50
  35. package/dist/lexer/LineMode.js +0 -85
  36. package/dist/lexer/ReservedWords.js +0 -75
  37. package/dist/lexer/StageHeaderMode.js +0 -12
  38. package/dist/lexer/TemplateMode.js +0 -77
  39. package/dist/lexer/TemplateStartMode.js +0 -25
  40. /package/dist/{completion → efx2/completion}/Variables.js +0 -0
@@ -0,0 +1,26 @@
1
+ // The EFX-1 lexer: ANTLR's lexer of EfxLexer.g4 of the SDK 1, run from its table
2
+ // (generated/lexer.js) as the tokenizer and the context of grammar/efx1.grammar
3
+ // (src/lexer/EditorLexer.js).
4
+
5
+ import { editorLexer } from '../lexer/EditorLexer.js';
6
+ import { lexerTable } from './generated/lexer.js';
7
+ import * as terms from './parser.terms.js';
8
+
9
+ // The grammar's skip token for each rule the lexer skips or hides.
10
+ const SKIP_TOKENS = { Comment: 'Comment', EmptyLine: 'space', SWS: 'space', EndOfLineComment: 'Comment', WS: 'space' };
11
+
12
+ /**
13
+ * The token types the grammar takes in no rule: words Efx.g4 never uses, a time zone on its own, and
14
+ * the types of rules that never make a token, since a rule before them always matches the same text.
15
+ */
16
+ export const UNUSED_TYPES = ['ValueKeyword', 'Codelist', 'Self', 'Parent', 'ZONE', 'Colon', 'IdentifierPart',
17
+ 'Preceding', 'Following', 'PrecedingSibling', 'FollowingSibling', 'Ancestor', 'AncestorOrSelf', 'Descendant',
18
+ 'DescendantOrSelf', 'Child', ...['BT', 'FIELD', 'NODE', 'DISPLAY_GROUP', 'VIEW_TEMPLATE', 'NOTICE', 'CODE_LIST',
19
+ 'CODE', 'INDICATOR', 'AUXILIARY', 'RULE', 'EXPRESSION', 'INTERVAL', 'PATTERN'].map((name) => `ASSET_TYPE_${name}`),
20
+ ...['NAME', 'WHEN_TRUE', 'WHEN_FALSE', 'DESCRIPTION', 'TOOLTIP', 'TEXT', 'TEMPLATE'].map((name) => `LABEL_TYPE_${name}`)];
21
+
22
+ export const { lexerModes } = editorLexer(lexerTable, terms, {
23
+ skipTokens: SKIP_TOKENS,
24
+ unusedTypes: UNUSED_TYPES,
25
+ bare: { dialect: 'bare', mode: 'EXPRESSION' },
26
+ });
@@ -0,0 +1,23 @@
1
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
2
+ import {LRParser} from "@lezer/lr"
3
+ import {lexerModes} from "./lexer.js"
4
+ import {efx1Highlighting} from "./efx1Highlighting.js"
5
+ export const parser = LRParser.deserialize({
6
+ version: 14,
7
+ states: ";SQYQQOOOkQQOOOpQQOOO%_QQO'#EeO(|QQO'#EdOfQQO'#EdO)bQQO'#EdOOQQ'#FZ'#FZQYQQOOO)jQQOOO%_QQO'#EfQ)rQQOOOpQQO'#EjOOQQ'#Fd'#FdOpQQO'#EkO%_QQO'#EvO*sQQO'#EwO*sQQO'#EzOOQQ'#Fe'#FeO+_QQO'#E{O+dQQO'#E}O+iQQO'#E|O+nQQO'#FOOOQQ'#FP'#FPOOQQ'#Fc'#FcO,tQQO,5;PO%_QQO'#FSOOQQ'#FS'#FSO,{QQO'#FROOQQ'#FR'#FROOQQ'#F^'#F^O-^QQO'#FQO-eQQO,5;OO(|QQO,5;OOfQQO,5;OOOQQ-E9X-E9XO-jQQOOO-rQQO,5;QO%_QQO,5;ROpQQO,5;SO-|QQO,5;TOpQQO,5;WOpQQO,5;XOpQQO,5;YOpQQO,5;ZO.RQQO,5;ZO.ZQQO,5;[O.`QQO,5;]OpQQO,5;`OpQQO,5;aO/lQRO,5;UO0tQRO,5;VO1OQQO,5;bO1VQQO'#EyO1[QQO'#ExO1gQQO,5;cO1lQQO,5;fO1qQQO,5;gO%_QQO,5;iOpQQO,5;hO1xQQO,5;jOOQQ1G0k1G0kO1}QQO,5;UO2nQQO,5;VO3_QQO,5;nO3fQQO'#FfO3kQQO'#FfO3pQQO'#FfOOQQ'#Ff'#FfO3xQQO,5;mOOQQ-E9[-E9[OOQQ1G0j1G0jO3}QQO1G0jO(|QQO1G0jO4SQQOOO*sQQOOO%_QQO'#F[O4_QQO1G0lOOQQ1G0l1G0lO4gQQO1G0mOOQQ1G0n1G0nOOQQ1G0o1G0oO5lQRO1G0rO6kQRO1G0sO7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%^%_r^Q[^wyz{|!Q!R!]!x#V#W#z$`$bY!V`a#T%X%YS#n!m$^!]$qRY_jv!Z![!n#R#l#|$p$q$r$s$t$u$v$w$x$y$z${$|$}%O%P%]%_#PcQRY[^_jvwyz{|!Q!R!Z![!]!n!x#R#V#W#l#z#|$`$b$p$q$r$s$t$u$v$w$x$y$z${$|$}%O%P%]%_R!gl",
10
+ nodeNames: "⚠ Comment MixedIndent Tabs Spaces OutlineNumber CRLF FreeText ShorthandFieldValueReferenceFromContextField ShorthandIndirectLabelReferenceFromContextField StartExpression StartLabel StartSelector Whitespace Pipe EndLabel AssetType LabelType OtherAssetId OpenParenthesis CloseParenthesis OpenBracket CloseBracket ColonColon EndExpression And Or Is In Like Present Empty Unique Every Some Satisfies If Then Else For Return Always Never True False Notice BooleanTypeCast NumericTypeCast TextTypeCast CodeTypeCast DateTypeCast TimeTypeCast DurationTypeCast ContextTypeCast Axis Not CountFunction SubstringFunction StringFunction NumberFunction ContainsFunction StartsWithFunction EndsWithFunction StringLengthFunction SumFunction FormatNumberFunction ConcatFunction DateFunction TimeFunction DayTimeDurationFunction YearMonthDurationFunction AddMeasure SubtractMeasure DistinctValuesFunction UnionFunction IntersectFunction ExceptFunction SequenceEqualFunction BtId FieldId NodeId Variable DayTimeDurationLiteral YearMonthDurationLiteral Identifier INTEGER DECIMAL STRING UUIDV4 DATE TIME Comparison Star Slash Percent Plus Minus Comma SlashAt TemplateFile TemplateLine ContextDeclarationBlock ParenthesizedExpression PredicateExpression ContextOverrideExpression AttributeReference AbsoluteReference CastExpression MultiplicativeExpression AdditiveExpression ComparisonExpression InListCondition LikePatternCondition EmptinessCondition PresenceCondition UniqueValueCondition LogicalAndCondition LogicalOrCondition ConditionalExpression QuantifiedExpression IteratorList Iterator IterationExpression FunctionCall ReferenceInOtherNotice NoticeReference AxisReference Literal Template LabelBlock ExpressionBlock AssetId SingleExpression ParameterList ParameterDeclaration SelectorBlock BareExpression",
11
+ maxTerm: 148,
12
+ nodeProps: [
13
+ ["group", -27,79,80,81,84,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,122,123,124,126,127,"Expression"]
14
+ ],
15
+ propSources: [efx1Highlighting],
16
+ skippedNodes: [0,1],
17
+ repeatNodeCount: 5,
18
+ tokenData: "RORO",
19
+ tokenizers: [0, lexerModes],
20
+ topRules: {"TemplateFile":[0,99],"SingleExpression":[1,132],"BareExpression":[2,136]},
21
+ dialects: {bare: 0},
22
+ tokenPrec: 0
23
+ })
@@ -0,0 +1,118 @@
1
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
2
+ export const
3
+ space = 143,
4
+ Comment = 1,
5
+ MixedIndent = 2,
6
+ Tabs = 3,
7
+ Spaces = 4,
8
+ OutlineNumber = 5,
9
+ CRLF = 6,
10
+ FreeText = 7,
11
+ ShorthandFieldValueReferenceFromContextField = 8,
12
+ ShorthandIndirectLabelReferenceFromContextField = 9,
13
+ StartExpression = 10,
14
+ StartLabel = 11,
15
+ StartSelector = 12,
16
+ Whitespace = 13,
17
+ Pipe = 14,
18
+ EndLabel = 15,
19
+ AssetType = 16,
20
+ LabelType = 17,
21
+ OtherAssetId = 18,
22
+ OpenParenthesis = 19,
23
+ CloseParenthesis = 20,
24
+ OpenBracket = 21,
25
+ CloseBracket = 22,
26
+ ColonColon = 23,
27
+ EndExpression = 24,
28
+ And = 25,
29
+ Or = 26,
30
+ Is = 27,
31
+ In = 28,
32
+ Like = 29,
33
+ Present = 30,
34
+ Empty = 31,
35
+ Unique = 32,
36
+ Every = 33,
37
+ Some = 34,
38
+ Satisfies = 35,
39
+ If = 36,
40
+ Then = 37,
41
+ Else = 38,
42
+ For = 39,
43
+ Return = 40,
44
+ Always = 41,
45
+ Never = 42,
46
+ True = 43,
47
+ False = 44,
48
+ Notice = 45,
49
+ BooleanTypeCast = 46,
50
+ NumericTypeCast = 47,
51
+ TextTypeCast = 48,
52
+ CodeTypeCast = 49,
53
+ DateTypeCast = 50,
54
+ TimeTypeCast = 51,
55
+ DurationTypeCast = 52,
56
+ ContextTypeCast = 53,
57
+ Axis = 54,
58
+ Not = 55,
59
+ CountFunction = 56,
60
+ SubstringFunction = 57,
61
+ StringFunction = 58,
62
+ NumberFunction = 59,
63
+ ContainsFunction = 60,
64
+ StartsWithFunction = 61,
65
+ EndsWithFunction = 62,
66
+ StringLengthFunction = 63,
67
+ SumFunction = 64,
68
+ FormatNumberFunction = 65,
69
+ ConcatFunction = 66,
70
+ DateFunction = 67,
71
+ TimeFunction = 68,
72
+ DayTimeDurationFunction = 69,
73
+ YearMonthDurationFunction = 70,
74
+ AddMeasure = 71,
75
+ SubtractMeasure = 72,
76
+ DistinctValuesFunction = 73,
77
+ UnionFunction = 74,
78
+ IntersectFunction = 75,
79
+ ExceptFunction = 76,
80
+ SequenceEqualFunction = 77,
81
+ BtId = 78,
82
+ FieldId = 79,
83
+ NodeId = 80,
84
+ Variable = 81,
85
+ DayTimeDurationLiteral = 82,
86
+ YearMonthDurationLiteral = 83,
87
+ Identifier = 84,
88
+ INTEGER = 85,
89
+ DECIMAL = 86,
90
+ STRING = 87,
91
+ UUIDV4 = 88,
92
+ DATE = 89,
93
+ TIME = 90,
94
+ Comparison = 91,
95
+ Star = 92,
96
+ Slash = 93,
97
+ Percent = 94,
98
+ Plus = 95,
99
+ Minus = 96,
100
+ Comma = 97,
101
+ SlashAt = 98,
102
+ TemplateFile = 99,
103
+ TemplateLine = 100,
104
+ ContextDeclarationBlock = 101,
105
+ IteratorList = 120,
106
+ Iterator = 121,
107
+ NoticeReference = 125,
108
+ Literal = 127,
109
+ Template = 128,
110
+ LabelBlock = 129,
111
+ ExpressionBlock = 130,
112
+ AssetId = 131,
113
+ SingleExpression = 132,
114
+ ParameterList = 133,
115
+ ParameterDeclaration = 134,
116
+ SelectorBlock = 135,
117
+ BareExpression = 136,
118
+ Dialect_bare = 0
@@ -1,4 +1,4 @@
1
- // The toolkit's completion list (src/generated/completions.js) by word: the option for a word the
1
+ // The toolkit's completion list (src/efx2/generated/completions.js) by word: the option for a word the
2
2
  // editor offers. A function is offered as a call where an expression can start, which is where the
3
3
  // parser can take `(`: its word, then the required parameters of its first signature as fields to
4
4
  // fill in, with all its signatures as information. Elsewhere its word is offered bare, as `not` and
@@ -8,8 +8,8 @@
8
8
  // offered only when asked for, not while typing.
9
9
 
10
10
  import { syntaxTree } from '@codemirror/language';
11
- import * as terms from '../efx-parser.terms.js';
12
- import { efxSymbols } from '../efxSymbols.js';
11
+ import * as terms from '../parser.terms.js';
12
+ import { efxSymbols } from '../../efxSymbols.js';
13
13
  import { completionItems } from '../generated/completions.js';
14
14
  import { CompletionItems } from './CompletionItems.js';
15
15
  import { ExpectedTokens } from './ExpectedTokens.js';
@@ -1,19 +1,18 @@
1
1
  // What the parser can take at a position of an editor's text: the tokens it is asked about and the
2
2
  // words the lexer reads there as tokens it can take. The text before the position is parsed as the
3
- // editor parses it, reusing the editor's tree, with the tokenizer of the lexer's modes wrapped:
4
- // where a parse stack stands at the position, the wrapper asks it which tokens it can take
5
- // (Stack.canShift) and finds the lexer's mode there, as the tokenizer does. The parse is strict, so
6
- // every stack asked is one of the parser's own readings of the text and never one of its recoveries
7
- // from an error: after an error the parser takes nothing.
8
- //
9
- // The parser calls the wrapper only where it can take a token of the lexer's modes or a skip token.
10
- // In a label block, where nothing is skipped, it can stand where it takes only the grammar's own
11
- // tokens: after the label type of `#{name|`, where it takes a field id, it takes nothing asked.
3
+ // editor parses it, reusing the editor's tree, with the tokenizer wrapped: where a parse stack
4
+ // stands at the position, the wrapper asks it which tokens it can take (Stack.canShift) and which
5
+ // mode the lexer is in there (the top of the stack of modes the parser keeps), whose words
6
+ // (generated/words.js) are those the lexer reads there. The parse is strict, so every stack asked is
7
+ // one of the parser's own readings of the text and never one of its recoveries from an error: after
8
+ // an error the parser takes nothing.
12
9
 
13
10
  import { syntaxTree } from '@codemirror/language';
14
11
  import { TreeFragment } from '@lezer/common';
15
12
  import { ExternalTokenizer } from '@lezer/lr';
16
- import { lexerModeAt, lexerModes, readToken } from '../lexer/LexerModes.js';
13
+ import { modeWords } from '../generated/words.js';
14
+ import { lexerModes, modeAt } from '../lexer.js';
15
+ import * as terms from '../parser.terms.js';
17
16
 
18
17
  export class ExpectedTokens {
19
18
  // One for each time a parse stack at the position is tokenized: the words its lexer mode reads
@@ -24,9 +23,9 @@ export class ExpectedTokens {
24
23
  constructor(parser, state, pos, tokens) {
25
24
  const probe = new ExternalTokenizer((input, stack) => {
26
25
  if (input.pos === pos) {
27
- this.#readings.push(ExpectedTokens.#reading(stack, tokens));
26
+ this.#readings.push(ExpectedTokens.#reading(modeAt(input, stack), stack, tokens));
28
27
  }
29
- readToken(input, stack);
28
+ lexerModes.token(input, stack);
30
29
  }, { contextual: true });
31
30
  const parse = parser.configure({ strict: true, tokenizers: [{ from: lexerModes, to: probe }] })
32
31
  .startParse(state.doc.sliceString(0, pos), ExpectedTokens.#fragments(state, pos));
@@ -51,8 +50,9 @@ export class ExpectedTokens {
51
50
  return [...new Set(this.#readings.flatMap(({ words }) => words))];
52
51
  }
53
52
 
54
- static #reading(stack, tokens) {
55
- const words = lexerModeAt(stack).words().filter(([, token]) => stack.canShift(token)).map(([word]) => word);
53
+ static #reading(mode, stack, tokens) {
54
+ const words = [...modeWords.get(mode) ?? []].filter(([, type]) => terms[type] !== undefined
55
+ && stack.canShift(terms[type])).map(([word]) => word);
56
56
  return { words, tokens: new Set(tokens.filter((token) => stack.canShift(token))) };
57
57
  }
58
58
 
@@ -1,10 +1,10 @@
1
1
  // The highlight tags of the grammar: which tag each kind of node carries, read by the parser
2
- // (grammar/efx.grammar, @external propSource). The colours of the tags are in efxTheme.js.
2
+ // (grammar/efx2.grammar, @external propSource). The colours of the tags are in src/efxTheme.js.
3
3
  import { styleTags, tags as t } from "@lezer/highlight";
4
4
 
5
- // The highlight tag of each kind of node of the grammar (grammar/efx.grammar), named by the node or by
5
+ // The highlight tag of each kind of node of the grammar (grammar/efx2.grammar), named by the node or by
6
6
  // the node and its parent (Parent/Node). A node that is not listed is plain text.
7
- export const EFX_STYLES = {
7
+ export const EFX2_STYLES = {
8
8
  // The words that start a line, a part of a line or a clause of a rule, and the headers.
9
9
  "Let With EVERY When Otherwise Display Invoke Index By Compute Select": t.keyword,
10
10
  "Endpoint AT Call Api On OnErrorClause/Error": t.keyword,
@@ -72,11 +72,11 @@ export const EFX_STYLES = {
72
72
  "FreeText OtherEscapeSequence CharacterReference NewLine": t.special(t.string),
73
73
 
74
74
  "Assignment Comparison Plus Minus Star Slash Percent ColonColon": t.operator,
75
- "OpenParenthesis CloseParenthesis OpenBracket CloseBracket Pipe Colon Dot DotDot Ellipsis": t.punctuation,
75
+ "OpenParenthesis CloseParenthesis OpenBracket CloseBracket Pipe Colon Ellipsis": t.punctuation,
76
76
  "AttributeReference/Slash AttributeExpression/Slash": t.punctuation,
77
77
  "StartContextBlock StartExpressionBlock StartLabelBlock StartHyperlinkBlock StartSelectorBlock EndBlock": t.bracket,
78
78
  Comment: t.lineComment,
79
79
  Identifier: t.name,
80
80
  };
81
81
 
82
- export const efxHighlighting = styleTags(EFX_STYLES);
82
+ export const efx2Highlighting = styleTags(EFX2_STYLES);
@@ -1,4 +1,4 @@
1
- // Generated by `npm run sync` from src/main/resources/eu/europa/ted/efx/autocomplete/sdk2-completions.json at OP-TED/efx-toolkit-java@1fa3745e5fe2d04acd7fcb337702f328f432a6fb. Do not edit.
1
+ // Generated by `npm run sync` from src/main/resources/eu/europa/ted/efx/autocomplete/sdk2-completions.json at OP-TED/efx-toolkit-java@2b1178aa95b35b988995a8543d0d1e0f69c3b53d. Do not edit.
2
2
 
3
3
  // The toolkit's completion items: the built-in functions with their parameters, the keywords and the properties.
4
4
  export const completionItems = [