@malloydata/syntax-highlight 0.0.410 → 0.0.412

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.
@@ -13,7 +13,6 @@ export const monarch: Monaco.IMonarchLanguage = {
13
13
  tokenizer: {
14
14
  root: [{include: '@malloy_language'}],
15
15
  malloy_language: [
16
- {include: '@sql_string'},
17
16
  {include: '@comments'},
18
17
  {include: '@strings'},
19
18
  {include: '@given'},
@@ -29,80 +28,6 @@ export const monarch: Monaco.IMonarchLanguage = {
29
28
  {include: '@timeframes'},
30
29
  {include: '@identifiers_unquoted'},
31
30
  ],
32
- sql_string: [
33
- [
34
- /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(""")/,
35
- [
36
- 'variable.other.malloy',
37
- '',
38
- 'keyword.control.sql.malloy',
39
- '',
40
- {
41
- next: '@sql_end_0',
42
- nextEmbedded: 'sql',
43
- token: 'punctuation.definition.string.begin.sql.malloy',
44
- },
45
- ],
46
- ],
47
- [
48
- /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(")/,
49
- [
50
- 'variable.other.malloy',
51
- '',
52
- 'keyword.control.sql.malloy',
53
- '',
54
- {
55
- next: '@sql_end_1',
56
- nextEmbedded: 'sql',
57
- token: 'punctuation.definition.string.begin.sql.malloy',
58
- },
59
- ],
60
- ],
61
- [
62
- /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(')/,
63
- [
64
- 'variable.other.malloy',
65
- '',
66
- 'keyword.control.sql.malloy',
67
- '',
68
- {
69
- next: '@sql_end_2',
70
- nextEmbedded: 'sql',
71
- token: 'punctuation.definition.string.begin.sql.malloy',
72
- },
73
- ],
74
- ],
75
- ],
76
- sql_end_0: [
77
- [
78
- /"""/,
79
- {
80
- next: '@pop',
81
- nextEmbedded: '@pop',
82
- token: 'punctuation.definition.string.end.sql.malloy',
83
- },
84
- ],
85
- ],
86
- sql_end_1: [
87
- [
88
- /"/,
89
- {
90
- next: '@pop',
91
- nextEmbedded: '@pop',
92
- token: 'punctuation.definition.string.end.sql.malloy',
93
- },
94
- ],
95
- ],
96
- sql_end_2: [
97
- [
98
- /'/,
99
- {
100
- next: '@pop',
101
- nextEmbedded: '@pop',
102
- token: 'punctuation.definition.string.end.sql.malloy',
103
- },
104
- ],
105
- ],
106
31
  comments: [
107
32
  [/\/\*/, {next: '@comment_block_end', token: 'comment.block'}],
108
33
  [/\/\//, {next: '@comment_line_double_slash_end', token: 'comment.line'}],
@@ -93,34 +93,42 @@
93
93
  ]
94
94
  },
95
95
  "sql-string": {
96
- "comment": "SQL-ness is the .sql() context, not the delimiter — any string argument to connection.sql(...) is SQL. ONE combined rule, not three per-quote siblings: vscode-textmate's begin scanner drops shorter begins that share a prefix with a longer one, so separate \"\"\"/\"/' rules leave only \"\"\" working. The opening quote is captured (group 5) and the end back-references it (\\5), so all three close correctly. #malloy-in-sql gives \"\"\" blocks their %{ } interpolation; it also (harmlessly) applies inside short SQL strings, where %{ } is not real interpolation but is vanishingly rare.",
96
+ "comment": "SQL-ness is the .sql() CONTEXT, not the delimiter — any string argument to connection.sql(...) is SQL (grammar: connectionId DOT SQL OPAREN (sqlString|shortString) CPAREN; connectionId is an `id`). Two NESTED rules so the string can sit on a different line from `.sql(` a single begin regex cannot span the newline. The OUTER rule opens at `connection.sql(` and closes at the matching `)`; the INNER rule matches the string argument wherever it lands. connection matches an `id`: a Unicode identifier ([\\p{Alphabetic}_]… mirrors the lexer's ID_CHAR) or a backtick-quoted name. The inner quote absorbs an optional raw `s` prefix but captures only the quote, so the \\1 end back-reference closes all of '…', \"…\", s'…', s\"…\", and \"\"\"…\"\"\". #malloy-in-sql gives blocks their %{ } interpolation (harmless inside short/raw strings, where it is vanishingly rare).",
97
97
  "patterns": [
98
98
  {
99
- "begin": "(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)((?i:sql))(\\s*\\(\\s*)(\"\"\"|\"|')",
100
- "end": "\\5",
99
+ "begin": "(`[^`]*`|[\\p{Alphabetic}_][\\p{Alphabetic}_0-9]*)(\\s*\\.\\s*)((?i:sql))(\\s*\\(\\s*)",
100
+ "end": "\\)",
101
101
  "beginCaptures": {
102
102
  "1": {
103
103
  "name": "variable.other.malloy"
104
104
  },
105
105
  "3": {
106
106
  "name": "keyword.control.sql.malloy"
107
- },
108
- "5": {
109
- "name": "punctuation.definition.string.begin.sql.malloy"
110
- }
111
- },
112
- "endCaptures": {
113
- "0": {
114
- "name": "punctuation.definition.string.end.sql.malloy"
115
107
  }
116
108
  },
117
109
  "name": "meta.embedded.block.sql.malloy",
118
110
  "patterns": [
119
111
  {
120
- "include": "#malloy-in-sql"
121
- },
122
- {
123
- "include": "source.sql"
112
+ "begin": "(?:[sS]\\s*)?(\"\"\"|\"|')",
113
+ "end": "\\1",
114
+ "beginCaptures": {
115
+ "1": {
116
+ "name": "punctuation.definition.string.begin.sql.malloy"
117
+ }
118
+ },
119
+ "endCaptures": {
120
+ "0": {
121
+ "name": "punctuation.definition.string.end.sql.malloy"
122
+ }
123
+ },
124
+ "patterns": [
125
+ {
126
+ "include": "#malloy-in-sql"
127
+ },
128
+ {
129
+ "include": "source.sql"
130
+ }
131
+ ]
124
132
  }
125
133
  ]
126
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/syntax-highlight",
3
- "version": "0.0.410",
3
+ "version": "0.0.412",
4
4
  "description": "A package to simplify the process of developing, testing, and syncnig Malloy syntax highlighting grammars",
5
5
  "repository": {
6
6
  "type": "git",