coradoc-markdown 1.0.12 → 1.0.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 232eab66f6d33edae8a3cca57f5ebd16cca11ed96c4dd9a51611b9669410595b
4
- data.tar.gz: 1b0f0051729a0e226826c66d49bed0c4227732491b0bbf6148f42df524b1e95f
3
+ metadata.gz: feafcf577e982d93fb6b35e8b86e34e4a06dafd717795b64190c4b985dfda324
4
+ data.tar.gz: 688522bf2b9e66ff90687b55454a6d42e1d0ae98e7257b120bb8ce276f011f4d
5
5
  SHA512:
6
- metadata.gz: d20d1132ed4f527557207c11736d3ad10289fecf47a480341ed3b768bee9b2e812195fcf77d377a374b9c82804044c8c2aa701688c7e08706070ef62f957545c
7
- data.tar.gz: 24547cfb89cbe67a61f0bb63cee59495d2520d61df54ed03141963f5245e2cd5b1c537b80b2903a55b9cfa36d51639fc85f170a963686a6b71faff2a95845b11
6
+ metadata.gz: c0a84b293daaa0174dadfe91f6bc4f98505e228ea9ab44f3e743ac5eb774140d3a5ddb35c1387fc21168c2427916553e97531427c8484836c04fae7c09d79e35
7
+ data.tar.gz: 64ea0f231ae44a667d0ec77a7e918b25f1b6b5d03dbdbd9200c1b5e6eba1fde81afe22966aec9b2c70471c644a032f11c3d4c9ce3d22a9bf9dfe4367e2bfb139
@@ -7,6 +7,15 @@ module Coradoc
7
7
  require_relative 'parsanol_atoms'
8
8
 
9
9
  class BlockParser < Parsanol::Parser
10
+ # The Ruby engine is the required surface for this grammar.
11
+ # The native VM's shadowed-alternative lint rejects our
12
+ # continuation patterns (zero-width lookaheads on dynamic blocks
13
+ # used as guards inside alternations). File: parsanol-ruby#93.
14
+ def parse(input, mode_or_opts = {}, **kwargs)
15
+ opts = mode_or_opts.is_a?(Hash) ? mode_or_opts.merge(kwargs) : {}
16
+ super(input, **opts, mode: opts.fetch(:mode, :ruby))
17
+ end
18
+
10
19
  # NOTE: Debug method for parser development. Outputs current parse position
11
20
  # and capture context. Only called during parser debugging sessions.
12
21
  def debug(msg)
@@ -63,7 +72,7 @@ module Coradoc
63
72
  cont_rule
64
73
  end
65
74
  caps[:block] = kind
66
- any.present? | any.absent?
75
+ str('')
67
76
  end
68
77
  end
69
78
 
@@ -71,7 +80,8 @@ module Coradoc
71
80
  whitespace.repeat(1) >>
72
81
  str('#').repeat >>
73
82
  whitespace.repeat >>
74
- (line_ending.present? | any.absent?)
83
+ # zero-width "at line end or EOF" — negative lookahead
84
+ match('[^\n\r]').absent?
75
85
  end
76
86
 
77
87
  # Escaped hash - not a heading
@@ -174,8 +184,13 @@ module Coradoc
174
184
  consume_fenced_indent >>
175
185
  (line_verbatim | blank_line_verbatim.output(ln: ''))
176
186
  ).repeat.as(:code_block) >>
187
+ # tail: close the fence inside a continuation, or assert
188
+ # "not in a continuation with more input" — the former
189
+ # continuation.absent? | any.absent? chain put zero-width
190
+ # branches in non-last slots (shadowed-alternative lint,
191
+ # parsanol 1.3.55+); (A >> any).absent? == A.absent? | any.absent?
177
192
  (
178
- (continuation >> code_fence_close) | continuation.absent? | any.absent?
193
+ (continuation >> code_fence_close) | (continuation >> any).absent?
179
194
  )
180
195
  end
181
196
 
@@ -9,7 +9,6 @@ module Coradoc
9
9
  autoload :HtmlEntities, "#{__dir__}/html_entities"
10
10
 
11
11
  class InlineParser < Parsanol::Parser
12
-
13
12
  rule(:line_ending) { (str("\n") | str("\r\n") | str("\r")).ignore }
14
13
  rule(:line_ending_or_eof) { line_ending | any.absent? }
15
14
  rule(:whitespace) { match[" \t"] }
@@ -79,16 +78,16 @@ module Coradoc
79
78
  rule(:both_flanking_delimiter_run) do
80
79
  any.precedes? >>
81
80
  unicode_whitespace.does_not_precede? >> (
82
- (
83
- unicode_punctuation.precedes? >>
84
- delimiter_run.as(:bfdr) >>
85
- unicode_punctuation.present?
86
- ) | (
87
- unicode_punctuation.does_not_precede? >>
88
- delimiter_run.as(:bfdr) >>
89
- unicode_punctuation.absent?
90
- )
91
- ) >> unicode_whitespace.absent?
81
+ (
82
+ unicode_punctuation.precedes? >>
83
+ delimiter_run.as(:bfdr) >>
84
+ unicode_punctuation.present?
85
+ ) | (
86
+ unicode_punctuation.does_not_precede? >>
87
+ delimiter_run.as(:bfdr) >>
88
+ unicode_punctuation.absent?
89
+ )
90
+ ) >> unicode_whitespace.absent?
92
91
  end
93
92
 
94
93
  rule(:left_flanking_delimiter_run) do
@@ -106,15 +105,15 @@ module Coradoc
106
105
  rule(:right_flanking_delimiter_run) do
107
106
  any.precedes? >>
108
107
  unicode_whitespace.does_not_precede? >> (
109
- (
110
- unicode_punctuation.precedes? >>
111
- delimiter_run.as(:rfdr) >>
112
- (unicode_whitespace | unicode_punctuation).present?
113
- ) | (
114
- unicode_punctuation.does_not_precede? >>
115
- delimiter_run.as(:rfdr)
108
+ (
109
+ unicode_punctuation.precedes? >>
110
+ delimiter_run.as(:rfdr) >>
111
+ (unicode_whitespace | unicode_punctuation).present?
112
+ ) | (
113
+ unicode_punctuation.does_not_precede? >>
114
+ delimiter_run.as(:rfdr)
115
+ )
116
116
  )
117
- )
118
117
  end
119
118
 
120
119
  rule(:non_flanking_delimiter_run) do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module Markdown
5
- VERSION = '1.0.12'
5
+ VERSION = '1.0.13'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.