Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ AllCops:
- "lib/rdoc/rd/block_parser.rb"
- "lib/rdoc/rd/inline_parser.rb"
- "lib/rdoc/markdown.rb"
- "lib/rdoc/markdown/literals.rb"
# Exclude dependency files when installing them under vendor
- "vendor/**/*"

Expand Down
1 change: 0 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ bundle exec rake clean
- `lib/rdoc/rd/block_parser.rb` (from `.ry` via racc)
- `lib/rdoc/rd/inline_parser.rb` (from `.ry` via racc)
- `lib/rdoc/markdown.rb` (from `.kpeg` via kpeg)
- `lib/rdoc/markdown/literals.rb` (from `.kpeg` via kpeg)

**Note:** These files are auto-generated and should not be edited manually. Always regenerate after modifying source `.ry` or `.kpeg` files.

Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ bundle exec rake verify_generated
- `lib/rdoc/rd/block_parser.ry` → generates `block_parser.rb` via racc
- `lib/rdoc/rd/inline_parser.ry` → generates `inline_parser.rb` via racc
- `lib/rdoc/markdown.kpeg` → generates `markdown.rb` via kpeg
- `lib/rdoc/markdown/literals.kpeg` → generates `literals.rb` via kpeg

**Important:**

Expand Down Expand Up @@ -176,8 +175,7 @@ lib/rdoc/
├── markdown.kpeg # Parser source (edit this)
├── markdown.rb # Generated parser (do not edit)
├── markdown/ # Markdown parsing
│ ├── literals.kpeg # Parser source (edit this)
│ └── literals.rb # Generated parser (do not edit)
│ └── byte_runtime.rb # Byte-offset parser runtime
├── rd/ # RD format parsing
│ ├── block_parser.ry # Parser source (edit this)
│ ├── block_parser.rb # Generated parser (do not edit)
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ PARSER_FILES = %w[
lib/rdoc/rd/block_parser.ry
lib/rdoc/rd/inline_parser.ry
lib/rdoc/markdown.kpeg
lib/rdoc/markdown/literals.kpeg
]

$rdoc_rakefile = true
Expand Down
13 changes: 5 additions & 8 deletions lib/rdoc/markdown.kpeg
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@
require_relative 'markup/to_joined_paragraph'
require_relative 'markdown/entities'

require_relative 'markdown/literals'
require_relative 'markdown/byte_runtime'

prepend ByteRuntime
Literals.prepend ByteRuntime

##
# Supported extensions
Expand Down Expand Up @@ -1180,12 +1178,11 @@ SpecialChar = /[~*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar
NormalChar = !( @SpecialChar | @Spacechar | @Newline ) .
Digit = [0-9]

%literals = RDoc::Markdown::Literals
Alphanumeric = %literals.Alphanumeric
AlphanumericAscii = %literals.AlphanumericAscii
BOM = %literals.BOM
Newline = %literals.Newline
Spacechar = %literals.Spacechar
Alphanumeric = /\p{Word}/
AlphanumericAscii = /[A-Za-z0-9]/
BOM = "\uFEFF"
Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
Spacechar = /\t|\p{Zs}/

HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";"
{ rdoc_escape([text.to_i(16)].pack('U')) }
Expand Down
36 changes: 16 additions & 20 deletions lib/rdoc/markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,9 @@ def self.rule_info(name, rendered)
require_relative 'markup/to_joined_paragraph'
require_relative 'markdown/entities'

require_relative 'markdown/literals'
require_relative 'markdown/byte_runtime'

prepend ByteRuntime
Literals.prepend ByteRuntime

##
# Supported extensions
Expand Down Expand Up @@ -955,9 +953,7 @@ def parse_cell_inline(text)


# :stopdoc:
def setup_foreign_grammar
@_grammar_literals = RDoc::Markdown::Literals.new(nil)
end
def setup_foreign_grammar; end

# root = Doc
def _root
Expand Down Expand Up @@ -14767,37 +14763,37 @@ def _Digit
return _tmp
end

# Alphanumeric = %literals.Alphanumeric
# Alphanumeric = /\p{Word}/
def _Alphanumeric
_tmp = @_grammar_literals.external_invoke(self, :_Alphanumeric)
_tmp = scan(/\G(?-mix:\p{Word})/)
set_failed_rule :_Alphanumeric unless _tmp
return _tmp
end

# AlphanumericAscii = %literals.AlphanumericAscii
# AlphanumericAscii = /[A-Za-z0-9]/
def _AlphanumericAscii
_tmp = @_grammar_literals.external_invoke(self, :_AlphanumericAscii)
_tmp = scan(/\G(?-mix:[A-Za-z0-9])/)
set_failed_rule :_AlphanumericAscii unless _tmp
return _tmp
end

# BOM = %literals.BOM
# BOM = "uFEFF"
def _BOM
_tmp = @_grammar_literals.external_invoke(self, :_BOM)
_tmp = match_string("uFEFF")
set_failed_rule :_BOM unless _tmp
return _tmp
end

# Newline = %literals.Newline
# Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
def _Newline
_tmp = @_grammar_literals.external_invoke(self, :_Newline)
_tmp = scan(/\G(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
set_failed_rule :_Newline unless _tmp
return _tmp
end

# Spacechar = %literals.Spacechar
# Spacechar = /\t|\p{Zs}/
def _Spacechar
_tmp = @_grammar_literals.external_invoke(self, :_Spacechar)
_tmp = scan(/\G(?-mix:\t|\p{Zs})/)
set_failed_rule :_Spacechar unless _tmp
return _tmp
end
Expand Down Expand Up @@ -16840,11 +16836,11 @@ def _DefinitionListDefinition
Rules[:_SpecialChar] = rule_info("SpecialChar", "(/[~*_`&\\[\\]()<!\#\\\\'\"]/ | @ExtendedSpecialChar)")
Rules[:_NormalChar] = rule_info("NormalChar", "!(@SpecialChar | @Spacechar | @Newline) .")
Rules[:_Digit] = rule_info("Digit", "[0-9]")
Rules[:_Alphanumeric] = rule_info("Alphanumeric", "%literals.Alphanumeric")
Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "%literals.AlphanumericAscii")
Rules[:_BOM] = rule_info("BOM", "%literals.BOM")
Rules[:_Newline] = rule_info("Newline", "%literals.Newline")
Rules[:_Spacechar] = rule_info("Spacechar", "%literals.Spacechar")
Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/")
Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/")
Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"")
Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/")
Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/")
Rules[:_HexEntity] = rule_info("HexEntity", "/&\#x/i < /[0-9a-fA-F]+/ > \";\" { rdoc_escape([text.to_i(16)].pack('U')) }")
Rules[:_DecEntity] = rule_info("DecEntity", "\"&\#\" < /[0-9]+/ > \";\" { rdoc_escape([text.to_i].pack('U')) }")
Rules[:_CharEntity] = rule_info("CharEntity", "\"&\" < /[A-Za-z0-9]+/ > \";\" { if entity = HTML_ENTITIES[text] then rdoc_escape(entity.pack('U*')) else \"&\#{text};\" end }")
Expand Down
21 changes: 0 additions & 21 deletions lib/rdoc/markdown/literals.kpeg

This file was deleted.

Loading