Class: RDoc::RD::InlineParser
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::Racc::Parser
|
|
Instance Chain:
self,
::Racc::Parser
|
|
Inherits: |
Racc::Parser
|
Defined in: | lib/rdoc/rd/inline_parser.rb |
Overview
::RDoc::RD
format parser for inline markup such as emphasis, links, footnotes, etc.
Constant Summary
-
BACK_SLASH =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 705"\\"
-
BACK_SLASH_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 706/\A#{Regexp.quote(BACK_SLASH)}/
-
BAR =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 699"|"
-
BAR_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 700/\A#{Regexp.quote(BAR)}/
-
CODE_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 672'}))'
-
CODE_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 673/\A#{Regexp.quote(CODE_CLOSE)}/
-
CODE_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 670'(({'
-
CODE_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 671/\A#{Regexp.quote(CODE_OPEN)}/
-
EM_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 668'*))'
-
EM_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 669/\A#{Regexp.quote(EM_CLOSE)}/
-
EM_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 666'((*'
-
EM_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 667/\A#{Regexp.quote(EM_OPEN)}/
-
FOOTNOTE_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 692'-))'
-
FOOTNOTE_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 693/\A#{Regexp.quote(FOOTNOTE_CLOSE)}/
-
FOOTNOTE_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 690'((-'
-
FOOTNOTE_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 691/\A#{Regexp.quote(FOOTNOTE_OPEN)}/
-
INDEX_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 684':))'
-
INDEX_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 685/\A#{Regexp.quote(INDEX_CLOSE)}/
-
INDEX_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 682'((:'
-
INDEX_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 683/\A#{Regexp.quote(INDEX_OPEN)}/
-
KBD_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 680'%))'
-
KBD_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 681/\A#{Regexp.quote(KBD_CLOSE)}/
-
KBD_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 678'((%'
-
KBD_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 679/\A#{Regexp.quote(KBD_OPEN)}/
-
OTHER_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 713Regexp.new( "\\A.+?(?=#{Regexp.quote(EM_OPEN)}|#{Regexp.quote(EM_CLOSE)}| #{Regexp.quote(CODE_OPEN)}|#{Regexp.quote(CODE_CLOSE)}| #{Regexp.quote(VAR_OPEN)}|#{Regexp.quote(VAR_CLOSE)}| #{Regexp.quote(KBD_OPEN)}|#{Regexp.quote(KBD_CLOSE)}| #{Regexp.quote(INDEX_OPEN)}|#{Regexp.quote(INDEX_CLOSE)}| #{Regexp.quote(REF_OPEN)}|#{Regexp.quote(REF_CLOSE)}| #{Regexp.quote(FOOTNOTE_OPEN)}|#{Regexp.quote(FOOTNOTE_CLOSE)}| #{Regexp.quote(VERB_OPEN)}|#{Regexp.quote(VERB_CLOSE)}| #{Regexp.quote(BAR)}| #{Regexp.quote(QUOTE)}| #{Regexp.quote(SLASH)}| #{Regexp.quote(BACK_SLASH)}| #{Regexp.quote(URL)})", other_re_mode)
-
QUOTE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 701'"'
-
QUOTE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 702/\A#{Regexp.quote(QUOTE)}/
-
REF_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 688'>))'
-
REF_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 689/\A#{Regexp.quote(REF_CLOSE)}/
-
REF_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 686'((<'
-
REF_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 687/\A#{Regexp.quote(REF_OPEN)}/
-
Racc_arg =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 1284[ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ]
-
Racc_debug_parser =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 1373false
-
Racc_token_to_s_table =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 1301[ "$end", "error", "EX_LOW", "QUOTE", "BAR", "SLASH", "BACK_SLASH", "URL", "OTHER", "REF_OPEN", "FOOTNOTE_OPEN", "FOOTNOTE_CLOSE", "EX_HIGH", "EM_OPEN", "EM_CLOSE", "CODE_OPEN", "CODE_CLOSE", "VAR_OPEN", "VAR_CLOSE", "KBD_OPEN", "KBD_CLOSE", "INDEX_OPEN", "INDEX_CLOSE", "REF_CLOSE", "VERB_OPEN", "VERB_CLOSE", "$start", "content", "elements", "element", "emphasis", "code", "var", "keyboard", "index", "reference", "footnote", "verb", "normal_str_ele", "substitute", "ref_label", "ref_label2", "ref_url_strings", "filename", "element_label", "element_label2", "ref_subst_content", "ref_subst_content_q", "ref_subst_strings_q", "ref_subst_strings_first", "ref_subst_ele2", "ref_subst_eles", "ref_subst_str_ele_first", "ref_subst_eles_q", "ref_subst_ele", "ref_subst_ele_q", "ref_subst_str_ele", "ref_subst_str_ele_q", "ref_subst_strings", "ref_subst_string3", "ref_subst_string", "ref_subst_string_q", "ref_subst_string2", "ref_url_string", "verb_strings", "normal_string", "normal_strings", "verb_string", "verb_normal_string" ]
-
SLASH =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 703"/"
-
SLASH_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 704/\A#{Regexp.quote(SLASH)}/
-
URL =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 707"URL:"
-
URL_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 708/\A#{Regexp.quote(URL)}/
-
VAR_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 676'|))'
-
VAR_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 677/\A#{Regexp.quote(VAR_CLOSE)}/
-
VAR_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 674'((|'
-
VAR_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 675/\A#{Regexp.quote(VAR_OPEN)}/
-
VERB_CLOSE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 696"'))"
-
VERB_CLOSE_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 697/\A#{Regexp.quote(VERB_CLOSE)}/
-
VERB_OPEN =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 694"(('"
-
VERB_OPEN_RE =
Internal use only
# File 'lib/rdoc/rd/inline_parser.rb', line 695/\A#{Regexp.quote(VERB_OPEN)}/
::Racc::Parser
- Inherited
Class Method Summary
-
.new(block_parser) ⇒ InlineParser
constructor
Creates a new parser for inline markup in the rd format.
::Racc::Parser
- Inherited
.racc_runtime_type | See additional method definition at file lib/rdoc/rd/block_parser.rb line 235. |
Instance Method Summary
-
#inline(rdoc, reference = rdoc)
Creates a new
Inline
for therdoc
markup and the rawreference
-
#next_token
Returns the next token from the inline text.
-
#next_words_on_error
Returns words following an error.
-
#on_error(et, ev, values)
Raises a ParseError when invalid formatting is found.
-
#parse(inline)
Parses the #inline text from
::RDoc::RD
format into::RDoc::RDoc
format. -
#prev_words_on_error(ev)
Returns words before the error.
-
#last_line(src)
private
Returns the last line of
src
-
#_reduce_101(val, _values, result)
Internal use only
reduce 100 omitted.
- #_reduce_102(val, _values, result) Internal use only
-
#_reduce_109(val, _values, result)
Internal use only
reduce 108 omitted.
-
#_reduce_111(val, _values, result)
Internal use only
reduce 110 omitted.
-
#_reduce_113(val, _values, result)
Internal use only
reduce 112 omitted.
- #_reduce_114(val, _values, result) Internal use only
- #_reduce_115(val, _values, result) Internal use only
-
#_reduce_13(val, _values, result)
Internal use only
reduce 12 omitted.
-
#_reduce_136(val, _values, result)
Internal use only
reduce 135 omitted.
- #_reduce_14(val, _values, result) Internal use only
- #_reduce_15(val, _values, result) Internal use only
- #_reduce_16(val, _values, result) Internal use only
- #_reduce_17(val, _values, result) Internal use only
- #_reduce_18(val, _values, result) Internal use only
- #_reduce_19(val, _values, result) Internal use only
-
#_reduce_2(val, _values, result)
Internal use only
reduce 1 omitted.
- #_reduce_20(val, _values, result) Internal use only
- #_reduce_21(val, _values, result) Internal use only
- #_reduce_22(val, _values, result) Internal use only
- #_reduce_23(val, _values, result) Internal use only
- #_reduce_24(val, _values, result) Internal use only
- #_reduce_25(val, _values, result) Internal use only
- #_reduce_26(val, _values, result) Internal use only
- #_reduce_27(val, _values, result) Internal use only
-
#_reduce_29(val, _values, result)
Internal use only
reduce 28 omitted.
- #_reduce_3(val, _values, result) Internal use only
- #_reduce_30(val, _values, result) Internal use only
- #_reduce_31(val, _values, result) Internal use only
- #_reduce_32(val, _values, result) Internal use only
- #_reduce_33(val, _values, result) Internal use only
- #_reduce_34(val, _values, result) Internal use only
-
#_reduce_36(val, _values, result)
Internal use only
reduce 35 omitted.
- #_reduce_37(val, _values, result) Internal use only
- #_reduce_38(val, _values, result) Internal use only
- #_reduce_39(val, _values, result) Internal use only
- #_reduce_40(val, _values, result) Internal use only
- #_reduce_41(val, _values, result) Internal use only
-
#_reduce_43(val, _values, result)
Internal use only
reduce 42 omitted.
- #_reduce_44(val, _values, result) Internal use only
- #_reduce_45(val, _values, result) Internal use only
- #_reduce_46(val, _values, result) Internal use only
-
#_reduce_57(val, _values, result)
Internal use only
reduce 56 omitted.
- #_reduce_58(val, _values, result) Internal use only
- #_reduce_59(val, _values, result) Internal use only
- #_reduce_60(val, _values, result) Internal use only
-
#_reduce_62(val, _values, result)
Internal use only
reduce 61 omitted.
-
#_reduce_64(val, _values, result)
Internal use only
reduce 63 omitted.
-
#_reduce_78(val, _values, result)
Internal use only
reduce 77 omitted.
-
#_reduce_none(val, _values, result)
Internal use only
reduce 137 omitted.
::Racc::Parser
- Inherited
#_racc_do_parse_rb | See additional method definition at file lib/rdoc/rd/block_parser.rb line 298. |
#_racc_do_reduce | See additional method definition at file lib/rdoc/rd/block_parser.rb line 498. |
#_racc_evalact | common. |
#_racc_init_sysvars | See additional method definition at file lib/rdoc/rd/block_parser.rb line 251. |
#_racc_setup | See additional method definition at file lib/rdoc/rd/block_parser.rb line 239. |
#_racc_yyparse_rb | See additional method definition at file lib/rdoc/rd/block_parser.rb line 348. |
#next_token | The method to fetch next token. |
#on_error | This method is called when a parse error is found. |
#racc_accept | See additional method definition at file lib/rdoc/rd/block_parser.rb line 603. |
#racc_e_pop | See additional method definition at file lib/rdoc/rd/block_parser.rb line 608. |
#racc_next_state | See additional method definition at file lib/rdoc/rd/block_parser.rb line 615. |
#racc_print_stacks | See additional method definition at file lib/rdoc/rd/block_parser.rb line 621. |
#racc_print_states | See additional method definition at file lib/rdoc/rd/block_parser.rb line 630. |
#racc_read_token | For debugging output. |
#racc_reduce | See additional method definition at file lib/rdoc/rd/block_parser.rb line 590. |
#racc_shift | See additional method definition at file lib/rdoc/rd/block_parser.rb line 584. |
#racc_token2str | See additional method definition at file lib/rdoc/rd/block_parser.rb line 637. |
#token_to_str | Convert internal ID of token symbol to the string. |
#yyaccept | Exit parser. |
#yyerrok | Leave error recovering mode. |
#yyerror | Enter error recovering mode. |
Constructor Details
.new(block_parser) ⇒ InlineParser
Creates a new parser for inline markup in the rd format. The block_parser
is used to for footnotes and labels in the inline text.
# File 'lib/rdoc/rd/inline_parser.rb', line 734
def initialize block_parser @block_parser = block_parser end
Instance Method Details
#_reduce_101(val, _values, result)
reduce 100 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1746
def _reduce_101(val, _values, result) index = @block_parser.add_footnote val[1].rdoc result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]" result end
#_reduce_102(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1753
def _reduce_102(val, _values, result) result = inline "<tt>#{val[1]}</tt>", val[1] result end
#_reduce_109(val, _values, result)
reduce 108 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1771
def _reduce_109(val, _values, result) result << val[1] result end
#_reduce_111(val, _values, result)
reduce 110 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1778
def _reduce_111(val, _values, result) result = inline val[0] result end
#_reduce_113(val, _values, result)
reduce 112 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1786
def _reduce_113(val, _values, result) result = val[1] result end
#_reduce_114(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1791
def _reduce_114(val, _values, result) result = val[1] result end
#_reduce_115(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1796
def _reduce_115(val, _values, result) result = val[1] result end
#_reduce_13(val, _values, result)
reduce 12 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1409
def _reduce_13(val, _values, result) content = val[1] result = inline "<em>#{content}</em>", content result end
#_reduce_136(val, _values, result)
reduce 135 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1841
def _reduce_136(val, _values, result) result << val[1] result end
#_reduce_14(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1416
def _reduce_14(val, _values, result) content = val[1] result = inline "<code>#{content}</code>", content result end
#_reduce_15(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1423
def _reduce_15(val, _values, result) content = val[1] result = inline "#{content}", content result end
#_reduce_16(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1430
def _reduce_16(val, _values, result) content = val[1] result = inline "<tt>#{content}</tt>", content result end
#_reduce_17(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1437
def _reduce_17(val, _values, result) label = val[1] @block_parser.add_label label.reference result = "<span id=\"label-#{label}\">#{label}</span>" result end
#_reduce_18(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1445
def _reduce_18(val, _values, result) result = "{#{val[1]}}[#{val[2].join}]" result end
#_reduce_19(val, _values, result)
#_reduce_2(val, _values, result)
reduce 1 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1381
def _reduce_2(val, _values, result) result.append val[1] result end
#_reduce_20(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1459
def _reduce_20(val, _values, result) result = [nil, inline(val[1])] result end
#_reduce_21(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1465
def _reduce_21(val, _values, result) result = [ 'rdoc-label:', inline("#{val[0].reference}/#{val[1].reference}") ] result end
#_reduce_22(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1474
def _reduce_22(val, _values, result) result = ['rdoc-label:', val[0].reference] result end
#_reduce_23(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1480
def _reduce_23(val, _values, result) result = ['rdoc-label:', "#{val[0].reference}/"] result end
#_reduce_24(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1486
def _reduce_24(val, _values, result) result = [nil, inline(val[1])] result end
#_reduce_25(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1492
def _reduce_25(val, _values, result) result = [ 'rdoc-label:', inline("#{val[0].reference}/#{val[1].reference}") ] result end
#_reduce_26(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1501
def _reduce_26(val, _values, result) result = ['rdoc-label:', val[0]] result end
#_reduce_27(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1507
def _reduce_27(val, _values, result) ref = val[0].reference result = ['rdoc-label:', inline(ref, "#{ref}/")] result end
#_reduce_29(val, _values, result)
reduce 28 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1516
def _reduce_29(val, _values, result) result = val[1] result end
#_reduce_3(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1386
def _reduce_3(val, _values, result) result = val[0] result end
#_reduce_30(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1521
def _reduce_30(val, _values, result) result = val[1] result end
#_reduce_31(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1526
def _reduce_31(val, _values, result) result = inline val[0] result end
#_reduce_32(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1532
def _reduce_32(val, _values, result) result = inline "\"#{val[1]}\"" result end
#_reduce_33(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1538
def _reduce_33(val, _values, result) result = inline val[0] result end
#_reduce_34(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1544
def _reduce_34(val, _values, result) result = inline "\"#{val[1]}\"" result end
#_reduce_36(val, _values, result)
reduce 35 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1552
def _reduce_36(val, _values, result) result = val[1] result end
#_reduce_37(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1557
def _reduce_37(val, _values, result) result = inline val[1] result end
#_reduce_38(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1562
def _reduce_38(val, _values, result) result = val[0].append val[1] result end
#_reduce_39(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1568
def _reduce_39(val, _values, result) result = val[0].append val[1] result end
#_reduce_40(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1574
def _reduce_40(val, _values, result) result = val[0] result end
#_reduce_41(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1580
def _reduce_41(val, _values, result) result = inline val[0] result end
#_reduce_43(val, _values, result)
reduce 42 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1588
def _reduce_43(val, _values, result) result = val[0].append val[1] result end
#_reduce_44(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1594
def _reduce_44(val, _values, result) result = inline val[0] result end
#_reduce_45(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1600
def _reduce_45(val, _values, result) result = val[0].append val[1] result end
#_reduce_46(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1606
def _reduce_46(val, _values, result) result = val[0] result end
#_reduce_57(val, _values, result)
reduce 56 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1632
def _reduce_57(val, _values, result) result = val[0] result end
#_reduce_58(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1638
def _reduce_58(val, _values, result) result = inline val[0] result end
#_reduce_59(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1644
def _reduce_59(val, _values, result) result = inline val[0] result end
#_reduce_60(val, _values, result)
# File 'lib/rdoc/rd/inline_parser.rb', line 1650
def _reduce_60(val, _values, result) result << val[1] result end
#_reduce_62(val, _values, result)
reduce 61 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1657
def _reduce_62(val, _values, result) result << val[1] result end
#_reduce_64(val, _values, result)
reduce 63 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1665
def _reduce_64(val, _values, result) result << val[1] result end
#_reduce_78(val, _values, result)
reduce 77 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1697
def _reduce_78(val, _values, result) result << val[1] result end
#_reduce_none(val, _values, result)
reduce 137 omitted
# File 'lib/rdoc/rd/inline_parser.rb', line 1848
def _reduce_none(val, _values, result) val[0] end
#inline(rdoc, reference = rdoc)
Creates a new Inline
for the rdoc
markup and the raw reference
#last_line(src) (private)
Returns the last line of src
# File 'lib/rdoc/rd/inline_parser.rb', line 860
def last_line(src) if n = src.rindex("\n") src[(n+1) .. -1] else src end end
#next_token
Returns the next token from the inline text
# File 'lib/rdoc/rd/inline_parser.rb', line 752
def next_token return [false, false] if @src.eos? # p @src.rest if @yydebug if ret = @src.scan(EM_OPEN_RE) @pre << ret [:EM_OPEN, ret] elsif ret = @src.scan(EM_CLOSE_RE) @pre << ret [:EM_CLOSE, ret] elsif ret = @src.scan(CODE_OPEN_RE) @pre << ret [:CODE_OPEN, ret] elsif ret = @src.scan(CODE_CLOSE_RE) @pre << ret [:CODE_CLOSE, ret] elsif ret = @src.scan(VAR_OPEN_RE) @pre << ret [:VAR_OPEN, ret] elsif ret = @src.scan(VAR_CLOSE_RE) @pre << ret [:VAR_CLOSE, ret] elsif ret = @src.scan(KBD_OPEN_RE) @pre << ret [:KBD_OPEN, ret] elsif ret = @src.scan(KBD_CLOSE_RE) @pre << ret [:KBD_CLOSE, ret] elsif ret = @src.scan(INDEX_OPEN_RE) @pre << ret [:INDEX_OPEN, ret] elsif ret = @src.scan(INDEX_CLOSE_RE) @pre << ret [:INDEX_CLOSE, ret] elsif ret = @src.scan(REF_OPEN_RE) @pre << ret [:REF_OPEN, ret] elsif ret = @src.scan(REF_CLOSE_RE) @pre << ret [:REF_CLOSE, ret] elsif ret = @src.scan(FOOTNOTE_OPEN_RE) @pre << ret [:FOOTNOTE_OPEN, ret] elsif ret = @src.scan(FOOTNOTE_CLOSE_RE) @pre << ret [:FOOTNOTE_CLOSE, ret] elsif ret = @src.scan(VERB_OPEN_RE) @pre << ret [:VERB_OPEN, ret] elsif ret = @src.scan(VERB_CLOSE_RE) @pre << ret [:VERB_CLOSE, ret] elsif ret = @src.scan(BAR_RE) @pre << ret [:BAR, ret] elsif ret = @src.scan(QUOTE_RE) @pre << ret [:QUOTE, ret] elsif ret = @src.scan(SLASH_RE) @pre << ret [:SLASH, ret] elsif ret = @src.scan(BACK_SLASH_RE) @pre << ret [:BACK_SLASH, ret] elsif ret = @src.scan(URL_RE) @pre << ret [:URL, ret] elsif ret = @src.scan(OTHER_RE) @pre << ret [:OTHER, ret] else ret = @src.rest @pre << ret @src.terminate [:OTHER, ret] end end
#next_words_on_error
Returns words following an error
# File 'lib/rdoc/rd/inline_parser.rb', line 872
def next_words_on_error if n = @src.rest.index("\n") @src.rest[0 .. (n-1)] else @src.rest end end
#on_error(et, ev, values)
Raises a ParseError when invalid formatting is found
# File 'lib/rdoc/rd/inline_parser.rb', line 832
def on_error(et, ev, values) lines_of_rest = @src.rest.lines.to_a.length prev_words = prev_words_on_error(ev) at = 4 + prev_words.length = <<-MSG RD syntax error: line #{@block_parser.line_index - lines_of_rest}: #...#{prev_words} #{(ev||'')} #{next_words_on_error()} ... MSG << " " * at + "^" * (ev ? ev.length : 0) + "\n" raise ParseError, end
#parse(inline)
Parses the #inline text from ::RDoc::RD
format into ::RDoc::RDoc
format.
#prev_words_on_error(ev)
Returns words before the error
# File 'lib/rdoc/rd/inline_parser.rb', line 849
def prev_words_on_error(ev) pre = @pre if ev and /#{Regexp.quote(ev)}$/ =~ pre pre = $` end last_line(pre) end