appswarm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +124 -0
- data/History.txt +7 -0
- data/Manifest.txt +304 -0
- data/README.txt +373 -0
- data/Rakefile +153 -0
- data/TODO +7 -0
- data/apps/README.txt +17 -0
- data/apps/admin/admin.rb +79 -0
- data/apps/admin/controllers/admin.rb +81 -0
- data/apps/admin/controllers/settings.rb +63 -0
- data/apps/admin/controllers/users.rb +3 -0
- data/apps/admin/features/access.feature +21 -0
- data/apps/admin/features/mountLocal.feature +12 -0
- data/apps/admin/features/settings.feature +68 -0
- data/apps/admin/features/startApps.feature +27 -0
- data/apps/admin/layouts/main.rhtml +10 -0
- data/apps/admin/lib/settings.rb +52 -0
- data/apps/admin/static/admin.css +23 -0
- data/apps/admin/views/_log.rhtml +21 -0
- data/apps/admin/views/index.rhtml +43 -0
- data/apps/admin/views/info.rhtml +7 -0
- data/apps/admin/views/settings.rhtml +9 -0
- data/apps/admin/views/settings/_http_app.rhtml +15 -0
- data/apps/admin/views/settings/_web_server.rhtml +32 -0
- data/apps/admin/views/settings/index.rhtml +3 -0
- data/apps/admin/views/users/index.rhtml +6 -0
- data/apps/application_provider/application_provider.rb +11 -0
- data/apps/blog/blog.rb +27 -0
- data/apps/blog/controllers/blog.rb +29 -0
- data/apps/blog/views/index.rhtml +27 -0
- data/apps/browser_starter/browser_starter.rb +32 -0
- data/apps/crypto/crypto.rb +47 -0
- data/apps/crypto/crypto_rsa.rb +102 -0
- data/apps/crypto/spec/crypto_spec.rb +10 -0
- data/apps/directory_service/directory_service.rb +107 -0
- data/apps/directory_service/net_application.rb +92 -0
- data/apps/directory_service/spec/directory_service_spec.rb +36 -0
- data/apps/directory_service/spec/net_application_spec.rb +3 -0
- data/apps/global_application_interface/global_application.rb +52 -0
- data/apps/global_application_interface/global_application_interface.rb +84 -0
- data/apps/global_application_interface/spec/app_api_spec.rb +5 -0
- data/apps/global_tuple_space/global_tuple_space.rb +27 -0
- data/apps/global_web_proxy/features/session_handling.feature +7 -0
- data/apps/global_web_proxy/global_web_proxy.rb +221 -0
- data/apps/global_web_proxy/proxy/HTTPProxyServer-Dateien/rdoc-style.css +208 -0
- data/apps/global_web_proxy/proxy/HTTPProxyServer.html +566 -0
- data/apps/global_web_proxy/proxy/dnstest.rb +30 -0
- data/apps/global_web_proxy/proxy/proxy.rb +86 -0
- data/apps/global_web_proxy/proxy/wiki.html +267 -0
- data/apps/global_web_proxy/proxy/wiki.rb +115 -0
- data/apps/global_web_proxy/spec/res1 +112 -0
- data/apps/global_web_proxy/spec/res2 +125 -0
- data/apps/global_web_proxy/spec/web_proxy_spec.rb +88 -0
- data/apps/global_web_server/global_web_server.rb +120 -0
- data/apps/global_web_server/global_web_servlet.rb +6 -0
- data/apps/hello_world/controllers/hello_world.rb +11 -0
- data/apps/hello_world/features/show_on_local_web_server.feature +44 -0
- data/apps/hello_world/features/starting_apps.feature +6 -0
- data/apps/hello_world/features/through_global.feature +12 -0
- data/apps/hello_world/hello_world.rb +3 -0
- data/apps/hello_world/views/get.rhtml +10 -0
- data/apps/hello_world/views/index.rhtml +9 -0
- data/apps/hello_world/views/post.rhtml +10 -0
- data/apps/home/controllers/home.rb +11 -0
- data/apps/home/home.rb +12 -0
- data/apps/home/layouts/main.rhtml +16 -0
- data/apps/home/static/Zeichnung.svg +240 -0
- data/apps/home/static/home.css +134 -0
- data/apps/home/static/menu.css +99 -0
- data/apps/home/views/_appInfo.rhtml +22 -0
- data/apps/home/views/_dummy_fill.rhtml +3 -0
- data/apps/home/views/_info.rhtml +6 -0
- data/apps/home/views/_menu.rhtml +17 -0
- data/apps/home/views/index.rhtml +4 -0
- data/apps/home/views/overview.rhtml +2 -0
- data/apps/local_chunk_store/chunk_store.rb +15 -0
- data/apps/local_chunk_store/local_chunk_store.rb +123 -0
- data/apps/local_chunk_store/spec/local_chunk_store_spec.rb +30 -0
- data/apps/local_file_store/app_configuration.rb +78 -0
- data/apps/local_file_store/app_file_store.rb +32 -0
- data/apps/local_file_store/cached_file_store.rb +94 -0
- data/apps/local_file_store/features/testbed_handling_of_directories.feature +20 -0
- data/apps/local_file_store/local_file_store.rb +47 -0
- data/apps/local_file_store/spec/app_configuration_spec.rb +30 -0
- data/apps/local_file_store/spec/local_file_store_spec.rb +54 -0
- data/apps/local_object_storage/lib/cell.rb +29 -0
- data/apps/local_object_storage/lib/cellmgr.rb +57 -0
- data/apps/local_object_storage/lib/index.rb +43 -0
- data/apps/local_object_storage/lib/marshal.rb +96 -0
- data/apps/local_object_storage/lib/pagefile.rb +6 -0
- data/apps/local_object_storage/lib/persistent_object.rb +126 -0
- data/apps/local_object_storage/local_object_storage.rb +148 -0
- data/apps/local_object_storage/spec/local_object_storage_spec.rb +123 -0
- data/apps/local_secure_file_store/local_secure_file_store.rb +64 -0
- data/apps/local_secure_file_store/spec/local_secure_file_store_spec.rb +23 -0
- data/apps/local_tuple_space/local_tuple_space.rb +92 -0
- data/apps/local_tuple_space/spec/tuple_space_spec.rb +25 -0
- data/apps/local_web_server/features/parsing_args.feature +18 -0
- data/apps/local_web_server/local_web_server.rb +166 -0
- data/apps/logger/logger.rb +27 -0
- data/apps/master/master.rb +46 -0
- data/apps/master/spec/master_spec.rb +31 -0
- data/apps/my_spec_spec.rb +15 -0
- data/apps/name_service/name_service.rb +75 -0
- data/apps/name_service/spec/name_service_spec.rb +51 -0
- data/apps/network_discovery/network_discovery.rb +45 -0
- data/apps/network_discovery_localstore/network_discovery_localstore.rb +20 -0
- data/apps/network_discovery_udp/network_discovery_udp.rb +51 -0
- data/apps/network_lookup/network_lookup.rb +61 -0
- data/apps/network_node/abstract_node.rb +104 -0
- data/apps/network_node/drb_node.rb +90 -0
- data/apps/network_node/network_app.rb +9 -0
- data/apps/network_node/network_node.rb +471 -0
- data/apps/network_node/remote_service.rb +45 -0
- data/apps/network_node/secure_node.rb +125 -0
- data/apps/network_node/spec/drb_spec.rb +41 -0
- data/apps/network_node/spec/network_node_spec_not.rb +264 -0
- data/apps/new_network_node/new_network_node.rb +427 -0
- data/apps/new_network_node/spec/new_network_node_spec.rb +186 -0
- data/apps/node_broadcast/node_broadcast.rb +167 -0
- data/apps/node_broadcast/spec/node_broadcast_spec.rb +59 -0
- data/apps/permaspace/permaspace.rb +47 -0
- data/apps/plaindb/lib/btree.rb +38 -0
- data/apps/plaindb/plaindb.rb +199 -0
- data/apps/plaindb/spec/table_write_spec.rb +36 -0
- data/apps/routed_network/routed_network.rb +23 -0
- data/apps/routed_network/spec/routed_network_spec.rb +17 -0
- data/apps/session_manager/session_manager.rb +18 -0
- data/apps/spec_output.html +222 -0
- data/apps/todo/controllers/todo.rb +87 -0
- data/apps/todo/model/comment.rb +10 -0
- data/apps/todo/model/project.rb +20 -0
- data/apps/todo/model/todo.rb +16 -0
- data/apps/todo/model/user.rb +5 -0
- data/apps/todo/todo.rb +21 -0
- data/apps/todo/views/_commentList.rhtml +7 -0
- data/apps/todo/views/_createProject.rhtml +5 -0
- data/apps/todo/views/_partList.rhtml +12 -0
- data/apps/todo/views/_projectList.rhtml +16 -0
- data/apps/todo/views/edit.rhtml +11 -0
- data/apps/todo/views/editPart.rhtml +10 -0
- data/apps/todo/views/index.rhtml +2 -0
- data/apps/todo/views/question.rhtml +4 -0
- data/apps/transparent_network/transparent_network.rb +7 -0
- data/apps/udp_network/big_transfer.rb +97 -0
- data/apps/udp_network/features/information.feature +7 -0
- data/apps/udp_network/message_queue.rb +84 -0
- data/apps/udp_network/network_interface_api.rb +39 -0
- data/apps/udp_network/qos_queue.rb +186 -0
- data/apps/udp_network/simple_api.rb +180 -0
- data/apps/udp_network/spec/big_transfer_spec.rb +0 -0
- data/apps/udp_network/spec/qos_queue_spec.rb +99 -0
- data/apps/udp_network/spec/simple_api_spec.rb +35 -0
- data/apps/udp_network/spec/udp_network_spec.rb +115 -0
- data/apps/udp_network/spec/udp_transceiver_spec.rb +90 -0
- data/apps/udp_network/udp_network.rb +196 -0
- data/apps/udp_network/udp_transceiver.rb +329 -0
- data/apps/wiki/controllers/wiki.rb +56 -0
- data/apps/wiki/features/editing.feature +21 -0
- data/apps/wiki/layouts/main.rhtml +18 -0
- data/apps/wiki/lib/media_wiki_html.rb +35 -0
- data/apps/wiki/lib/wikicreole.rb +2147 -0
- data/apps/wiki/lib/wikicreole.tt +135 -0
- data/apps/wiki/lib/wikitest.rb +158 -0
- data/apps/wiki/lib/wikitest.tt +17 -0
- data/apps/wiki/model/menu.rb +15 -0
- data/apps/wiki/model/page.rb +31 -0
- data/apps/wiki/spec/wiki_creole_spec.rb +20 -0
- data/apps/wiki/spec/wiki_spec.rb +19 -0
- data/apps/wiki/static/Zeichnung.svg +240 -0
- data/apps/wiki/static/home.css +134 -0
- data/apps/wiki/static/mainMenu.css +32 -0
- data/apps/wiki/static/menu.css +99 -0
- data/apps/wiki/views/_mainMenu.rhtml +3 -0
- data/apps/wiki/views/_menu.rhtml +13 -0
- data/apps/wiki/views/edit.rhtml +13 -0
- data/apps/wiki/views/index.rhtml +2 -0
- data/apps/wiki/views/save.rhtml +1 -0
- data/apps/wiki/wiki.rb +17 -0
- data/bin/appswarm +47 -0
- data/cucumber.yml +2 -0
- data/data/PermaspaceApp/AFS_WikiApp_wiki_config +6 -0
- data/data/draft.txt +63 -0
- data/docs/appswarm_motivation.graffle +0 -0
- data/docs/appswarm_pics.graffle/QuickLook/Preview.pdf +0 -0
- data/docs/appswarm_pics.graffle/QuickLook/Thumbnail.tiff +0 -0
- data/docs/appswarm_pics.graffle/data.plist +63494 -0
- data/docs/appswarm_pics.graffle/image1.tiff +0 -0
- data/docs/appswarm_pics.graffle/image2.tif +0 -0
- data/docs/appswarm_pics.graffle/image3.tif +0 -0
- data/docs/appswarm_pics.graffle/image4.tif +0 -0
- data/docs/appswarm_pics.graffle/image5.tiff +0 -0
- data/docs/routing.graffle +0 -0
- data/features/step_definitions/appstart_steps.rb +28 -0
- data/features/step_definitions/cluster_steps.rb +18 -0
- data/features/step_definitions/testbed_steps.rb +64 -0
- data/features/step_definitions/webapp_steps.rb +257 -0
- data/features/support/env.rb +7 -0
- data/lib/appswarm.rb +127 -0
- data/lib/appswarm/README.txt +67 -0
- data/lib/appswarm/app_config.rb +19 -0
- data/lib/appswarm/application.rb +267 -0
- data/lib/appswarm/breaking_mutex.rb +41 -0
- data/lib/appswarm/cluster_funcs.rb +157 -0
- data/lib/appswarm/cross_spectool.rb +153 -0
- data/lib/appswarm/crypt.rb +10 -0
- data/lib/appswarm/crypt/crypto.rb +90 -0
- data/lib/appswarm/crypt/rsa_key +15 -0
- data/lib/appswarm/crypt/rsa_key.pub +5 -0
- data/lib/appswarm/crypt/test.rb +27 -0
- data/lib/appswarm/dir_tool.rb +41 -0
- data/lib/appswarm/event_api.rb +7 -0
- data/lib/appswarm/features_helper.rb +44 -0
- data/lib/appswarm/global_service.rb +38 -0
- data/lib/appswarm/http.rb +1 -0
- data/lib/appswarm/http/http_app.rb +257 -0
- data/lib/appswarm/http/http_controller.rb +267 -0
- data/lib/appswarm/http/http_provider.rb +80 -0
- data/lib/appswarm/http/static/favicon.ico +0 -0
- data/lib/appswarm/http/static/javascript/._prototype.js +0 -0
- data/lib/appswarm/http/static/javascript/prototype.js +2515 -0
- data/lib/appswarm/http/webrick_logger.rb +12 -0
- data/lib/appswarm/net_service.rb +69 -0
- data/lib/appswarm/package.rb +88 -0
- data/lib/appswarm/parallel_each.rb +46 -0
- data/lib/appswarm/protocols/protocol_dice.rb +25 -0
- data/lib/appswarm/proxy_testing.rb +48 -0
- data/lib/appswarm/public_api.rb +35 -0
- data/lib/appswarm/routing/matrix_math.rb +57 -0
- data/lib/appswarm/routing/pca.rb +211 -0
- data/lib/appswarm/routing/routetest.rb +85 -0
- data/lib/appswarm/routing/routing.rb +326 -0
- data/lib/appswarm/routing/spec/nods_spec.rb +23 -0
- data/lib/appswarm/routing/spec/pca_spec.rb +27 -0
- data/lib/appswarm/routing/spec/routing_spec.rb +91 -0
- data/lib/appswarm/secure_con.rb +437 -0
- data/lib/appswarm/secure_connection.rb +79 -0
- data/lib/appswarm/secure_marshal.rb +137 -0
- data/lib/appswarm/service.rb +76 -0
- data/lib/appswarm/simple_marshal.rb +96 -0
- data/lib/appswarm/simple_marshal_parser.rb +1243 -0
- data/lib/appswarm/simple_marshal_parser.tt +158 -0
- data/lib/appswarm/spec/application_spec.rb +50 -0
- data/lib/appswarm/spec/cluster_spec.rb +2 -0
- data/lib/appswarm/spec/hexdist_spec.rb +13 -0
- data/lib/appswarm/spec/http_controller_spec.rb +18 -0
- data/lib/appswarm/spec/main_spec.rb +6 -0
- data/lib/appswarm/spec/parallel_each_spec.rb +30 -0
- data/lib/appswarm/spec/secure_connection_spec.rb +108 -0
- data/lib/appswarm/spec/secure_marshal_spec.rb +93 -0
- data/lib/appswarm/spec/simple_marshal_spec.rb +87 -0
- data/lib/appswarm/spec/tools_spec.rb +13 -0
- data/lib/appswarm/spec/whiteboard_spec.rb +20 -0
- data/lib/appswarm/spec_helper.rb +18 -0
- data/lib/appswarm/test_bed.rb +207 -0
- data/lib/appswarm/tools.rb +284 -0
- data/lib/appswarm/tools/http_tunnel_client.rb +139 -0
- data/lib/appswarm/tools/http_tunnel_common.rb +8 -0
- data/lib/appswarm/tools/http_tunnel_server.rb +78 -0
- data/lib/appswarm/tools/parser/example_data.simple +102 -0
- data/lib/appswarm/tools/parser/match_test.rb +14 -0
- data/lib/appswarm/tools/parser/parser_lib.rb +165 -0
- data/lib/appswarm/tools/parser/parser_test.rb +104 -0
- data/lib/appswarm/tools/parser/spec/parser_spec.rb +44 -0
- data/lib/appswarm/tools/pipes.rb +95 -0
- data/lib/appswarm/tools/spec/tracing_spec.rb +16 -0
- data/lib/appswarm/tools/spec/waiting_queue_spec.rb +15 -0
- data/lib/appswarm/tools/thread_tool.rb +61 -0
- data/lib/appswarm/tools/tracing.rb +84 -0
- data/lib/appswarm/tools/treetop_test.rb +20 -0
- data/lib/appswarm/tools/treetop_test_grammar.rb +114 -0
- data/lib/appswarm/tools/treetop_test_grammar.tt +7 -0
- data/lib/appswarm/tools/waiting_prio_queue.rb +47 -0
- data/lib/appswarm/tools/waiting_queue.rb +34 -0
- data/lib/appswarm/whiteboard.rb +73 -0
- data/nettest.rb +50 -0
- data/packages/README.txt +1 -0
- data/packages/msandbox/data/packages/store/my.txt +1 -0
- data/packages/msandbox/interfaces.rb +172 -0
- data/packages/msandbox/old/defa.rb +3 -0
- data/packages/msandbox/old/test.rb +14 -0
- data/packages/msandbox/old/test2.rb +56 -0
- data/packages/msandbox/package.rb +67 -0
- data/packages/msandbox/packages/store/config.yml +1 -0
- data/packages/msandbox/packages/store/main.rb +27 -0
- data/packages/msandbox/packages/store/myinclude.rb +7 -0
- data/packages/msandbox/packages/store_test/config.yml +1 -0
- data/packages/msandbox/packages/store_test/main.rb +9 -0
- data/packages/msandbox/server.rb +146 -0
- data/packages/msandbox/test.rb +13 -0
- data/packages/msandbox/test2.rb +29 -0
- data/templates/web/appswarm/controllers/appswarm.rb +41 -0
- data/templates/web/appswarm/layouts/main.rhtml +20 -0
- data/templates/web/appswarm/models/asmenu.rb +14 -0
- data/templates/web/appswarm/models/asuser.rb +30 -0
- data/templates/web/appswarm/static/custom.css +15 -0
- data/templates/web/appswarm/static/home.css +134 -0
- data/templates/web/appswarm/static/mainMenu.css +32 -0
- data/templates/web/appswarm/static/menu.css +99 -0
- data/templates/web/appswarm/views/_mainMenu.rhtml +5 -0
- data/templates/web/appswarm/views/_menu.rhtml +13 -0
- data/templates/web/appswarm/views/_userInfo.rhtml +7 -0
- data/templates/web/appswarm/views/login.rhtml +9 -0
- data/tools/checkPort.rb +11 -0
- metadata +379 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'lib/media_wiki_html.rb'
|
2
|
+
require 'model/page.rb'
|
3
|
+
require 'model/menu.rb'
|
4
|
+
|
5
|
+
|
6
|
+
class Wiki<HTTPController
|
7
|
+
layout :main
|
8
|
+
|
9
|
+
def initialize(*s)
|
10
|
+
super
|
11
|
+
@i=WikiModel::Instance.new(@app)
|
12
|
+
end
|
13
|
+
|
14
|
+
def index(req)
|
15
|
+
@req=req
|
16
|
+
page=@i.getPage(path)
|
17
|
+
|
18
|
+
data=page.content
|
19
|
+
if data.nil? or data.length==0
|
20
|
+
log "data is nil - redirect "
|
21
|
+
redirect_to(url(:action=>:edit)+"/"+path)
|
22
|
+
else
|
23
|
+
@wikihtml=appswarm_wiki_to_html(data,url(:action=>:index))
|
24
|
+
end
|
25
|
+
@topic=path
|
26
|
+
|
27
|
+
@menu=Menu.new(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
def edit(req)
|
31
|
+
@req=req
|
32
|
+
page=@i.getPage(path)
|
33
|
+
@topic=path
|
34
|
+
@error=""
|
35
|
+
@wiki=page.content
|
36
|
+
@menu=Menu.new(self)
|
37
|
+
end
|
38
|
+
|
39
|
+
def save(req)
|
40
|
+
@req=req
|
41
|
+
p=req.args["topic"]
|
42
|
+
if p!="" and req.args["content"]!=""
|
43
|
+
page=@i.getPage(p)
|
44
|
+
pp req.args["content"]
|
45
|
+
page.content=req.args["content"]
|
46
|
+
end
|
47
|
+
redirect_to(url(:action=>:index)+"/"+p)
|
48
|
+
end
|
49
|
+
|
50
|
+
def path
|
51
|
+
path=@req.path.to_s
|
52
|
+
path=nil if path.length==0
|
53
|
+
path||="Home"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Edit wiki pages
|
2
|
+
@wiki
|
3
|
+
|
4
|
+
Scenario: An newly created wiki sends you the edit-page of index
|
5
|
+
Given a testbed with a "LocalWebServer" application
|
6
|
+
And a "Wiki" application in it
|
7
|
+
And I create a "default" instance on the "Wiki" http-application
|
8
|
+
When the "default" instance of "Wiki" is offered on path "/" on the "LocalWebServer" application
|
9
|
+
And a client accesses the "LocalWebServer" on "/"
|
10
|
+
Then the resulting html page contains "Editing Page"
|
11
|
+
When I enter text "My main page has some content" into "content"
|
12
|
+
And I click "save"
|
13
|
+
Then the resulting html page contains "My main page has some content"
|
14
|
+
|
15
|
+
|
16
|
+
Scenario:
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<%=css("home")%>
|
4
|
+
<%=css("menu")%>
|
5
|
+
<%=css("mainMenu")%>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div id="AppSwarmBanner">
|
9
|
+
<div id="Box">Version 0.1</div>
|
10
|
+
<div id="Text">AppSwarm</div>
|
11
|
+
</div>
|
12
|
+
<%= render_partial(:mainMenu) %>
|
13
|
+
<%= render_partial(:menu)%>
|
14
|
+
<div id="Content">
|
15
|
+
<%=content%>
|
16
|
+
</div>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class AppSwarmWikiLinkHandler
|
2
|
+
def initialize(baseurl)
|
3
|
+
@baseurl=baseurl
|
4
|
+
end
|
5
|
+
def url_for(resource)
|
6
|
+
@baseurl+"/"+resource
|
7
|
+
end
|
8
|
+
|
9
|
+
#Method invoked to resolve references to resources of unknown types. The
|
10
|
+
#type is indicated by the resource prefix. Examples of inline links to
|
11
|
+
#unknown references include:
|
12
|
+
#* <tt>[[Media:video.mpg]]</tt> (prefix <tt>Media</tt>, resource <tt>video.mpg</tt>)
|
13
|
+
#* <tt>[[Image:pretty.png|100px|A ''pretty'' picture]]</tt> (prefix <tt>Image</tt>,
|
14
|
+
# resource <tt>pretty.png</tt>, and options <tt>100px</tt> and <tt>A
|
15
|
+
# <i>pretty</i> picture</tt>.
|
16
|
+
#The return value should be a well-formed hyperlink, image, object or
|
17
|
+
#applet tag.
|
18
|
+
def link_for(prefix, resource, options=[])
|
19
|
+
"<a href=\"javascript:void(0)\">#{prefix}:#{resource}(#{options.join(', ')})</a>"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def appswarm_wiki_to_html(wiki,baseurl)
|
25
|
+
parser = MediaWikiParser.new
|
26
|
+
parser.lexer = MediaWikiLexer.new
|
27
|
+
ast = parser.parse(wiki)
|
28
|
+
walker = MediaWikiHTMLGenerator.new
|
29
|
+
|
30
|
+
walker.link_handler=AppSwarmWikiLinkHandler.new(baseurl)
|
31
|
+
|
32
|
+
walker.parse(ast)
|
33
|
+
walker.html
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,2147 @@
|
|
1
|
+
module WikiCreole
|
2
|
+
include Treetop::Runtime
|
3
|
+
|
4
|
+
def root
|
5
|
+
@root || :Page
|
6
|
+
end
|
7
|
+
|
8
|
+
def _nt_Page
|
9
|
+
start_index = index
|
10
|
+
if node_cache[:Page].has_key?(index)
|
11
|
+
cached = node_cache[:Page][index]
|
12
|
+
@index = cached.interval.end if cached
|
13
|
+
return cached
|
14
|
+
end
|
15
|
+
|
16
|
+
s0, i0 = [], index
|
17
|
+
loop do
|
18
|
+
r1 = _nt_Block
|
19
|
+
if r1
|
20
|
+
s0 << r1
|
21
|
+
else
|
22
|
+
break
|
23
|
+
end
|
24
|
+
end
|
25
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
26
|
+
|
27
|
+
node_cache[:Page][start_index] = r0
|
28
|
+
|
29
|
+
return r0
|
30
|
+
end
|
31
|
+
|
32
|
+
def _nt_Block
|
33
|
+
start_index = index
|
34
|
+
if node_cache[:Block].has_key?(index)
|
35
|
+
cached = node_cache[:Block][index]
|
36
|
+
@index = cached.interval.end if cached
|
37
|
+
return cached
|
38
|
+
end
|
39
|
+
|
40
|
+
i0 = index
|
41
|
+
r1 = _nt_Heading
|
42
|
+
if r1
|
43
|
+
r0 = r1
|
44
|
+
else
|
45
|
+
r2 = _nt_Paragraph
|
46
|
+
if r2
|
47
|
+
r0 = r2
|
48
|
+
else
|
49
|
+
r3 = _nt_List
|
50
|
+
if r3
|
51
|
+
r0 = r3
|
52
|
+
else
|
53
|
+
r4 = _nt_Preformatted
|
54
|
+
if r4
|
55
|
+
r0 = r4
|
56
|
+
else
|
57
|
+
r5 = _nt_HorizontalLine
|
58
|
+
if r5
|
59
|
+
r0 = r5
|
60
|
+
else
|
61
|
+
r6 = _nt_EmptyLine
|
62
|
+
if r6
|
63
|
+
r0 = r6
|
64
|
+
else
|
65
|
+
self.index = i0
|
66
|
+
r0 = nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
node_cache[:Block][start_index] = r0
|
75
|
+
|
76
|
+
return r0
|
77
|
+
end
|
78
|
+
|
79
|
+
module EmptyLine0
|
80
|
+
def LineEnd
|
81
|
+
elements[1]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def _nt_EmptyLine
|
86
|
+
start_index = index
|
87
|
+
if node_cache[:EmptyLine].has_key?(index)
|
88
|
+
cached = node_cache[:EmptyLine][index]
|
89
|
+
@index = cached.interval.end if cached
|
90
|
+
return cached
|
91
|
+
end
|
92
|
+
|
93
|
+
i0, s0 = index, []
|
94
|
+
s1, i1 = [], index
|
95
|
+
loop do
|
96
|
+
r2 = _nt_Whitespace
|
97
|
+
if r2
|
98
|
+
s1 << r2
|
99
|
+
else
|
100
|
+
break
|
101
|
+
end
|
102
|
+
end
|
103
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
104
|
+
s0 << r1
|
105
|
+
if r1
|
106
|
+
r3 = _nt_LineEnd
|
107
|
+
s0 << r3
|
108
|
+
end
|
109
|
+
if s0.last
|
110
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
111
|
+
r0.extend(EmptyLine0)
|
112
|
+
else
|
113
|
+
self.index = i0
|
114
|
+
r0 = nil
|
115
|
+
end
|
116
|
+
|
117
|
+
node_cache[:EmptyLine][start_index] = r0
|
118
|
+
|
119
|
+
return r0
|
120
|
+
end
|
121
|
+
|
122
|
+
module HorizontalLine0
|
123
|
+
def LineEnd
|
124
|
+
elements[3]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def _nt_HorizontalLine
|
129
|
+
start_index = index
|
130
|
+
if node_cache[:HorizontalLine].has_key?(index)
|
131
|
+
cached = node_cache[:HorizontalLine][index]
|
132
|
+
@index = cached.interval.end if cached
|
133
|
+
return cached
|
134
|
+
end
|
135
|
+
|
136
|
+
i0, s0 = index, []
|
137
|
+
if input.index("----", index) == index
|
138
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
139
|
+
@index += 4
|
140
|
+
else
|
141
|
+
terminal_parse_failure("----")
|
142
|
+
r1 = nil
|
143
|
+
end
|
144
|
+
s0 << r1
|
145
|
+
if r1
|
146
|
+
s2, i2 = [], index
|
147
|
+
loop do
|
148
|
+
if input.index("-", index) == index
|
149
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
150
|
+
@index += 1
|
151
|
+
else
|
152
|
+
terminal_parse_failure("-")
|
153
|
+
r3 = nil
|
154
|
+
end
|
155
|
+
if r3
|
156
|
+
s2 << r3
|
157
|
+
else
|
158
|
+
break
|
159
|
+
end
|
160
|
+
end
|
161
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
162
|
+
s0 << r2
|
163
|
+
if r2
|
164
|
+
s4, i4 = [], index
|
165
|
+
loop do
|
166
|
+
r5 = _nt_Whitespace
|
167
|
+
if r5
|
168
|
+
s4 << r5
|
169
|
+
else
|
170
|
+
break
|
171
|
+
end
|
172
|
+
end
|
173
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
174
|
+
s0 << r4
|
175
|
+
if r4
|
176
|
+
r6 = _nt_LineEnd
|
177
|
+
s0 << r6
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
if s0.last
|
182
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
183
|
+
r0.extend(HorizontalLine0)
|
184
|
+
else
|
185
|
+
self.index = i0
|
186
|
+
r0 = nil
|
187
|
+
end
|
188
|
+
|
189
|
+
node_cache[:HorizontalLine][start_index] = r0
|
190
|
+
|
191
|
+
return r0
|
192
|
+
end
|
193
|
+
|
194
|
+
def _nt_Heading
|
195
|
+
start_index = index
|
196
|
+
if node_cache[:Heading].has_key?(index)
|
197
|
+
cached = node_cache[:Heading][index]
|
198
|
+
@index = cached.interval.end if cached
|
199
|
+
return cached
|
200
|
+
end
|
201
|
+
|
202
|
+
i0 = index
|
203
|
+
r1 = _nt_Heading3
|
204
|
+
if r1
|
205
|
+
r0 = r1
|
206
|
+
else
|
207
|
+
r2 = _nt_Heading2
|
208
|
+
if r2
|
209
|
+
r0 = r2
|
210
|
+
else
|
211
|
+
r3 = _nt_Heading1
|
212
|
+
if r3
|
213
|
+
r0 = r3
|
214
|
+
else
|
215
|
+
self.index = i0
|
216
|
+
r0 = nil
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
node_cache[:Heading][start_index] = r0
|
222
|
+
|
223
|
+
return r0
|
224
|
+
end
|
225
|
+
|
226
|
+
module Heading10
|
227
|
+
def HeadingText
|
228
|
+
elements[2]
|
229
|
+
end
|
230
|
+
|
231
|
+
def LineEnd
|
232
|
+
elements[6]
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def _nt_Heading1
|
237
|
+
start_index = index
|
238
|
+
if node_cache[:Heading1].has_key?(index)
|
239
|
+
cached = node_cache[:Heading1][index]
|
240
|
+
@index = cached.interval.end if cached
|
241
|
+
return cached
|
242
|
+
end
|
243
|
+
|
244
|
+
i0, s0 = index, []
|
245
|
+
if input.index('==', index) == index
|
246
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
247
|
+
@index += 2
|
248
|
+
else
|
249
|
+
terminal_parse_failure('==')
|
250
|
+
r1 = nil
|
251
|
+
end
|
252
|
+
s0 << r1
|
253
|
+
if r1
|
254
|
+
s2, i2 = [], index
|
255
|
+
loop do
|
256
|
+
r3 = _nt_Whitespace
|
257
|
+
if r3
|
258
|
+
s2 << r3
|
259
|
+
else
|
260
|
+
break
|
261
|
+
end
|
262
|
+
end
|
263
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
264
|
+
s0 << r2
|
265
|
+
if r2
|
266
|
+
r4 = _nt_HeadingText
|
267
|
+
s0 << r4
|
268
|
+
if r4
|
269
|
+
s5, i5 = [], index
|
270
|
+
loop do
|
271
|
+
r6 = _nt_Whitespace
|
272
|
+
if r6
|
273
|
+
s5 << r6
|
274
|
+
else
|
275
|
+
break
|
276
|
+
end
|
277
|
+
end
|
278
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
279
|
+
s0 << r5
|
280
|
+
if r5
|
281
|
+
s7, i7 = [], index
|
282
|
+
loop do
|
283
|
+
if input.index('=', index) == index
|
284
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
285
|
+
@index += 1
|
286
|
+
else
|
287
|
+
terminal_parse_failure('=')
|
288
|
+
r8 = nil
|
289
|
+
end
|
290
|
+
if r8
|
291
|
+
s7 << r8
|
292
|
+
else
|
293
|
+
break
|
294
|
+
end
|
295
|
+
end
|
296
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
297
|
+
s0 << r7
|
298
|
+
if r7
|
299
|
+
s9, i9 = [], index
|
300
|
+
loop do
|
301
|
+
r10 = _nt_Whitespace
|
302
|
+
if r10
|
303
|
+
s9 << r10
|
304
|
+
else
|
305
|
+
break
|
306
|
+
end
|
307
|
+
end
|
308
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
309
|
+
s0 << r9
|
310
|
+
if r9
|
311
|
+
r11 = _nt_LineEnd
|
312
|
+
s0 << r11
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
if s0.last
|
320
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
321
|
+
r0.extend(Heading10)
|
322
|
+
else
|
323
|
+
self.index = i0
|
324
|
+
r0 = nil
|
325
|
+
end
|
326
|
+
|
327
|
+
node_cache[:Heading1][start_index] = r0
|
328
|
+
|
329
|
+
return r0
|
330
|
+
end
|
331
|
+
|
332
|
+
module Heading20
|
333
|
+
def HeadingText
|
334
|
+
elements[2]
|
335
|
+
end
|
336
|
+
|
337
|
+
def LineEnd
|
338
|
+
elements[6]
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def _nt_Heading2
|
343
|
+
start_index = index
|
344
|
+
if node_cache[:Heading2].has_key?(index)
|
345
|
+
cached = node_cache[:Heading2][index]
|
346
|
+
@index = cached.interval.end if cached
|
347
|
+
return cached
|
348
|
+
end
|
349
|
+
|
350
|
+
i0, s0 = index, []
|
351
|
+
if input.index('===', index) == index
|
352
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
353
|
+
@index += 3
|
354
|
+
else
|
355
|
+
terminal_parse_failure('===')
|
356
|
+
r1 = nil
|
357
|
+
end
|
358
|
+
s0 << r1
|
359
|
+
if r1
|
360
|
+
s2, i2 = [], index
|
361
|
+
loop do
|
362
|
+
r3 = _nt_Whitespace
|
363
|
+
if r3
|
364
|
+
s2 << r3
|
365
|
+
else
|
366
|
+
break
|
367
|
+
end
|
368
|
+
end
|
369
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
370
|
+
s0 << r2
|
371
|
+
if r2
|
372
|
+
r4 = _nt_HeadingText
|
373
|
+
s0 << r4
|
374
|
+
if r4
|
375
|
+
s5, i5 = [], index
|
376
|
+
loop do
|
377
|
+
r6 = _nt_Whitespace
|
378
|
+
if r6
|
379
|
+
s5 << r6
|
380
|
+
else
|
381
|
+
break
|
382
|
+
end
|
383
|
+
end
|
384
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
385
|
+
s0 << r5
|
386
|
+
if r5
|
387
|
+
s7, i7 = [], index
|
388
|
+
loop do
|
389
|
+
if input.index('=', index) == index
|
390
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
391
|
+
@index += 1
|
392
|
+
else
|
393
|
+
terminal_parse_failure('=')
|
394
|
+
r8 = nil
|
395
|
+
end
|
396
|
+
if r8
|
397
|
+
s7 << r8
|
398
|
+
else
|
399
|
+
break
|
400
|
+
end
|
401
|
+
end
|
402
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
403
|
+
s0 << r7
|
404
|
+
if r7
|
405
|
+
s9, i9 = [], index
|
406
|
+
loop do
|
407
|
+
r10 = _nt_Whitespace
|
408
|
+
if r10
|
409
|
+
s9 << r10
|
410
|
+
else
|
411
|
+
break
|
412
|
+
end
|
413
|
+
end
|
414
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
415
|
+
s0 << r9
|
416
|
+
if r9
|
417
|
+
r11 = _nt_LineEnd
|
418
|
+
s0 << r11
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
if s0.last
|
426
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
427
|
+
r0.extend(Heading20)
|
428
|
+
else
|
429
|
+
self.index = i0
|
430
|
+
r0 = nil
|
431
|
+
end
|
432
|
+
|
433
|
+
node_cache[:Heading2][start_index] = r0
|
434
|
+
|
435
|
+
return r0
|
436
|
+
end
|
437
|
+
|
438
|
+
module Heading30
|
439
|
+
def HeadingText
|
440
|
+
elements[2]
|
441
|
+
end
|
442
|
+
|
443
|
+
def LineEnd
|
444
|
+
elements[6]
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
def _nt_Heading3
|
449
|
+
start_index = index
|
450
|
+
if node_cache[:Heading3].has_key?(index)
|
451
|
+
cached = node_cache[:Heading3][index]
|
452
|
+
@index = cached.interval.end if cached
|
453
|
+
return cached
|
454
|
+
end
|
455
|
+
|
456
|
+
i0, s0 = index, []
|
457
|
+
if input.index('====', index) == index
|
458
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
459
|
+
@index += 4
|
460
|
+
else
|
461
|
+
terminal_parse_failure('====')
|
462
|
+
r1 = nil
|
463
|
+
end
|
464
|
+
s0 << r1
|
465
|
+
if r1
|
466
|
+
s2, i2 = [], index
|
467
|
+
loop do
|
468
|
+
r3 = _nt_Whitespace
|
469
|
+
if r3
|
470
|
+
s2 << r3
|
471
|
+
else
|
472
|
+
break
|
473
|
+
end
|
474
|
+
end
|
475
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
476
|
+
s0 << r2
|
477
|
+
if r2
|
478
|
+
r4 = _nt_HeadingText
|
479
|
+
s0 << r4
|
480
|
+
if r4
|
481
|
+
s5, i5 = [], index
|
482
|
+
loop do
|
483
|
+
r6 = _nt_Whitespace
|
484
|
+
if r6
|
485
|
+
s5 << r6
|
486
|
+
else
|
487
|
+
break
|
488
|
+
end
|
489
|
+
end
|
490
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
491
|
+
s0 << r5
|
492
|
+
if r5
|
493
|
+
s7, i7 = [], index
|
494
|
+
loop do
|
495
|
+
if input.index('=', index) == index
|
496
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
497
|
+
@index += 1
|
498
|
+
else
|
499
|
+
terminal_parse_failure('=')
|
500
|
+
r8 = nil
|
501
|
+
end
|
502
|
+
if r8
|
503
|
+
s7 << r8
|
504
|
+
else
|
505
|
+
break
|
506
|
+
end
|
507
|
+
end
|
508
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
509
|
+
s0 << r7
|
510
|
+
if r7
|
511
|
+
s9, i9 = [], index
|
512
|
+
loop do
|
513
|
+
r10 = _nt_Whitespace
|
514
|
+
if r10
|
515
|
+
s9 << r10
|
516
|
+
else
|
517
|
+
break
|
518
|
+
end
|
519
|
+
end
|
520
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
521
|
+
s0 << r9
|
522
|
+
if r9
|
523
|
+
r11 = _nt_LineEnd
|
524
|
+
s0 << r11
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
531
|
+
if s0.last
|
532
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
533
|
+
r0.extend(Heading30)
|
534
|
+
else
|
535
|
+
self.index = i0
|
536
|
+
r0 = nil
|
537
|
+
end
|
538
|
+
|
539
|
+
node_cache[:Heading3][start_index] = r0
|
540
|
+
|
541
|
+
return r0
|
542
|
+
end
|
543
|
+
|
544
|
+
def _nt_HeadingText
|
545
|
+
start_index = index
|
546
|
+
if node_cache[:HeadingText].has_key?(index)
|
547
|
+
cached = node_cache[:HeadingText][index]
|
548
|
+
@index = cached.interval.end if cached
|
549
|
+
return cached
|
550
|
+
end
|
551
|
+
|
552
|
+
s0, i0 = [], index
|
553
|
+
loop do
|
554
|
+
r1 = _nt_TextPart
|
555
|
+
if r1
|
556
|
+
s0 << r1
|
557
|
+
else
|
558
|
+
break
|
559
|
+
end
|
560
|
+
end
|
561
|
+
if s0.empty?
|
562
|
+
self.index = i0
|
563
|
+
r0 = nil
|
564
|
+
else
|
565
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
566
|
+
end
|
567
|
+
|
568
|
+
node_cache[:HeadingText][start_index] = r0
|
569
|
+
|
570
|
+
return r0
|
571
|
+
end
|
572
|
+
|
573
|
+
module Preformatted0
|
574
|
+
def LineEnd
|
575
|
+
elements[2]
|
576
|
+
end
|
577
|
+
|
578
|
+
def LineStart
|
579
|
+
elements[4]
|
580
|
+
end
|
581
|
+
|
582
|
+
def LineEnd
|
583
|
+
elements[8]
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
def _nt_Preformatted
|
588
|
+
start_index = index
|
589
|
+
if node_cache[:Preformatted].has_key?(index)
|
590
|
+
cached = node_cache[:Preformatted][index]
|
591
|
+
@index = cached.interval.end if cached
|
592
|
+
return cached
|
593
|
+
end
|
594
|
+
|
595
|
+
i0, s0 = index, []
|
596
|
+
if input.index('{{{', index) == index
|
597
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
598
|
+
@index += 3
|
599
|
+
else
|
600
|
+
terminal_parse_failure('{{{')
|
601
|
+
r1 = nil
|
602
|
+
end
|
603
|
+
s0 << r1
|
604
|
+
if r1
|
605
|
+
s2, i2 = [], index
|
606
|
+
loop do
|
607
|
+
r3 = _nt_Whitespace
|
608
|
+
if r3
|
609
|
+
s2 << r3
|
610
|
+
else
|
611
|
+
break
|
612
|
+
end
|
613
|
+
end
|
614
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
615
|
+
s0 << r2
|
616
|
+
if r2
|
617
|
+
r4 = _nt_LineEnd
|
618
|
+
s0 << r4
|
619
|
+
if r4
|
620
|
+
s5, i5 = [], index
|
621
|
+
loop do
|
622
|
+
r6 = _nt_PreformattedLine
|
623
|
+
if r6
|
624
|
+
s5 << r6
|
625
|
+
else
|
626
|
+
break
|
627
|
+
end
|
628
|
+
end
|
629
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
630
|
+
s0 << r5
|
631
|
+
if r5
|
632
|
+
r7 = _nt_LineStart
|
633
|
+
s0 << r7
|
634
|
+
if r7
|
635
|
+
s8, i8 = [], index
|
636
|
+
loop do
|
637
|
+
r9 = _nt_Whitespace
|
638
|
+
if r9
|
639
|
+
s8 << r9
|
640
|
+
else
|
641
|
+
break
|
642
|
+
end
|
643
|
+
end
|
644
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
645
|
+
s0 << r8
|
646
|
+
if r8
|
647
|
+
if input.index('}}}', index) == index
|
648
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
649
|
+
@index += 3
|
650
|
+
else
|
651
|
+
terminal_parse_failure('}}}')
|
652
|
+
r10 = nil
|
653
|
+
end
|
654
|
+
s0 << r10
|
655
|
+
if r10
|
656
|
+
s11, i11 = [], index
|
657
|
+
loop do
|
658
|
+
r12 = _nt_Whitespace
|
659
|
+
if r12
|
660
|
+
s11 << r12
|
661
|
+
else
|
662
|
+
break
|
663
|
+
end
|
664
|
+
end
|
665
|
+
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
666
|
+
s0 << r11
|
667
|
+
if r11
|
668
|
+
r13 = _nt_LineEnd
|
669
|
+
s0 << r13
|
670
|
+
end
|
671
|
+
end
|
672
|
+
end
|
673
|
+
end
|
674
|
+
end
|
675
|
+
end
|
676
|
+
end
|
677
|
+
end
|
678
|
+
if s0.last
|
679
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
680
|
+
r0.extend(Preformatted0)
|
681
|
+
else
|
682
|
+
self.index = i0
|
683
|
+
r0 = nil
|
684
|
+
end
|
685
|
+
|
686
|
+
node_cache[:Preformatted][start_index] = r0
|
687
|
+
|
688
|
+
return r0
|
689
|
+
end
|
690
|
+
|
691
|
+
module PreformattedLine0
|
692
|
+
def LineEnd
|
693
|
+
elements[1]
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
def _nt_PreformattedLine
|
698
|
+
start_index = index
|
699
|
+
if node_cache[:PreformattedLine].has_key?(index)
|
700
|
+
cached = node_cache[:PreformattedLine][index]
|
701
|
+
@index = cached.interval.end if cached
|
702
|
+
return cached
|
703
|
+
end
|
704
|
+
|
705
|
+
i0, s0 = index, []
|
706
|
+
s1, i1 = [], index
|
707
|
+
loop do
|
708
|
+
if index < input_length
|
709
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
710
|
+
@index += 1
|
711
|
+
else
|
712
|
+
terminal_parse_failure("any character")
|
713
|
+
r2 = nil
|
714
|
+
end
|
715
|
+
if r2
|
716
|
+
s1 << r2
|
717
|
+
else
|
718
|
+
break
|
719
|
+
end
|
720
|
+
end
|
721
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
722
|
+
s0 << r1
|
723
|
+
if r1
|
724
|
+
r3 = _nt_LineEnd
|
725
|
+
s0 << r3
|
726
|
+
end
|
727
|
+
if s0.last
|
728
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
729
|
+
r0.extend(PreformattedLine0)
|
730
|
+
else
|
731
|
+
self.index = i0
|
732
|
+
r0 = nil
|
733
|
+
end
|
734
|
+
|
735
|
+
node_cache[:PreformattedLine][start_index] = r0
|
736
|
+
|
737
|
+
return r0
|
738
|
+
end
|
739
|
+
|
740
|
+
def _nt_Paragraph
|
741
|
+
start_index = index
|
742
|
+
if node_cache[:Paragraph].has_key?(index)
|
743
|
+
cached = node_cache[:Paragraph][index]
|
744
|
+
@index = cached.interval.end if cached
|
745
|
+
return cached
|
746
|
+
end
|
747
|
+
|
748
|
+
s0, i0 = [], index
|
749
|
+
loop do
|
750
|
+
r1 = _nt_TextLine
|
751
|
+
if r1
|
752
|
+
s0 << r1
|
753
|
+
else
|
754
|
+
break
|
755
|
+
end
|
756
|
+
end
|
757
|
+
if s0.empty?
|
758
|
+
self.index = i0
|
759
|
+
r0 = nil
|
760
|
+
else
|
761
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
762
|
+
end
|
763
|
+
|
764
|
+
node_cache[:Paragraph][start_index] = r0
|
765
|
+
|
766
|
+
return r0
|
767
|
+
end
|
768
|
+
|
769
|
+
module TextLine0
|
770
|
+
def LineEnd
|
771
|
+
elements[2]
|
772
|
+
end
|
773
|
+
end
|
774
|
+
|
775
|
+
def _nt_TextLine
|
776
|
+
start_index = index
|
777
|
+
if node_cache[:TextLine].has_key?(index)
|
778
|
+
cached = node_cache[:TextLine][index]
|
779
|
+
@index = cached.interval.end if cached
|
780
|
+
return cached
|
781
|
+
end
|
782
|
+
|
783
|
+
i0, s0 = index, []
|
784
|
+
i1 = index
|
785
|
+
if input.index('==', index) == index
|
786
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
787
|
+
@index += 2
|
788
|
+
else
|
789
|
+
terminal_parse_failure('==')
|
790
|
+
r2 = nil
|
791
|
+
end
|
792
|
+
if r2
|
793
|
+
r1 = nil
|
794
|
+
else
|
795
|
+
self.index = i1
|
796
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
797
|
+
end
|
798
|
+
s0 << r1
|
799
|
+
if r1
|
800
|
+
s3, i3 = [], index
|
801
|
+
loop do
|
802
|
+
r4 = _nt_TextPart
|
803
|
+
if r4
|
804
|
+
s3 << r4
|
805
|
+
else
|
806
|
+
break
|
807
|
+
end
|
808
|
+
end
|
809
|
+
if s3.empty?
|
810
|
+
self.index = i3
|
811
|
+
r3 = nil
|
812
|
+
else
|
813
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
814
|
+
end
|
815
|
+
s0 << r3
|
816
|
+
if r3
|
817
|
+
r5 = _nt_LineEnd
|
818
|
+
s0 << r5
|
819
|
+
end
|
820
|
+
end
|
821
|
+
if s0.last
|
822
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
823
|
+
r0.extend(TextLine0)
|
824
|
+
else
|
825
|
+
self.index = i0
|
826
|
+
r0 = nil
|
827
|
+
end
|
828
|
+
|
829
|
+
node_cache[:TextLine][start_index] = r0
|
830
|
+
|
831
|
+
return r0
|
832
|
+
end
|
833
|
+
|
834
|
+
def _nt_TextPart
|
835
|
+
start_index = index
|
836
|
+
if node_cache[:TextPart].has_key?(index)
|
837
|
+
cached = node_cache[:TextPart][index]
|
838
|
+
@index = cached.interval.end if cached
|
839
|
+
return cached
|
840
|
+
end
|
841
|
+
|
842
|
+
i0 = index
|
843
|
+
r1 = _nt_PlaceHolder
|
844
|
+
if r1
|
845
|
+
r0 = r1
|
846
|
+
else
|
847
|
+
r2 = _nt_Image
|
848
|
+
if r2
|
849
|
+
r0 = r2
|
850
|
+
else
|
851
|
+
r3 = _nt_Link
|
852
|
+
if r3
|
853
|
+
r0 = r3
|
854
|
+
else
|
855
|
+
r4 = _nt_BoldText
|
856
|
+
if r4
|
857
|
+
r0 = r4
|
858
|
+
else
|
859
|
+
r5 = _nt_ItalicText
|
860
|
+
if r5
|
861
|
+
r0 = r5
|
862
|
+
else
|
863
|
+
r6 = _nt_NormalText
|
864
|
+
if r6
|
865
|
+
r0 = r6
|
866
|
+
else
|
867
|
+
self.index = i0
|
868
|
+
r0 = nil
|
869
|
+
end
|
870
|
+
end
|
871
|
+
end
|
872
|
+
end
|
873
|
+
end
|
874
|
+
end
|
875
|
+
|
876
|
+
node_cache[:TextPart][start_index] = r0
|
877
|
+
|
878
|
+
return r0
|
879
|
+
end
|
880
|
+
|
881
|
+
module ItalicText0
|
882
|
+
end
|
883
|
+
|
884
|
+
def _nt_ItalicText
|
885
|
+
start_index = index
|
886
|
+
if node_cache[:ItalicText].has_key?(index)
|
887
|
+
cached = node_cache[:ItalicText][index]
|
888
|
+
@index = cached.interval.end if cached
|
889
|
+
return cached
|
890
|
+
end
|
891
|
+
|
892
|
+
i0, s0 = index, []
|
893
|
+
if input.index('//', index) == index
|
894
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
895
|
+
@index += 2
|
896
|
+
else
|
897
|
+
terminal_parse_failure('//')
|
898
|
+
r1 = nil
|
899
|
+
end
|
900
|
+
s0 << r1
|
901
|
+
if r1
|
902
|
+
s2, i2 = [], index
|
903
|
+
loop do
|
904
|
+
r3 = _nt_TextPart
|
905
|
+
if r3
|
906
|
+
s2 << r3
|
907
|
+
else
|
908
|
+
break
|
909
|
+
end
|
910
|
+
end
|
911
|
+
if s2.empty?
|
912
|
+
self.index = i2
|
913
|
+
r2 = nil
|
914
|
+
else
|
915
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
916
|
+
end
|
917
|
+
s0 << r2
|
918
|
+
if r2
|
919
|
+
if input.index('//', index) == index
|
920
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
921
|
+
@index += 2
|
922
|
+
else
|
923
|
+
terminal_parse_failure('//')
|
924
|
+
r4 = nil
|
925
|
+
end
|
926
|
+
s0 << r4
|
927
|
+
end
|
928
|
+
end
|
929
|
+
if s0.last
|
930
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
931
|
+
r0.extend(ItalicText0)
|
932
|
+
else
|
933
|
+
self.index = i0
|
934
|
+
r0 = nil
|
935
|
+
end
|
936
|
+
|
937
|
+
node_cache[:ItalicText][start_index] = r0
|
938
|
+
|
939
|
+
return r0
|
940
|
+
end
|
941
|
+
|
942
|
+
module BoldText0
|
943
|
+
end
|
944
|
+
|
945
|
+
def _nt_BoldText
|
946
|
+
start_index = index
|
947
|
+
if node_cache[:BoldText].has_key?(index)
|
948
|
+
cached = node_cache[:BoldText][index]
|
949
|
+
@index = cached.interval.end if cached
|
950
|
+
return cached
|
951
|
+
end
|
952
|
+
|
953
|
+
i0, s0 = index, []
|
954
|
+
if input.index('**', index) == index
|
955
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
956
|
+
@index += 2
|
957
|
+
else
|
958
|
+
terminal_parse_failure('**')
|
959
|
+
r1 = nil
|
960
|
+
end
|
961
|
+
s0 << r1
|
962
|
+
if r1
|
963
|
+
s2, i2 = [], index
|
964
|
+
loop do
|
965
|
+
r3 = _nt_TextPart
|
966
|
+
if r3
|
967
|
+
s2 << r3
|
968
|
+
else
|
969
|
+
break
|
970
|
+
end
|
971
|
+
end
|
972
|
+
if s2.empty?
|
973
|
+
self.index = i2
|
974
|
+
r2 = nil
|
975
|
+
else
|
976
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
977
|
+
end
|
978
|
+
s0 << r2
|
979
|
+
if r2
|
980
|
+
if input.index('**', index) == index
|
981
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
982
|
+
@index += 2
|
983
|
+
else
|
984
|
+
terminal_parse_failure('**')
|
985
|
+
r4 = nil
|
986
|
+
end
|
987
|
+
s0 << r4
|
988
|
+
end
|
989
|
+
end
|
990
|
+
if s0.last
|
991
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
992
|
+
r0.extend(BoldText0)
|
993
|
+
else
|
994
|
+
self.index = i0
|
995
|
+
r0 = nil
|
996
|
+
end
|
997
|
+
|
998
|
+
node_cache[:BoldText][start_index] = r0
|
999
|
+
|
1000
|
+
return r0
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
def _nt_NormalText
|
1004
|
+
start_index = index
|
1005
|
+
if node_cache[:NormalText].has_key?(index)
|
1006
|
+
cached = node_cache[:NormalText][index]
|
1007
|
+
@index = cached.interval.end if cached
|
1008
|
+
return cached
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
s0, i0 = [], index
|
1012
|
+
loop do
|
1013
|
+
if input.index(Regexp.new('[^\\n]'), index) == index
|
1014
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1015
|
+
@index += 1
|
1016
|
+
else
|
1017
|
+
r1 = nil
|
1018
|
+
end
|
1019
|
+
if r1
|
1020
|
+
s0 << r1
|
1021
|
+
else
|
1022
|
+
break
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
if s0.empty?
|
1026
|
+
self.index = i0
|
1027
|
+
r0 = nil
|
1028
|
+
else
|
1029
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
node_cache[:NormalText][start_index] = r0
|
1033
|
+
|
1034
|
+
return r0
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
module PlaceHolder0
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
def _nt_PlaceHolder
|
1041
|
+
start_index = index
|
1042
|
+
if node_cache[:PlaceHolder].has_key?(index)
|
1043
|
+
cached = node_cache[:PlaceHolder][index]
|
1044
|
+
@index = cached.interval.end if cached
|
1045
|
+
return cached
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
i0, s0 = index, []
|
1049
|
+
if input.index('<<', index) == index
|
1050
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1051
|
+
@index += 2
|
1052
|
+
else
|
1053
|
+
terminal_parse_failure('<<')
|
1054
|
+
r1 = nil
|
1055
|
+
end
|
1056
|
+
s0 << r1
|
1057
|
+
if r1
|
1058
|
+
s2, i2 = [], index
|
1059
|
+
loop do
|
1060
|
+
if input.index(Regexp.new('[0-9]'), index) == index
|
1061
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1062
|
+
@index += 1
|
1063
|
+
else
|
1064
|
+
r3 = nil
|
1065
|
+
end
|
1066
|
+
if r3
|
1067
|
+
s2 << r3
|
1068
|
+
else
|
1069
|
+
break
|
1070
|
+
end
|
1071
|
+
end
|
1072
|
+
if s2.empty?
|
1073
|
+
self.index = i2
|
1074
|
+
r2 = nil
|
1075
|
+
else
|
1076
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1077
|
+
end
|
1078
|
+
s0 << r2
|
1079
|
+
if r2
|
1080
|
+
if input.index('>>', index) == index
|
1081
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1082
|
+
@index += 2
|
1083
|
+
else
|
1084
|
+
terminal_parse_failure('>>')
|
1085
|
+
r4 = nil
|
1086
|
+
end
|
1087
|
+
s0 << r4
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
if s0.last
|
1091
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1092
|
+
r0.extend(PlaceHolder0)
|
1093
|
+
else
|
1094
|
+
self.index = i0
|
1095
|
+
r0 = nil
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
node_cache[:PlaceHolder][start_index] = r0
|
1099
|
+
|
1100
|
+
return r0
|
1101
|
+
end
|
1102
|
+
|
1103
|
+
def _nt_Image
|
1104
|
+
start_index = index
|
1105
|
+
if node_cache[:Image].has_key?(index)
|
1106
|
+
cached = node_cache[:Image][index]
|
1107
|
+
@index = cached.interval.end if cached
|
1108
|
+
return cached
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
i0 = index
|
1112
|
+
r1 = _nt_ImageWithAlt
|
1113
|
+
if r1
|
1114
|
+
r0 = r1
|
1115
|
+
else
|
1116
|
+
r2 = _nt_ImageWithoutAlt
|
1117
|
+
if r2
|
1118
|
+
r0 = r2
|
1119
|
+
else
|
1120
|
+
self.index = i0
|
1121
|
+
r0 = nil
|
1122
|
+
end
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
node_cache[:Image][start_index] = r0
|
1126
|
+
|
1127
|
+
return r0
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
module ImageWithAlt0
|
1131
|
+
def ImageAddress
|
1132
|
+
elements[1]
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
def _nt_ImageWithAlt
|
1138
|
+
start_index = index
|
1139
|
+
if node_cache[:ImageWithAlt].has_key?(index)
|
1140
|
+
cached = node_cache[:ImageWithAlt][index]
|
1141
|
+
@index = cached.interval.end if cached
|
1142
|
+
return cached
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
i0, s0 = index, []
|
1146
|
+
if input.index('{{', index) == index
|
1147
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1148
|
+
@index += 2
|
1149
|
+
else
|
1150
|
+
terminal_parse_failure('{{')
|
1151
|
+
r1 = nil
|
1152
|
+
end
|
1153
|
+
s0 << r1
|
1154
|
+
if r1
|
1155
|
+
r2 = _nt_ImageAddress
|
1156
|
+
s0 << r2
|
1157
|
+
if r2
|
1158
|
+
if input.index('|', index) == index
|
1159
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1160
|
+
@index += 1
|
1161
|
+
else
|
1162
|
+
terminal_parse_failure('|')
|
1163
|
+
r3 = nil
|
1164
|
+
end
|
1165
|
+
s0 << r3
|
1166
|
+
if r3
|
1167
|
+
if input.index('}}', index) == index
|
1168
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1169
|
+
@index += 2
|
1170
|
+
else
|
1171
|
+
terminal_parse_failure('}}')
|
1172
|
+
r4 = nil
|
1173
|
+
end
|
1174
|
+
s0 << r4
|
1175
|
+
end
|
1176
|
+
end
|
1177
|
+
end
|
1178
|
+
if s0.last
|
1179
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1180
|
+
r0.extend(ImageWithAlt0)
|
1181
|
+
else
|
1182
|
+
self.index = i0
|
1183
|
+
r0 = nil
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
node_cache[:ImageWithAlt][start_index] = r0
|
1187
|
+
|
1188
|
+
return r0
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
module ImageWithoutAlt0
|
1192
|
+
def ImageAddress
|
1193
|
+
elements[1]
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
def _nt_ImageWithoutAlt
|
1199
|
+
start_index = index
|
1200
|
+
if node_cache[:ImageWithoutAlt].has_key?(index)
|
1201
|
+
cached = node_cache[:ImageWithoutAlt][index]
|
1202
|
+
@index = cached.interval.end if cached
|
1203
|
+
return cached
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
i0, s0 = index, []
|
1207
|
+
if input.index('{{', index) == index
|
1208
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1209
|
+
@index += 2
|
1210
|
+
else
|
1211
|
+
terminal_parse_failure('{{')
|
1212
|
+
r1 = nil
|
1213
|
+
end
|
1214
|
+
s0 << r1
|
1215
|
+
if r1
|
1216
|
+
r2 = _nt_ImageAddress
|
1217
|
+
s0 << r2
|
1218
|
+
if r2
|
1219
|
+
if input.index('}}', index) == index
|
1220
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1221
|
+
@index += 2
|
1222
|
+
else
|
1223
|
+
terminal_parse_failure('}}')
|
1224
|
+
r3 = nil
|
1225
|
+
end
|
1226
|
+
s0 << r3
|
1227
|
+
end
|
1228
|
+
end
|
1229
|
+
if s0.last
|
1230
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1231
|
+
r0.extend(ImageWithoutAlt0)
|
1232
|
+
else
|
1233
|
+
self.index = i0
|
1234
|
+
r0 = nil
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
node_cache[:ImageWithoutAlt][start_index] = r0
|
1238
|
+
|
1239
|
+
return r0
|
1240
|
+
end
|
1241
|
+
|
1242
|
+
def _nt_ImageAddress
|
1243
|
+
start_index = index
|
1244
|
+
if node_cache[:ImageAddress].has_key?(index)
|
1245
|
+
cached = node_cache[:ImageAddress][index]
|
1246
|
+
@index = cached.interval.end if cached
|
1247
|
+
return cached
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
i0 = index
|
1251
|
+
r1 = _nt_URL
|
1252
|
+
if r1
|
1253
|
+
r0 = r1
|
1254
|
+
else
|
1255
|
+
r2 = _nt_ImageFile
|
1256
|
+
if r2
|
1257
|
+
r0 = r2
|
1258
|
+
else
|
1259
|
+
r3 = _nt_PageName
|
1260
|
+
if r3
|
1261
|
+
r0 = r3
|
1262
|
+
else
|
1263
|
+
self.index = i0
|
1264
|
+
r0 = nil
|
1265
|
+
end
|
1266
|
+
end
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
node_cache[:ImageAddress][start_index] = r0
|
1270
|
+
|
1271
|
+
return r0
|
1272
|
+
end
|
1273
|
+
|
1274
|
+
module ImageFile0
|
1275
|
+
def ImageFileExtension
|
1276
|
+
elements[2]
|
1277
|
+
end
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
def _nt_ImageFile
|
1281
|
+
start_index = index
|
1282
|
+
if node_cache[:ImageFile].has_key?(index)
|
1283
|
+
cached = node_cache[:ImageFile][index]
|
1284
|
+
@index = cached.interval.end if cached
|
1285
|
+
return cached
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
i0, s0 = index, []
|
1289
|
+
s1, i1 = [], index
|
1290
|
+
loop do
|
1291
|
+
if index < input_length
|
1292
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1293
|
+
@index += 1
|
1294
|
+
else
|
1295
|
+
terminal_parse_failure("any character")
|
1296
|
+
r2 = nil
|
1297
|
+
end
|
1298
|
+
if r2
|
1299
|
+
s1 << r2
|
1300
|
+
else
|
1301
|
+
break
|
1302
|
+
end
|
1303
|
+
end
|
1304
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1305
|
+
s0 << r1
|
1306
|
+
if r1
|
1307
|
+
if input.index('.', index) == index
|
1308
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1309
|
+
@index += 1
|
1310
|
+
else
|
1311
|
+
terminal_parse_failure('.')
|
1312
|
+
r3 = nil
|
1313
|
+
end
|
1314
|
+
s0 << r3
|
1315
|
+
if r3
|
1316
|
+
r4 = _nt_ImageFileExtension
|
1317
|
+
s0 << r4
|
1318
|
+
end
|
1319
|
+
end
|
1320
|
+
if s0.last
|
1321
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1322
|
+
r0.extend(ImageFile0)
|
1323
|
+
else
|
1324
|
+
self.index = i0
|
1325
|
+
r0 = nil
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
node_cache[:ImageFile][start_index] = r0
|
1329
|
+
|
1330
|
+
return r0
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
def _nt_ImageFileExtension
|
1334
|
+
start_index = index
|
1335
|
+
if node_cache[:ImageFileExtension].has_key?(index)
|
1336
|
+
cached = node_cache[:ImageFileExtension][index]
|
1337
|
+
@index = cached.interval.end if cached
|
1338
|
+
return cached
|
1339
|
+
end
|
1340
|
+
|
1341
|
+
i0 = index
|
1342
|
+
if input.index('gif', index) == index
|
1343
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1344
|
+
@index += 3
|
1345
|
+
else
|
1346
|
+
terminal_parse_failure('gif')
|
1347
|
+
r1 = nil
|
1348
|
+
end
|
1349
|
+
if r1
|
1350
|
+
r0 = r1
|
1351
|
+
else
|
1352
|
+
if input.index('jpg', index) == index
|
1353
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1354
|
+
@index += 3
|
1355
|
+
else
|
1356
|
+
terminal_parse_failure('jpg')
|
1357
|
+
r2 = nil
|
1358
|
+
end
|
1359
|
+
if r2
|
1360
|
+
r0 = r2
|
1361
|
+
else
|
1362
|
+
if input.index('jpeg', index) == index
|
1363
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
1364
|
+
@index += 4
|
1365
|
+
else
|
1366
|
+
terminal_parse_failure('jpeg')
|
1367
|
+
r3 = nil
|
1368
|
+
end
|
1369
|
+
if r3
|
1370
|
+
r0 = r3
|
1371
|
+
else
|
1372
|
+
if input.index('png', index) == index
|
1373
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1374
|
+
@index += 3
|
1375
|
+
else
|
1376
|
+
terminal_parse_failure('png')
|
1377
|
+
r4 = nil
|
1378
|
+
end
|
1379
|
+
if r4
|
1380
|
+
r0 = r4
|
1381
|
+
else
|
1382
|
+
if input.index('svg', index) == index
|
1383
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1384
|
+
@index += 3
|
1385
|
+
else
|
1386
|
+
terminal_parse_failure('svg')
|
1387
|
+
r5 = nil
|
1388
|
+
end
|
1389
|
+
if r5
|
1390
|
+
r0 = r5
|
1391
|
+
else
|
1392
|
+
self.index = i0
|
1393
|
+
r0 = nil
|
1394
|
+
end
|
1395
|
+
end
|
1396
|
+
end
|
1397
|
+
end
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
node_cache[:ImageFileExtension][start_index] = r0
|
1401
|
+
|
1402
|
+
return r0
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
def _nt_Link
|
1406
|
+
start_index = index
|
1407
|
+
if node_cache[:Link].has_key?(index)
|
1408
|
+
cached = node_cache[:Link][index]
|
1409
|
+
@index = cached.interval.end if cached
|
1410
|
+
return cached
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
i0 = index
|
1414
|
+
r1 = _nt_LinkWithoutText
|
1415
|
+
if r1
|
1416
|
+
r0 = r1
|
1417
|
+
else
|
1418
|
+
r2 = _nt_LinkWithText
|
1419
|
+
if r2
|
1420
|
+
r0 = r2
|
1421
|
+
else
|
1422
|
+
self.index = i0
|
1423
|
+
r0 = nil
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
|
1427
|
+
node_cache[:Link][start_index] = r0
|
1428
|
+
|
1429
|
+
return r0
|
1430
|
+
end
|
1431
|
+
|
1432
|
+
module LinkWithText0
|
1433
|
+
def LinkAddress
|
1434
|
+
elements[1]
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
def LinkText
|
1438
|
+
elements[3]
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
end
|
1442
|
+
|
1443
|
+
def _nt_LinkWithText
|
1444
|
+
start_index = index
|
1445
|
+
if node_cache[:LinkWithText].has_key?(index)
|
1446
|
+
cached = node_cache[:LinkWithText][index]
|
1447
|
+
@index = cached.interval.end if cached
|
1448
|
+
return cached
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
i0, s0 = index, []
|
1452
|
+
if input.index('[[', index) == index
|
1453
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1454
|
+
@index += 2
|
1455
|
+
else
|
1456
|
+
terminal_parse_failure('[[')
|
1457
|
+
r1 = nil
|
1458
|
+
end
|
1459
|
+
s0 << r1
|
1460
|
+
if r1
|
1461
|
+
r2 = _nt_LinkAddress
|
1462
|
+
s0 << r2
|
1463
|
+
if r2
|
1464
|
+
if input.index('|', index) == index
|
1465
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1466
|
+
@index += 1
|
1467
|
+
else
|
1468
|
+
terminal_parse_failure('|')
|
1469
|
+
r3 = nil
|
1470
|
+
end
|
1471
|
+
s0 << r3
|
1472
|
+
if r3
|
1473
|
+
r4 = _nt_LinkText
|
1474
|
+
s0 << r4
|
1475
|
+
if r4
|
1476
|
+
if input.index(']]', index) == index
|
1477
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1478
|
+
@index += 2
|
1479
|
+
else
|
1480
|
+
terminal_parse_failure(']]')
|
1481
|
+
r5 = nil
|
1482
|
+
end
|
1483
|
+
s0 << r5
|
1484
|
+
end
|
1485
|
+
end
|
1486
|
+
end
|
1487
|
+
end
|
1488
|
+
if s0.last
|
1489
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1490
|
+
r0.extend(LinkWithText0)
|
1491
|
+
else
|
1492
|
+
self.index = i0
|
1493
|
+
r0 = nil
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
node_cache[:LinkWithText][start_index] = r0
|
1497
|
+
|
1498
|
+
return r0
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
module LinkWithoutText0
|
1502
|
+
def LinkAddress
|
1503
|
+
elements[1]
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
end
|
1507
|
+
|
1508
|
+
def _nt_LinkWithoutText
|
1509
|
+
start_index = index
|
1510
|
+
if node_cache[:LinkWithoutText].has_key?(index)
|
1511
|
+
cached = node_cache[:LinkWithoutText][index]
|
1512
|
+
@index = cached.interval.end if cached
|
1513
|
+
return cached
|
1514
|
+
end
|
1515
|
+
|
1516
|
+
i0, s0 = index, []
|
1517
|
+
if input.index('[[', index) == index
|
1518
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1519
|
+
@index += 2
|
1520
|
+
else
|
1521
|
+
terminal_parse_failure('[[')
|
1522
|
+
r1 = nil
|
1523
|
+
end
|
1524
|
+
s0 << r1
|
1525
|
+
if r1
|
1526
|
+
r2 = _nt_LinkAddress
|
1527
|
+
s0 << r2
|
1528
|
+
if r2
|
1529
|
+
if input.index(']]', index) == index
|
1530
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
1531
|
+
@index += 2
|
1532
|
+
else
|
1533
|
+
terminal_parse_failure(']]')
|
1534
|
+
r3 = nil
|
1535
|
+
end
|
1536
|
+
s0 << r3
|
1537
|
+
end
|
1538
|
+
end
|
1539
|
+
if s0.last
|
1540
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1541
|
+
r0.extend(LinkWithoutText0)
|
1542
|
+
else
|
1543
|
+
self.index = i0
|
1544
|
+
r0 = nil
|
1545
|
+
end
|
1546
|
+
|
1547
|
+
node_cache[:LinkWithoutText][start_index] = r0
|
1548
|
+
|
1549
|
+
return r0
|
1550
|
+
end
|
1551
|
+
|
1552
|
+
def _nt_LinkAddress
|
1553
|
+
start_index = index
|
1554
|
+
if node_cache[:LinkAddress].has_key?(index)
|
1555
|
+
cached = node_cache[:LinkAddress][index]
|
1556
|
+
@index = cached.interval.end if cached
|
1557
|
+
return cached
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
i0 = index
|
1561
|
+
r1 = _nt_PageName
|
1562
|
+
if r1
|
1563
|
+
r0 = r1
|
1564
|
+
else
|
1565
|
+
r2 = _nt_URL
|
1566
|
+
if r2
|
1567
|
+
r0 = r2
|
1568
|
+
else
|
1569
|
+
self.index = i0
|
1570
|
+
r0 = nil
|
1571
|
+
end
|
1572
|
+
end
|
1573
|
+
|
1574
|
+
node_cache[:LinkAddress][start_index] = r0
|
1575
|
+
|
1576
|
+
return r0
|
1577
|
+
end
|
1578
|
+
|
1579
|
+
module URL0
|
1580
|
+
def URLProtocol
|
1581
|
+
elements[0]
|
1582
|
+
end
|
1583
|
+
|
1584
|
+
def RestOfURL
|
1585
|
+
elements[2]
|
1586
|
+
end
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
def _nt_URL
|
1590
|
+
start_index = index
|
1591
|
+
if node_cache[:URL].has_key?(index)
|
1592
|
+
cached = node_cache[:URL][index]
|
1593
|
+
@index = cached.interval.end if cached
|
1594
|
+
return cached
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
i0, s0 = index, []
|
1598
|
+
r1 = _nt_URLProtocol
|
1599
|
+
s0 << r1
|
1600
|
+
if r1
|
1601
|
+
if input.index(':', index) == index
|
1602
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1603
|
+
@index += 1
|
1604
|
+
else
|
1605
|
+
terminal_parse_failure(':')
|
1606
|
+
r2 = nil
|
1607
|
+
end
|
1608
|
+
s0 << r2
|
1609
|
+
if r2
|
1610
|
+
r3 = _nt_RestOfURL
|
1611
|
+
s0 << r3
|
1612
|
+
end
|
1613
|
+
end
|
1614
|
+
if s0.last
|
1615
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1616
|
+
r0.extend(URL0)
|
1617
|
+
else
|
1618
|
+
self.index = i0
|
1619
|
+
r0 = nil
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
node_cache[:URL][start_index] = r0
|
1623
|
+
|
1624
|
+
return r0
|
1625
|
+
end
|
1626
|
+
|
1627
|
+
def _nt_URLProtocol
|
1628
|
+
start_index = index
|
1629
|
+
if node_cache[:URLProtocol].has_key?(index)
|
1630
|
+
cached = node_cache[:URLProtocol][index]
|
1631
|
+
@index = cached.interval.end if cached
|
1632
|
+
return cached
|
1633
|
+
end
|
1634
|
+
|
1635
|
+
i0 = index
|
1636
|
+
if input.index('http', index) == index
|
1637
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
1638
|
+
@index += 4
|
1639
|
+
else
|
1640
|
+
terminal_parse_failure('http')
|
1641
|
+
r1 = nil
|
1642
|
+
end
|
1643
|
+
if r1
|
1644
|
+
r0 = r1
|
1645
|
+
else
|
1646
|
+
if input.index('https', index) == index
|
1647
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
1648
|
+
@index += 5
|
1649
|
+
else
|
1650
|
+
terminal_parse_failure('https')
|
1651
|
+
r2 = nil
|
1652
|
+
end
|
1653
|
+
if r2
|
1654
|
+
r0 = r2
|
1655
|
+
else
|
1656
|
+
if input.index('ftp', index) == index
|
1657
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1658
|
+
@index += 3
|
1659
|
+
else
|
1660
|
+
terminal_parse_failure('ftp')
|
1661
|
+
r3 = nil
|
1662
|
+
end
|
1663
|
+
if r3
|
1664
|
+
r0 = r3
|
1665
|
+
else
|
1666
|
+
if input.index('mailto', index) == index
|
1667
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 6))
|
1668
|
+
@index += 6
|
1669
|
+
else
|
1670
|
+
terminal_parse_failure('mailto')
|
1671
|
+
r4 = nil
|
1672
|
+
end
|
1673
|
+
if r4
|
1674
|
+
r0 = r4
|
1675
|
+
else
|
1676
|
+
if input.index('news', index) == index
|
1677
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 4))
|
1678
|
+
@index += 4
|
1679
|
+
else
|
1680
|
+
terminal_parse_failure('news')
|
1681
|
+
r5 = nil
|
1682
|
+
end
|
1683
|
+
if r5
|
1684
|
+
r0 = r5
|
1685
|
+
else
|
1686
|
+
if input.index('irc', index) == index
|
1687
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1688
|
+
@index += 3
|
1689
|
+
else
|
1690
|
+
terminal_parse_failure('irc')
|
1691
|
+
r6 = nil
|
1692
|
+
end
|
1693
|
+
if r6
|
1694
|
+
r0 = r6
|
1695
|
+
else
|
1696
|
+
self.index = i0
|
1697
|
+
r0 = nil
|
1698
|
+
end
|
1699
|
+
end
|
1700
|
+
end
|
1701
|
+
end
|
1702
|
+
end
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
node_cache[:URLProtocol][start_index] = r0
|
1706
|
+
|
1707
|
+
return r0
|
1708
|
+
end
|
1709
|
+
|
1710
|
+
def _nt_RestOfURL
|
1711
|
+
start_index = index
|
1712
|
+
if node_cache[:RestOfURL].has_key?(index)
|
1713
|
+
cached = node_cache[:RestOfURL][index]
|
1714
|
+
@index = cached.interval.end if cached
|
1715
|
+
return cached
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
s0, i0 = [], index
|
1719
|
+
loop do
|
1720
|
+
if index < input_length
|
1721
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1722
|
+
@index += 1
|
1723
|
+
else
|
1724
|
+
terminal_parse_failure("any character")
|
1725
|
+
r1 = nil
|
1726
|
+
end
|
1727
|
+
if r1
|
1728
|
+
s0 << r1
|
1729
|
+
else
|
1730
|
+
break
|
1731
|
+
end
|
1732
|
+
end
|
1733
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1734
|
+
|
1735
|
+
node_cache[:RestOfURL][start_index] = r0
|
1736
|
+
|
1737
|
+
return r0
|
1738
|
+
end
|
1739
|
+
|
1740
|
+
def _nt_PageName
|
1741
|
+
start_index = index
|
1742
|
+
if node_cache[:PageName].has_key?(index)
|
1743
|
+
cached = node_cache[:PageName][index]
|
1744
|
+
@index = cached.interval.end if cached
|
1745
|
+
return cached
|
1746
|
+
end
|
1747
|
+
|
1748
|
+
s0, i0 = [], index
|
1749
|
+
loop do
|
1750
|
+
if input.index(Regexp.new('[a-zA-Z0-9.?!_ -]'), index) == index
|
1751
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1752
|
+
@index += 1
|
1753
|
+
else
|
1754
|
+
r1 = nil
|
1755
|
+
end
|
1756
|
+
if r1
|
1757
|
+
s0 << r1
|
1758
|
+
else
|
1759
|
+
break
|
1760
|
+
end
|
1761
|
+
end
|
1762
|
+
if s0.empty?
|
1763
|
+
self.index = i0
|
1764
|
+
r0 = nil
|
1765
|
+
else
|
1766
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1767
|
+
end
|
1768
|
+
|
1769
|
+
node_cache[:PageName][start_index] = r0
|
1770
|
+
|
1771
|
+
return r0
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
module List0
|
1775
|
+
def FirstListElement
|
1776
|
+
elements[0]
|
1777
|
+
end
|
1778
|
+
|
1779
|
+
end
|
1780
|
+
|
1781
|
+
def _nt_List
|
1782
|
+
start_index = index
|
1783
|
+
if node_cache[:List].has_key?(index)
|
1784
|
+
cached = node_cache[:List][index]
|
1785
|
+
@index = cached.interval.end if cached
|
1786
|
+
return cached
|
1787
|
+
end
|
1788
|
+
|
1789
|
+
i0, s0 = index, []
|
1790
|
+
r1 = _nt_FirstListElement
|
1791
|
+
s0 << r1
|
1792
|
+
if r1
|
1793
|
+
s2, i2 = [], index
|
1794
|
+
loop do
|
1795
|
+
r3 = _nt_ListElement
|
1796
|
+
if r3
|
1797
|
+
s2 << r3
|
1798
|
+
else
|
1799
|
+
break
|
1800
|
+
end
|
1801
|
+
end
|
1802
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
1803
|
+
s0 << r2
|
1804
|
+
end
|
1805
|
+
if s0.last
|
1806
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1807
|
+
r0.extend(List0)
|
1808
|
+
else
|
1809
|
+
self.index = i0
|
1810
|
+
r0 = nil
|
1811
|
+
end
|
1812
|
+
|
1813
|
+
node_cache[:List][start_index] = r0
|
1814
|
+
|
1815
|
+
return r0
|
1816
|
+
end
|
1817
|
+
|
1818
|
+
def _nt_FirstListElement
|
1819
|
+
start_index = index
|
1820
|
+
if node_cache[:FirstListElement].has_key?(index)
|
1821
|
+
cached = node_cache[:FirstListElement][index]
|
1822
|
+
@index = cached.interval.end if cached
|
1823
|
+
return cached
|
1824
|
+
end
|
1825
|
+
|
1826
|
+
i0 = index
|
1827
|
+
r1 = _nt_FirstBullet
|
1828
|
+
if r1
|
1829
|
+
r0 = r1
|
1830
|
+
else
|
1831
|
+
r2 = _nt_FirstNumber
|
1832
|
+
if r2
|
1833
|
+
r0 = r2
|
1834
|
+
else
|
1835
|
+
self.index = i0
|
1836
|
+
r0 = nil
|
1837
|
+
end
|
1838
|
+
end
|
1839
|
+
|
1840
|
+
node_cache[:FirstListElement][start_index] = r0
|
1841
|
+
|
1842
|
+
return r0
|
1843
|
+
end
|
1844
|
+
|
1845
|
+
module FirstBulletElement0
|
1846
|
+
def Whitespace
|
1847
|
+
elements[1]
|
1848
|
+
end
|
1849
|
+
|
1850
|
+
end
|
1851
|
+
|
1852
|
+
def _nt_FirstBulletElement
|
1853
|
+
start_index = index
|
1854
|
+
if node_cache[:FirstBulletElement].has_key?(index)
|
1855
|
+
cached = node_cache[:FirstBulletElement][index]
|
1856
|
+
@index = cached.interval.end if cached
|
1857
|
+
return cached
|
1858
|
+
end
|
1859
|
+
|
1860
|
+
i0, s0 = index, []
|
1861
|
+
if input.index('*', index) == index
|
1862
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1863
|
+
@index += 1
|
1864
|
+
else
|
1865
|
+
terminal_parse_failure('*')
|
1866
|
+
r1 = nil
|
1867
|
+
end
|
1868
|
+
s0 << r1
|
1869
|
+
if r1
|
1870
|
+
r2 = _nt_Whitespace
|
1871
|
+
s0 << r2
|
1872
|
+
if r2
|
1873
|
+
s3, i3 = [], index
|
1874
|
+
loop do
|
1875
|
+
r4 = _nt_TextPart
|
1876
|
+
if r4
|
1877
|
+
s3 << r4
|
1878
|
+
else
|
1879
|
+
break
|
1880
|
+
end
|
1881
|
+
end
|
1882
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1883
|
+
s0 << r3
|
1884
|
+
end
|
1885
|
+
end
|
1886
|
+
if s0.last
|
1887
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1888
|
+
r0.extend(FirstBulletElement0)
|
1889
|
+
else
|
1890
|
+
self.index = i0
|
1891
|
+
r0 = nil
|
1892
|
+
end
|
1893
|
+
|
1894
|
+
node_cache[:FirstBulletElement][start_index] = r0
|
1895
|
+
|
1896
|
+
return r0
|
1897
|
+
end
|
1898
|
+
|
1899
|
+
module FirstNumberElement0
|
1900
|
+
def Whitespace
|
1901
|
+
elements[1]
|
1902
|
+
end
|
1903
|
+
|
1904
|
+
end
|
1905
|
+
|
1906
|
+
def _nt_FirstNumberElement
|
1907
|
+
start_index = index
|
1908
|
+
if node_cache[:FirstNumberElement].has_key?(index)
|
1909
|
+
cached = node_cache[:FirstNumberElement][index]
|
1910
|
+
@index = cached.interval.end if cached
|
1911
|
+
return cached
|
1912
|
+
end
|
1913
|
+
|
1914
|
+
i0, s0 = index, []
|
1915
|
+
if input.index('#', index) == index
|
1916
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1917
|
+
@index += 1
|
1918
|
+
else
|
1919
|
+
terminal_parse_failure('#')
|
1920
|
+
r1 = nil
|
1921
|
+
end
|
1922
|
+
s0 << r1
|
1923
|
+
if r1
|
1924
|
+
r2 = _nt_Whitespace
|
1925
|
+
s0 << r2
|
1926
|
+
if r2
|
1927
|
+
s3, i3 = [], index
|
1928
|
+
loop do
|
1929
|
+
r4 = _nt_TextPart
|
1930
|
+
if r4
|
1931
|
+
s3 << r4
|
1932
|
+
else
|
1933
|
+
break
|
1934
|
+
end
|
1935
|
+
end
|
1936
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1937
|
+
s0 << r3
|
1938
|
+
end
|
1939
|
+
end
|
1940
|
+
if s0.last
|
1941
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1942
|
+
r0.extend(FirstNumberElement0)
|
1943
|
+
else
|
1944
|
+
self.index = i0
|
1945
|
+
r0 = nil
|
1946
|
+
end
|
1947
|
+
|
1948
|
+
node_cache[:FirstNumberElement][start_index] = r0
|
1949
|
+
|
1950
|
+
return r0
|
1951
|
+
end
|
1952
|
+
|
1953
|
+
module BulletElement0
|
1954
|
+
def Whitespace
|
1955
|
+
elements[1]
|
1956
|
+
end
|
1957
|
+
|
1958
|
+
end
|
1959
|
+
|
1960
|
+
def _nt_BulletElement
|
1961
|
+
start_index = index
|
1962
|
+
if node_cache[:BulletElement].has_key?(index)
|
1963
|
+
cached = node_cache[:BulletElement][index]
|
1964
|
+
@index = cached.interval.end if cached
|
1965
|
+
return cached
|
1966
|
+
end
|
1967
|
+
|
1968
|
+
i0, s0 = index, []
|
1969
|
+
if input.index('*', index) == index
|
1970
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1971
|
+
@index += 1
|
1972
|
+
else
|
1973
|
+
terminal_parse_failure('*')
|
1974
|
+
r1 = nil
|
1975
|
+
end
|
1976
|
+
s0 << r1
|
1977
|
+
if r1
|
1978
|
+
r2 = _nt_Whitespace
|
1979
|
+
s0 << r2
|
1980
|
+
if r2
|
1981
|
+
s3, i3 = [], index
|
1982
|
+
loop do
|
1983
|
+
r4 = _nt_TextPart
|
1984
|
+
if r4
|
1985
|
+
s3 << r4
|
1986
|
+
else
|
1987
|
+
break
|
1988
|
+
end
|
1989
|
+
end
|
1990
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1991
|
+
s0 << r3
|
1992
|
+
end
|
1993
|
+
end
|
1994
|
+
if s0.last
|
1995
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1996
|
+
r0.extend(BulletElement0)
|
1997
|
+
else
|
1998
|
+
self.index = i0
|
1999
|
+
r0 = nil
|
2000
|
+
end
|
2001
|
+
|
2002
|
+
node_cache[:BulletElement][start_index] = r0
|
2003
|
+
|
2004
|
+
return r0
|
2005
|
+
end
|
2006
|
+
|
2007
|
+
module NumberElement0
|
2008
|
+
def Whitespace
|
2009
|
+
elements[1]
|
2010
|
+
end
|
2011
|
+
|
2012
|
+
end
|
2013
|
+
|
2014
|
+
def _nt_NumberElement
|
2015
|
+
start_index = index
|
2016
|
+
if node_cache[:NumberElement].has_key?(index)
|
2017
|
+
cached = node_cache[:NumberElement][index]
|
2018
|
+
@index = cached.interval.end if cached
|
2019
|
+
return cached
|
2020
|
+
end
|
2021
|
+
|
2022
|
+
i0, s0 = index, []
|
2023
|
+
if input.index('#', index) == index
|
2024
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2025
|
+
@index += 1
|
2026
|
+
else
|
2027
|
+
terminal_parse_failure('#')
|
2028
|
+
r1 = nil
|
2029
|
+
end
|
2030
|
+
s0 << r1
|
2031
|
+
if r1
|
2032
|
+
r2 = _nt_Whitespace
|
2033
|
+
s0 << r2
|
2034
|
+
if r2
|
2035
|
+
s3, i3 = [], index
|
2036
|
+
loop do
|
2037
|
+
r4 = _nt_TextPart
|
2038
|
+
if r4
|
2039
|
+
s3 << r4
|
2040
|
+
else
|
2041
|
+
break
|
2042
|
+
end
|
2043
|
+
end
|
2044
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2045
|
+
s0 << r3
|
2046
|
+
end
|
2047
|
+
end
|
2048
|
+
if s0.last
|
2049
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2050
|
+
r0.extend(NumberElement0)
|
2051
|
+
else
|
2052
|
+
self.index = i0
|
2053
|
+
r0 = nil
|
2054
|
+
end
|
2055
|
+
|
2056
|
+
node_cache[:NumberElement][start_index] = r0
|
2057
|
+
|
2058
|
+
return r0
|
2059
|
+
end
|
2060
|
+
|
2061
|
+
def _nt_FirstBullet
|
2062
|
+
start_index = index
|
2063
|
+
if node_cache[:FirstBullet].has_key?(index)
|
2064
|
+
cached = node_cache[:FirstBullet][index]
|
2065
|
+
@index = cached.interval.end if cached
|
2066
|
+
return cached
|
2067
|
+
end
|
2068
|
+
|
2069
|
+
if input.index('*', index) == index
|
2070
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2071
|
+
@index += 1
|
2072
|
+
else
|
2073
|
+
terminal_parse_failure('*')
|
2074
|
+
r0 = nil
|
2075
|
+
end
|
2076
|
+
|
2077
|
+
node_cache[:FirstBullet][start_index] = r0
|
2078
|
+
|
2079
|
+
return r0
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
def _nt_FirstNumber
|
2083
|
+
start_index = index
|
2084
|
+
if node_cache[:FirstNumber].has_key?(index)
|
2085
|
+
cached = node_cache[:FirstNumber][index]
|
2086
|
+
@index = cached.interval.end if cached
|
2087
|
+
return cached
|
2088
|
+
end
|
2089
|
+
|
2090
|
+
if input.index('#', index) == index
|
2091
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2092
|
+
@index += 1
|
2093
|
+
else
|
2094
|
+
terminal_parse_failure('#')
|
2095
|
+
r0 = nil
|
2096
|
+
end
|
2097
|
+
|
2098
|
+
node_cache[:FirstNumber][start_index] = r0
|
2099
|
+
|
2100
|
+
return r0
|
2101
|
+
end
|
2102
|
+
|
2103
|
+
def _nt_LineEnd
|
2104
|
+
start_index = index
|
2105
|
+
if node_cache[:LineEnd].has_key?(index)
|
2106
|
+
cached = node_cache[:LineEnd][index]
|
2107
|
+
@index = cached.interval.end if cached
|
2108
|
+
return cached
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
if input.index(Regexp.new('[\\n]'), index) == index
|
2112
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2113
|
+
@index += 1
|
2114
|
+
else
|
2115
|
+
r0 = nil
|
2116
|
+
end
|
2117
|
+
|
2118
|
+
node_cache[:LineEnd][start_index] = r0
|
2119
|
+
|
2120
|
+
return r0
|
2121
|
+
end
|
2122
|
+
|
2123
|
+
def _nt_Whitespace
|
2124
|
+
start_index = index
|
2125
|
+
if node_cache[:Whitespace].has_key?(index)
|
2126
|
+
cached = node_cache[:Whitespace][index]
|
2127
|
+
@index = cached.interval.end if cached
|
2128
|
+
return cached
|
2129
|
+
end
|
2130
|
+
|
2131
|
+
if input.index(Regexp.new('[ \\t]'), index) == index
|
2132
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
2133
|
+
@index += 1
|
2134
|
+
else
|
2135
|
+
r0 = nil
|
2136
|
+
end
|
2137
|
+
|
2138
|
+
node_cache[:Whitespace][start_index] = r0
|
2139
|
+
|
2140
|
+
return r0
|
2141
|
+
end
|
2142
|
+
|
2143
|
+
end
|
2144
|
+
|
2145
|
+
class WikiCreoleParser < Treetop::Runtime::CompiledParser
|
2146
|
+
include WikiCreole
|
2147
|
+
end
|