org-parse 0.1.1

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.
Files changed (68) hide show
  1. data/.document +5 -0
  2. data/.gitignore +23 -0
  3. data/ChangeLog +4 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +68 -0
  6. data/Rakefile +54 -0
  7. data/VERSION.yml +5 -0
  8. data/bin/org-parse +51 -0
  9. data/bin/org-test +74 -0
  10. data/doc/images/org-parse-struct_1ffae50f0c5eb867f9418df6800f40a5cc3d1751.png +0 -0
  11. data/doc/org-parse.html +203 -0
  12. data/doc/org-parse.org +71 -0
  13. data/doc/struct.dot +10 -0
  14. data/doc/struct.png +0 -0
  15. data/examples/body-only.html.erb +1 -0
  16. data/examples/dot.org-parse-rc +21 -0
  17. data/lib/org-parse/inline-parser.output +945 -0
  18. data/lib/org-parse/inline-parser.rb +219 -0
  19. data/lib/org-parse/inline-parser.ry +77 -0
  20. data/lib/org-parse/inline-parser.tab.rb +411 -0
  21. data/lib/org-parse/node.rb +329 -0
  22. data/lib/org-parse/struct-parser.output +1019 -0
  23. data/lib/org-parse/struct-parser.rb +78 -0
  24. data/lib/org-parse/struct-parser.ry +125 -0
  25. data/lib/org-parse/struct-parser.tab.rb +608 -0
  26. data/lib/org-parse/struct-scanner.rb +272 -0
  27. data/lib/org-parse/templates/single.html.erb +118 -0
  28. data/lib/org-parse/textile-visitor.rb +296 -0
  29. data/lib/org-parse/utils.rb +15 -0
  30. data/lib/org-parse/visitor.rb +542 -0
  31. data/lib/org-parse.rb +46 -0
  32. data/org-parse.gemspec +113 -0
  33. data/rakelib/racc.rake +16 -0
  34. data/test/data/blocks.org +67 -0
  35. data/test/data/emphasis.org +7 -0
  36. data/test/data/footnote.html +136 -0
  37. data/test/data/footnote.org +8 -0
  38. data/test/data/html-export.html +1062 -0
  39. data/test/data/html-export.org +342 -0
  40. data/test/data/images.html +179 -0
  41. data/test/data/images.org +30 -0
  42. data/test/data/index.org +242 -0
  43. data/test/data/lily20100228.jpg +0 -0
  44. data/test/data/lily20100228t.jpg +0 -0
  45. data/test/data/link.org +7 -0
  46. data/test/data/list_before_1st_headline.html +119 -0
  47. data/test/data/list_before_1st_headline.org +7 -0
  48. data/test/data/lists.html +284 -0
  49. data/test/data/lists.org +78 -0
  50. data/test/data/no-headline.org +6 -0
  51. data/test/data/one-headline.org +2 -0
  52. data/test/data/paragraph.org +13 -0
  53. data/test/data/quote.org +15 -0
  54. data/test/data/sections.html +173 -0
  55. data/test/data/sections.org +9 -0
  56. data/test/data/simple-list.org +6 -0
  57. data/test/data/skip_t.org +3 -0
  58. data/test/data/structure.org +53 -0
  59. data/test/data/table.org +14 -0
  60. data/test/data/test-list.org +12 -0
  61. data/test/data/text-bef-hl.org +5 -0
  62. data/test/data/text.org +6 -0
  63. data/test/data/title.html +88 -0
  64. data/test/data/title.org +6 -0
  65. data/test/data/verse.org +48 -0
  66. data/test/helper.rb +31 -0
  67. data/test/test_org-parse.rb +148 -0
  68. metadata +134 -0
@@ -0,0 +1,219 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'racc/parser'
3
+ require 'forwardable'
4
+ require 'strscan'
5
+ require 'uri'
6
+ require ::File.join(OrgParse::LIBPATH , 'org-parse', 'inline-parser.tab.rb')
7
+ require ::File.join(OrgParse::LIBPATH , 'org-parse', 'node.rb')
8
+
9
+ module OrgParse
10
+
11
+ # 行単位の要素を解析する
12
+ class InlineParser < Racc::Parser
13
+ attr_reader :token_que
14
+ attr_accessor :structp
15
+
16
+ def initialize(bp = nil)
17
+ @structp = bp
18
+ @token_que = []
19
+ @footnote_idx = 0
20
+ @footnotes = {}
21
+
22
+ # Set up the emphasis regular expression.
23
+ @pre_emphasis = " \t\\('\""
24
+ @post_emphasis = "- \t.,:!?;'\"\\)"
25
+ @border_forbidden = " \t\r\n,\"'"
26
+ @body_regexp = ".*?"
27
+ @markers = "*/_=~+"
28
+ @org_quote_regexp = /@<[^>]+>/
29
+ @org_br_regexp = /\\\\$/
30
+ @org_footnote_regexp = /\[fn:(.+)\]/
31
+
32
+ build_org_emphasis_regexp
33
+ build_org_link_regexp
34
+ end
35
+
36
+ def parse(src)
37
+ return [] if src.empty?
38
+ @src = src
39
+ @token_que = []
40
+ @yydebug = true
41
+ scan(src)
42
+ do_parse
43
+ end
44
+
45
+ # 文字列をトークンに分解し、@token_que にセットする
46
+ #
47
+ def scan(str, verb = false)
48
+ symbols = {
49
+ '*' => [:EM_OPEN, :EM_CLOSE],
50
+ '/' => [:IT_OPEN, :IT_CLOSE],
51
+ '=' => [:CODE_OPEN, :CODE_CLOSE],
52
+ '~' => [:VERB_OPEN, :VERB_CLOSE],
53
+ '+' => [:ST_OPEN, :ST_CLOSE],
54
+ '_' => [:UL_OPEN, :UL_CLOSE],
55
+ }
56
+ while !str.empty?
57
+ # puts "str:\"#{str}\""
58
+ matches = []
59
+ matches << [:em, Regexp.last_match] if @org_emphasis_regexp =~ str
60
+ matches << [:lt, Regexp.last_match] if @org_link_text_regexp =~ str
61
+ matches << [:ln, Regexp.last_match] if @org_link_regexp =~ str
62
+ matches << [:quote, Regexp.last_match] if @org_quote_regexp =~ str
63
+ matches << [:br, Regexp.last_match] if @org_br_regexp =~ str
64
+ matches << [:fn, Regexp.last_match] if @org_footnote_regexp =~ str
65
+
66
+ if matches.empty?
67
+ @token_que << [:OTHER, str]
68
+ str = ''
69
+ else
70
+ # p matches
71
+ m = matches[0]
72
+ matches.each {|i| m = i if m[1].pre_match.size > i[1].pre_match.size }
73
+ # puts '--------------------'
74
+ # p m[1]
75
+ # puts '--------------------'
76
+ lm = m[1]
77
+ case m[0]
78
+ when :em
79
+ if verb
80
+ pre = lm.pre_match + lm[1] + lm[2]
81
+ @token_que << [:OTHER, pre]
82
+ # puts "#{str};#{pre};#{pre.size}"
83
+ str = str[pre.size..-1]
84
+ else
85
+ str = lm[4]+lm.post_match
86
+ symbol = symbols[lm[2]]
87
+ pre = lm.pre_match + lm[1]
88
+ @token_que << [:OTHER, pre] unless pre.empty?
89
+ @token_que << [symbol[0], symbol[0]]
90
+ v = ['=', '~'].include?(lm[2])
91
+ scan(lm[3], v)
92
+ @token_que << [symbol[1], symbol[1]]
93
+ end
94
+ when :lt
95
+ str = lm.post_match
96
+ pre = lm.pre_match
97
+ @token_que << [:OTHER, pre] unless pre.empty?
98
+ @token_que << [:LINK_START, lm[1]]
99
+ scan lm[2], verb
100
+ @token_que << [:LINK_END, :LINK_END]
101
+ when :ln
102
+ str = lm.post_match
103
+ pre = lm.pre_match
104
+ @token_que << [:OTHER, pre] unless pre.empty?
105
+ @token_que << [:LINK_URI, lm[1]]
106
+ when :quote
107
+ str = lm.post_match
108
+ pre = lm.pre_match
109
+ @token_que << [:OTHER, pre] unless pre.empty?
110
+ @token_que << [:QUOTE, lm[0].sub(/^@/,'')]
111
+ when :br
112
+ str = "\n"
113
+ pre = lm.pre_match
114
+ @token_que << [:OTHER, pre] unless pre.empty?
115
+ @token_que << [:QUOTE, "\n"]
116
+ when :fn
117
+ match, nstr = balanced?(lm[1]+']'+lm.post_match, ['[', ']'])
118
+ pre = lm.pre_match
119
+ if match.empty?
120
+ @token_que << [:OTHER, pre + "[fn:"]
121
+ str = lm[1]+']'+lm.post_match
122
+ else
123
+ str = nstr
124
+ @token_que << [:OTHER, pre] unless pre.empty?
125
+ footnote match
126
+ end
127
+ end
128
+ end
129
+ # p str
130
+ # return if str.nil?
131
+ end
132
+ end
133
+
134
+ def next_token
135
+ return [false, false] if @token_que.empty?
136
+ # p @token_que[0]
137
+ @token_que.shift
138
+ end
139
+
140
+ def on_error(et, ev, values)
141
+ message = " #{et} #{ev ? ev : ''} #{values}\n"
142
+ raise ParseError, message
143
+ end
144
+
145
+ private
146
+
147
+ def balanced?(str, pair)
148
+ idx = 0;
149
+ cnt = 1;
150
+ str.each_byte{|c|
151
+ cnt += 1 if c == pair[0][0]
152
+ cnt -= 1 if c == pair[1][0]
153
+ break if cnt == 0
154
+ idx += 1
155
+ }
156
+ return ['', str] if cnt != 0
157
+ rest = str[idx+1, str.size]
158
+ rest = '' unless rest
159
+ [str[0, idx], rest]
160
+ end
161
+
162
+ # [n] -- not impliment
163
+ # org-source str
164
+ # a [fn:name] name
165
+ # b [fn:: definition] : definition
166
+ # c [fn:name: definition] name: definition
167
+ def footnote(str)
168
+ case str
169
+ when /^:\s*(.+)$/ # b
170
+ @token_que << [:FN_LINK, @footnote_idx]
171
+ @token_que << [:FN_START, @footnote_idx]
172
+ @footnote_idx += 1
173
+ scan $1
174
+ @token_que << [:FN_END, '']
175
+ when /^([^:]+):\s*(.+)$/ # c
176
+ @token_que << [:FN_LINK, $1]
177
+ @token_que << [:FN_START, $1]
178
+ scan $2
179
+ @token_que << [:FN_END, '']
180
+ else # a
181
+ @token_que << [:FN_LINK, str]
182
+ end
183
+ end
184
+
185
+ def build_org_emphasis_regexp
186
+ @org_emphasis_regexp = Regexp.new("([#{@pre_emphasis}]|^)\n" +
187
+ "( [#{@markers}] )\n" +
188
+ "( [^#{@border_forbidden}] | " +
189
+ " [^#{@border_forbidden}]#{@body_regexp}[^#{@border_forbidden}] )\n" +
190
+ "\\2\n" +
191
+ "([#{@post_emphasis}]|$)\n", Regexp::EXTENDED)
192
+ # @logger.debug "Just created regexp: #{@org_emphasis_regexp}"
193
+ end
194
+
195
+ def build_org_link_regexp
196
+ @org_link_regexp = /\[\[([^\]]*)\]\]/ # $1 is the URL
197
+
198
+ @org_img_regexp = /\[\[
199
+ ([^\]]*\.(jpg|jpeg|gif|png)) # Like a normal URL, but must end with a specified extension
200
+ \]\]/xi
201
+ @org_link_text_regexp = /\[\[([^\]]*)\]\[([^\]]*)\]\]/ # $1 is the URL、$2 is the friendly text
202
+ end
203
+ end
204
+
205
+ module InlineUtils
206
+ @@inline_parser = nil
207
+
208
+ def line_parse(str)
209
+ @@inline_parser = InlineParser.new if @@inline_parser.nil?
210
+ @@inline_parser.parse(str)
211
+ end
212
+
213
+ def set_struct_parser(sp)
214
+ @@inline_parser = InlineParser.new if @@inline_parser.nil?
215
+ @@inline_parser.structp = sp
216
+ end
217
+ end
218
+
219
+ end
@@ -0,0 +1,77 @@
1
+ class OrgParse::InlineParser
2
+
3
+ preclow
4
+ nonassoc EX_LOW
5
+ nonassoc OTHER
6
+ nonassoc EX_HIGH
7
+ prechigh
8
+
9
+ token EM_OPEN EM_CLOSE LINK_START LINK_END LINK_URI
10
+ ST_OPEN ST_CLOSE QUOTE FN_LINK FN_START FN_END
11
+ IT_OPEN IT_CLOSE UL_OPEN UL_CLOSE
12
+ VERB_OPEN VERB_CLOSE
13
+ CODE_OPEN CODE_CLOSE
14
+ OTHER EX_LOW EX_HIGH EOL
15
+
16
+ rule
17
+ content : elements
18
+
19
+ elements : elements element { result << val[1] }
20
+ | element { result = val }
21
+
22
+ element : emphasis
23
+ | italic
24
+ | under_line
25
+ | code
26
+ | strike
27
+ | verb
28
+ | normal_string_element
29
+ | link
30
+ | quote
31
+ | fn_link
32
+ | fn_define
33
+
34
+ fn_link : FN_LINK { result = Node.new(:FN_LINK, [], val[0]) }
35
+
36
+ fn_define : FN_START elements FN_END
37
+ { result = Node.new(:FN_DEFINE, val[1], val[0]) }
38
+
39
+ emphasis : EM_OPEN elements EM_CLOSE
40
+ { result = Node.new(:EMPHASIS, val[1]) }
41
+
42
+ italic : IT_OPEN elements IT_CLOSE
43
+ { result = Node.new(:ITALIC, val[1]) }
44
+
45
+ under_line : UL_OPEN elements UL_CLOSE
46
+ { result = Node.new(:UNDER_LINE, val[1]) }
47
+
48
+ code : CODE_OPEN elements CODE_CLOSE
49
+ { result = Node.new(:CODE, val[1]) }
50
+
51
+ verb : VERB_OPEN elements VERB_CLOSE
52
+ { result = Node.new(:VERBATIM, val[1]) }
53
+
54
+ strike : ST_OPEN elements ST_CLOSE
55
+ { result = Node.new(:STRIKE_THROUGH, val[1]) }
56
+
57
+ normal_strings : normal_strings OTHER { result << val[1] }
58
+ | OTHER
59
+
60
+ quote : QUOTE { result = Node.new(:QUOTE, [], val[0]) }
61
+
62
+ normal_string_element : normal_strings = EX_LOW
63
+ { result = Node.new(:STRING, [], val[0]) }
64
+
65
+ link_descs : link_descs link_desc { result << val[1] }
66
+ | link_desc { result = val }
67
+
68
+ link_desc : emphasis
69
+ | italic
70
+ | under_line
71
+ | code
72
+ | normal_string_element
73
+
74
+ link : LINK_START link_descs LINK_END { result = LinkNode.new(val[0], val[1], @structp.variables) }
75
+ | LINK_URI { result = LinkNode.new(val[0], [], @structp.variables) }
76
+
77
+ end
@@ -0,0 +1,411 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.5
4
+ # from racc grammer file "lib/org-parse/inline-parser.ry".
5
+ #
6
+
7
+ require 'racc/parser'
8
+
9
+
10
+ module OrgParse
11
+
12
+ class InlineParser < Racc::Parser
13
+
14
+ ##### racc 1.4.5 generates ###
15
+
16
+ racc_reduce_table = [
17
+ 0, 0, :racc_error,
18
+ 1, 26, :_reduce_none,
19
+ 2, 27, :_reduce_2,
20
+ 1, 27, :_reduce_3,
21
+ 1, 28, :_reduce_none,
22
+ 1, 28, :_reduce_none,
23
+ 1, 28, :_reduce_none,
24
+ 1, 28, :_reduce_none,
25
+ 1, 28, :_reduce_none,
26
+ 1, 28, :_reduce_none,
27
+ 1, 28, :_reduce_none,
28
+ 1, 28, :_reduce_none,
29
+ 1, 28, :_reduce_none,
30
+ 1, 28, :_reduce_none,
31
+ 1, 28, :_reduce_none,
32
+ 1, 38, :_reduce_15,
33
+ 3, 39, :_reduce_16,
34
+ 3, 29, :_reduce_17,
35
+ 3, 30, :_reduce_18,
36
+ 3, 31, :_reduce_19,
37
+ 3, 32, :_reduce_20,
38
+ 3, 34, :_reduce_21,
39
+ 3, 33, :_reduce_22,
40
+ 2, 40, :_reduce_23,
41
+ 1, 40, :_reduce_none,
42
+ 1, 37, :_reduce_25,
43
+ 1, 35, :_reduce_26,
44
+ 2, 41, :_reduce_27,
45
+ 1, 41, :_reduce_28,
46
+ 1, 42, :_reduce_none,
47
+ 1, 42, :_reduce_none,
48
+ 1, 42, :_reduce_none,
49
+ 1, 42, :_reduce_none,
50
+ 1, 42, :_reduce_none,
51
+ 3, 36, :_reduce_34,
52
+ 1, 36, :_reduce_35 ]
53
+
54
+ racc_reduce_n = 36
55
+
56
+ racc_shift_n = 55
57
+
58
+ racc_action_table = [
59
+ 7, 47, 13, 7, 18, 13, 23, 26, 41, 3,
60
+ 5, 8, 30, 12, nil, 20, 12, 24, 20, 1,
61
+ 45, 7, 1, 13, nil, 18, nil, 23, 26, nil,
62
+ 3, 5, 8, nil, 12, nil, 20, nil, 24, 53,
63
+ 1, 7, nil, 13, nil, 18, nil, 23, 26, nil,
64
+ 3, 5, 8, nil, 12, 7, 20, 13, 24, 18,
65
+ 1, 23, 26, 54, 3, 5, 8, nil, 12, 7,
66
+ 20, 13, 24, 18, 1, 23, 26, nil, 3, 5,
67
+ 8, nil, 12, 7, 20, 13, 24, 18, 1, 23,
68
+ 26, nil, 3, 5, 8, nil, 12, 7, 20, 13,
69
+ 24, 18, 1, 23, 26, nil, 3, 5, 8, nil,
70
+ 12, 7, 20, 13, 24, 18, 1, 23, 26, nil,
71
+ 3, 5, 8, nil, 12, 7, 20, 13, 24, 18,
72
+ 1, 23, 26, nil, 3, 5, 8, nil, 12, nil,
73
+ 20, 7, 24, 13, 1, nil, 50, nil, nil, nil,
74
+ nil, nil, nil, nil, 12, 7, 20, 13, nil, 18,
75
+ 1, 23, 26, nil, 3, 5, 8, nil, 12, 7,
76
+ 20, 13, 24, 18, 1, 23, 26, nil, 3, 5,
77
+ 8, nil, 12, 7, 20, 13, 24, 18, 1, 23,
78
+ 26, nil, 3, 5, 8, 46, 12, 7, 20, 13,
79
+ 24, 18, 1, 23, 26, nil, 3, 5, 8, nil,
80
+ 12, nil, 20, 52, 24, 7, 1, 13, nil, 18,
81
+ nil, 23, 26, nil, 3, 5, 8, nil, 12, 48,
82
+ 20, nil, 24, 7, 1, 13, 49, 18, nil, 23,
83
+ 26, nil, 3, 5, 8, nil, 12, 7, 20, 13,
84
+ 24, 18, 1, 23, 26, nil, 3, 5, 8, nil,
85
+ 12, nil, 20, nil, 24, nil, 1 ]
86
+
87
+ racc_action_check = [
88
+ 28, 30, 28, 18, 28, 18, 28, 28, 19, 28,
89
+ 28, 28, 11, 28, nil, 28, 18, 28, 18, 28,
90
+ 28, 43, 18, 43, nil, 43, nil, 43, 43, nil,
91
+ 43, 43, 43, nil, 43, nil, 43, nil, 43, 43,
92
+ 43, 8, nil, 8, nil, 8, nil, 8, 8, nil,
93
+ 8, 8, 8, nil, 8, 44, 8, 44, 8, 44,
94
+ 8, 44, 44, 44, 44, 44, 44, nil, 44, 12,
95
+ 44, 12, 44, 12, 44, 12, 12, nil, 12, 12,
96
+ 12, nil, 12, 13, 12, 13, 12, 13, 12, 13,
97
+ 13, nil, 13, 13, 13, nil, 13, 15, 13, 15,
98
+ 13, 15, 13, 15, 15, nil, 15, 15, 15, nil,
99
+ 15, 1, 15, 1, 15, 1, 15, 1, 1, nil,
100
+ 1, 1, 1, nil, 1, 20, 1, 20, 1, 20,
101
+ 1, 20, 20, nil, 20, 20, 20, nil, 20, nil,
102
+ 20, 37, 20, 37, 20, nil, 37, nil, nil, nil,
103
+ nil, nil, nil, nil, 37, 26, 37, 26, nil, 26,
104
+ 37, 26, 26, nil, 26, 26, 26, nil, 26, 0,
105
+ 26, 0, 26, 0, 26, 0, 0, nil, 0, 0,
106
+ 0, nil, 0, 29, 0, 29, 0, 29, 0, 29,
107
+ 29, nil, 29, 29, 29, 29, 29, 42, 29, 42,
108
+ 29, 42, 29, 42, 42, nil, 42, 42, 42, nil,
109
+ 42, nil, 42, 42, 42, 31, 42, 31, nil, 31,
110
+ nil, 31, 31, nil, 31, 31, 31, nil, 31, 31,
111
+ 31, nil, 31, 32, 31, 32, 32, 32, nil, 32,
112
+ 32, nil, 32, 32, 32, nil, 32, 24, 32, 24,
113
+ 32, 24, 32, 24, 24, nil, 24, 24, 24, nil,
114
+ 24, nil, 24, nil, 24, nil, 24 ]
115
+
116
+ racc_action_pointer = [
117
+ 166, 108, nil, nil, nil, nil, nil, nil, 38, nil,
118
+ nil, 12, 66, 80, nil, 94, nil, nil, 0, 5,
119
+ 122, nil, nil, nil, 244, nil, 152, nil, -3, 180,
120
+ 1, 212, 230, nil, nil, nil, nil, 138, nil, nil,
121
+ nil, nil, 194, 18, 52, nil, nil, nil, nil, nil,
122
+ nil, nil, nil, nil, nil ]
123
+
124
+ racc_action_default = [
125
+ -36, -36, -8, -25, -9, -15, -10, -24, -36, -11,
126
+ -12, -36, -36, -36, -13, -1, -14, -3, -36, -26,
127
+ -36, -4, -5, -35, -36, -6, -36, -7, -36, -36,
128
+ -36, -36, -36, -2, -33, -29, -30, -36, -31, -28,
129
+ -32, -23, -36, -36, -36, -20, -16, 55, -18, -17,
130
+ -34, -27, -19, -21, -22 ]
131
+
132
+ racc_goto_table = [
133
+ 33, 35, 39, 37, 11, 36, 34, 40, nil, nil,
134
+ 15, 28, 38, 33, 33, nil, 33, 33, 29, nil,
135
+ 35, 51, 31, 32, 36, 34, 40, 33, 33, 33,
136
+ 42, 38, nil, nil, 43, nil, 44 ]
137
+
138
+ racc_goto_check = [
139
+ 3, 4, 17, 16, 1, 5, 10, 7, nil, nil,
140
+ 2, 2, 6, 3, 3, nil, 3, 3, 2, nil,
141
+ 4, 17, 2, 2, 5, 10, 7, 3, 3, 3,
142
+ 2, 6, nil, nil, 2, nil, 2 ]
143
+
144
+ racc_goto_pointer = [
145
+ nil, 4, 10, -15, -17, -13, -6, -11, nil, nil,
146
+ -12, nil, nil, nil, nil, nil, -15, -16 ]
147
+
148
+ racc_goto_default = [
149
+ nil, nil, nil, 17, 21, 22, 25, 27, 2, 4,
150
+ 6, 9, 10, 14, 16, 19, nil, nil ]
151
+
152
+ racc_token_table = {
153
+ false => 0,
154
+ Object.new => 1,
155
+ :EX_LOW => 2,
156
+ :OTHER => 3,
157
+ :EX_HIGH => 4,
158
+ :EM_OPEN => 5,
159
+ :EM_CLOSE => 6,
160
+ :LINK_START => 7,
161
+ :LINK_END => 8,
162
+ :LINK_URI => 9,
163
+ :ST_OPEN => 10,
164
+ :ST_CLOSE => 11,
165
+ :QUOTE => 12,
166
+ :FN_LINK => 13,
167
+ :FN_START => 14,
168
+ :FN_END => 15,
169
+ :IT_OPEN => 16,
170
+ :IT_CLOSE => 17,
171
+ :UL_OPEN => 18,
172
+ :UL_CLOSE => 19,
173
+ :VERB_OPEN => 20,
174
+ :VERB_CLOSE => 21,
175
+ :CODE_OPEN => 22,
176
+ :CODE_CLOSE => 23,
177
+ :EOL => 24 }
178
+
179
+ racc_use_result_var = true
180
+
181
+ racc_nt_base = 25
182
+
183
+ Racc_arg = [
184
+ racc_action_table,
185
+ racc_action_check,
186
+ racc_action_default,
187
+ racc_action_pointer,
188
+ racc_goto_table,
189
+ racc_goto_check,
190
+ racc_goto_default,
191
+ racc_goto_pointer,
192
+ racc_nt_base,
193
+ racc_reduce_table,
194
+ racc_token_table,
195
+ racc_shift_n,
196
+ racc_reduce_n,
197
+ racc_use_result_var ]
198
+
199
+ Racc_token_to_s_table = [
200
+ '$end',
201
+ 'error',
202
+ 'EX_LOW',
203
+ 'OTHER',
204
+ 'EX_HIGH',
205
+ 'EM_OPEN',
206
+ 'EM_CLOSE',
207
+ 'LINK_START',
208
+ 'LINK_END',
209
+ 'LINK_URI',
210
+ 'ST_OPEN',
211
+ 'ST_CLOSE',
212
+ 'QUOTE',
213
+ 'FN_LINK',
214
+ 'FN_START',
215
+ 'FN_END',
216
+ 'IT_OPEN',
217
+ 'IT_CLOSE',
218
+ 'UL_OPEN',
219
+ 'UL_CLOSE',
220
+ 'VERB_OPEN',
221
+ 'VERB_CLOSE',
222
+ 'CODE_OPEN',
223
+ 'CODE_CLOSE',
224
+ 'EOL',
225
+ '$start',
226
+ 'content',
227
+ 'elements',
228
+ 'element',
229
+ 'emphasis',
230
+ 'italic',
231
+ 'under_line',
232
+ 'code',
233
+ 'strike',
234
+ 'verb',
235
+ 'normal_string_element',
236
+ 'link',
237
+ 'quote',
238
+ 'fn_link',
239
+ 'fn_define',
240
+ 'normal_strings',
241
+ 'link_descs',
242
+ 'link_desc']
243
+
244
+ Racc_debug_parser = false
245
+
246
+ ##### racc system variables end #####
247
+
248
+ # reduce 0 omitted
249
+
250
+ # reduce 1 omitted
251
+
252
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 18
253
+ def _reduce_2( val, _values, result )
254
+ result << val[1]
255
+ result
256
+ end
257
+ .,.,
258
+
259
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 19
260
+ def _reduce_3( val, _values, result )
261
+ result = val
262
+ result
263
+ end
264
+ .,.,
265
+
266
+ # reduce 4 omitted
267
+
268
+ # reduce 5 omitted
269
+
270
+ # reduce 6 omitted
271
+
272
+ # reduce 7 omitted
273
+
274
+ # reduce 8 omitted
275
+
276
+ # reduce 9 omitted
277
+
278
+ # reduce 10 omitted
279
+
280
+ # reduce 11 omitted
281
+
282
+ # reduce 12 omitted
283
+
284
+ # reduce 13 omitted
285
+
286
+ # reduce 14 omitted
287
+
288
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 33
289
+ def _reduce_15( val, _values, result )
290
+ result = Node.new(:FN_LINK, [], val[0])
291
+ result
292
+ end
293
+ .,.,
294
+
295
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 36
296
+ def _reduce_16( val, _values, result )
297
+ result = Node.new(:FN_DEFINE, val[1], val[0])
298
+ result
299
+ end
300
+ .,.,
301
+
302
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 39
303
+ def _reduce_17( val, _values, result )
304
+ result = Node.new(:EMPHASIS, val[1])
305
+ result
306
+ end
307
+ .,.,
308
+
309
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 42
310
+ def _reduce_18( val, _values, result )
311
+ result = Node.new(:ITALIC, val[1])
312
+ result
313
+ end
314
+ .,.,
315
+
316
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 45
317
+ def _reduce_19( val, _values, result )
318
+ result = Node.new(:UNDER_LINE, val[1])
319
+ result
320
+ end
321
+ .,.,
322
+
323
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 48
324
+ def _reduce_20( val, _values, result )
325
+ result = Node.new(:CODE, val[1])
326
+ result
327
+ end
328
+ .,.,
329
+
330
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 51
331
+ def _reduce_21( val, _values, result )
332
+ result = Node.new(:VERBATIM, val[1])
333
+ result
334
+ end
335
+ .,.,
336
+
337
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 54
338
+ def _reduce_22( val, _values, result )
339
+ result = Node.new(:STRIKE_THROUGH, val[1])
340
+ result
341
+ end
342
+ .,.,
343
+
344
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 56
345
+ def _reduce_23( val, _values, result )
346
+ result << val[1]
347
+ result
348
+ end
349
+ .,.,
350
+
351
+ # reduce 24 omitted
352
+
353
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 59
354
+ def _reduce_25( val, _values, result )
355
+ result = Node.new(:QUOTE, [], val[0])
356
+ result
357
+ end
358
+ .,.,
359
+
360
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 62
361
+ def _reduce_26( val, _values, result )
362
+ result = Node.new(:STRING, [], val[0])
363
+ result
364
+ end
365
+ .,.,
366
+
367
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 64
368
+ def _reduce_27( val, _values, result )
369
+ result << val[1]
370
+ result
371
+ end
372
+ .,.,
373
+
374
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 65
375
+ def _reduce_28( val, _values, result )
376
+ result = val
377
+ result
378
+ end
379
+ .,.,
380
+
381
+ # reduce 29 omitted
382
+
383
+ # reduce 30 omitted
384
+
385
+ # reduce 31 omitted
386
+
387
+ # reduce 32 omitted
388
+
389
+ # reduce 33 omitted
390
+
391
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 73
392
+ def _reduce_34( val, _values, result )
393
+ result = LinkNode.new(val[0], val[1], @structp.variables)
394
+ result
395
+ end
396
+ .,.,
397
+
398
+ module_eval <<'.,.,', 'lib/org-parse/inline-parser.ry', 74
399
+ def _reduce_35( val, _values, result )
400
+ result = LinkNode.new(val[0], [], @structp.variables)
401
+ result
402
+ end
403
+ .,.,
404
+
405
+ def _reduce_none( val, _values, result )
406
+ result
407
+ end
408
+
409
+ end # class InlineParser
410
+
411
+ end # module OrgParse