Skip to content

Commit 7162753

Browse files
committed
Extract hyperlink field
1 parent c70a0fb commit 7162753

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

corpus/hyperlink.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ Adios}
2424
(staticNumberLiteral)
2525
(staticNumberLiteral)))
2626
(parTbl)
27+
(hyperlink)
2728
(textUnit
2829
(fontIndex)
2930
(fontSize)
3031
(colorFontIndex)
3132
(textUnitContent))
33+
(endHyperlink)
3234
(textUnit
3335
(fontIndex)
3436
(fontSize)
@@ -72,11 +74,13 @@ Text with hpyerlink - https://www.google.com/
7274
(textUnitContent))
7375
(textUnit
7476
(textUnitContent))
77+
(hyperlink)
7578
(textUnit
7679
(fontIndex)
7780
(fontSize)
7881
(colorFontIndex)
79-
(textUnitContent)))
82+
(textUnitContent))
83+
(endHyperlink))
8084

8185

8286
=============================
@@ -115,8 +119,10 @@ Text with hpyerlink - No extra style
115119
(textUnitContent))
116120
(textUnit
117121
(textUnitContent))
122+
(hyperlink)
118123
(textUnit
119-
(textUnitContent)))
124+
(textUnitContent))
125+
(endHyperlink))
120126

121127

122128
=============================
@@ -155,9 +161,11 @@ test.\
155161
(fontSize)
156162
(colorFontIndex)
157163
(textUnitContent))
164+
(hyperlink)
158165
(textUnit
159166
(fontSize)
160167
(textUnitContent))
168+
(endHyperlink)
161169
(textUnit
162170
(textUnitContent))
163171
(textUnit
@@ -201,7 +209,9 @@ Text with hpyerlink - No extra style and HTTP://GOGOLE.COM
201209
(textUnitContent))
202210
(textUnit
203211
(textUnitContent))
212+
(hyperlink)
204213
(textUnit
205214
(textUnitContent))
215+
(endHyperlink)
206216
(textUnit
207217
(textUnitContent)))

grammar.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ module.exports = grammar({
295295

296296
_fieldinst: ($) => seq("{\\*", "\\fldinst", $._hyperlinkUnit, "}"),
297297

298-
_fieldslt: ($) => seq("{\\fldrslt", " ", $.textUnit, "}"),
298+
_fieldslt: ($) => seq("{\\fldrslt", " ", $.textUnit, $.endHyperlink),
299299

300-
_hyperlinkUnit: ($) => seq('{HYPERLINK "', $._static_URL_literal, '"}'),
300+
endHyperlink: () => "}",
301+
302+
_hyperlinkUnit: ($) => seq('{HYPERLINK "', $.hyperlink, '"}'),
301303

302304
_textUnitParameters: ($) =>
303305
seq(repeat1(seq(repeat1($._textUnit_config), " "))),
@@ -311,6 +313,8 @@ module.exports = grammar({
311313
_textUnitInformation: ($) =>
312314
seq($._textUnitVisibleInformation, optional("\n")),
313315

316+
hyperlink: ($) => $._static_URL_literal,
317+
314318
textUnit: ($) =>
315319
seq(optional($._textUnitParameters), $._textUnitInformation),
316320

0 commit comments

Comments
 (0)