typo 5.2.98 → 5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/sidebar_controller.rb +15 -3
- data/app/helpers/sidebar_helper.rb +9 -4
- data/app/models/feedback.rb +10 -2
- data/app/models/page_cache.rb +5 -1
- data/app/views/admin/blacklist/_blacklist_patterns.html.erb +2 -0
- data/app/views/admin/categories/new.html.erb +1 -1
- data/app/views/admin/content/_form.html.erb +3 -3
- data/app/views/admin/content/_simple_editor.html.erb +2 -0
- data/app/views/admin/content/_visual_editor.html.erb +2 -0
- data/app/views/admin/pages/_form.html.erb +5 -5
- data/app/views/admin/pages/_simple_editor.html.erb +2 -0
- data/app/views/admin/pages/_visual_editor.html.erb +2 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_comment_failed.html.erb +1 -1
- data/app/views/articles/read.html.erb +1 -1
- data/config/environment.rb +3 -2
- data/lib/tasks/release.rake +3 -4
- data/lib/typo_version.rb +1 -1
- data/public/stylesheets/administration.css +37 -2
- data/public/stylesheets/administration_rtl.css +316 -437
- data/vendor/actionwebservice/CHANGELOG +320 -0
- data/vendor/actionwebservice/MIT-LICENSE +21 -0
- data/vendor/actionwebservice/README +381 -0
- data/vendor/actionwebservice/Rakefile +173 -0
- data/vendor/actionwebservice/TODO +32 -0
- data/vendor/actionwebservice/examples/googlesearch/README +143 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +108 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/search_controller.rb +7 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/search_controller.rb +58 -0
- data/vendor/actionwebservice/examples/metaWeblog/README +17 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +60 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +34 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
- data/vendor/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
- data/vendor/actionwebservice/generators/web_service/USAGE +28 -0
- data/vendor/actionwebservice/generators/web_service/templates/api_definition.rb +5 -0
- data/vendor/actionwebservice/generators/web_service/templates/controller.rb +8 -0
- data/vendor/actionwebservice/generators/web_service/templates/functional_test.rb +19 -0
- data/vendor/actionwebservice/generators/web_service/web_service_generator.rb +29 -0
- data/vendor/actionwebservice/lib/action_web_service.rb +66 -0
- data/vendor/actionwebservice/lib/action_web_service/api.rb +297 -0
- data/vendor/actionwebservice/lib/action_web_service/base.rb +38 -0
- data/vendor/actionwebservice/lib/action_web_service/casting.rb +144 -0
- data/vendor/actionwebservice/lib/action_web_service/client.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/client/base.rb +28 -0
- data/vendor/actionwebservice/lib/action_web_service/client/soap_client.rb +113 -0
- data/vendor/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +58 -0
- data/vendor/actionwebservice/lib/action_web_service/container.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/container/action_controller_container.rb +93 -0
- data/vendor/actionwebservice/lib/action_web_service/container/delegated_container.rb +86 -0
- data/vendor/actionwebservice/lib/action_web_service/container/direct_container.rb +69 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher.rb +2 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +207 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
- data/vendor/actionwebservice/lib/action_web_service/invocation.rb +202 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol.rb +4 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/abstract.rb +112 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb +37 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +176 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
- data/vendor/actionwebservice/lib/action_web_service/scaffolding.rb +281 -0
- data/vendor/actionwebservice/lib/action_web_service/struct.rb +64 -0
- data/vendor/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +26 -0
- data/vendor/actionwebservice/lib/action_web_service/support/signature_types.rb +226 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
- data/vendor/actionwebservice/lib/action_web_service/test_invoke.rb +110 -0
- data/vendor/actionwebservice/lib/action_web_service/version.rb +9 -0
- data/vendor/actionwebservice/lib/actionwebservice.rb +1 -0
- data/vendor/actionwebservice/setup.rb +1379 -0
- data/vendor/actionwebservice/test/abstract_client.rb +183 -0
- data/vendor/actionwebservice/test/abstract_dispatcher.rb +547 -0
- data/vendor/actionwebservice/test/abstract_unit.rb +33 -0
- data/vendor/actionwebservice/test/api_test.rb +102 -0
- data/vendor/actionwebservice/test/apis/auto_load_api.rb +3 -0
- data/vendor/actionwebservice/test/apis/broken_auto_load_api.rb +2 -0
- data/vendor/actionwebservice/test/base_test.rb +42 -0
- data/vendor/actionwebservice/test/casting_test.rb +86 -0
- data/vendor/actionwebservice/test/client_soap_test.rb +155 -0
- data/vendor/actionwebservice/test/client_xmlrpc_test.rb +153 -0
- data/vendor/actionwebservice/test/container_test.rb +73 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_soap_test.rb +137 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
- data/vendor/actionwebservice/test/fixtures/db_definitions/mysql.sql +8 -0
- data/vendor/actionwebservice/test/fixtures/users.yml +12 -0
- data/vendor/actionwebservice/test/gencov +3 -0
- data/vendor/actionwebservice/test/invocation_test.rb +185 -0
- data/vendor/actionwebservice/test/run +6 -0
- data/vendor/actionwebservice/test/scaffolded_controller_test.rb +146 -0
- data/vendor/actionwebservice/test/struct_test.rb +52 -0
- data/vendor/actionwebservice/test/test_invoke_test.rb +112 -0
- data/vendor/gems/calendar_date_select-1.15/.specification +56 -0
- data/vendor/gems/calendar_date_select-1.15/History.txt +237 -0
- data/vendor/gems/calendar_date_select-1.15/MIT-LICENSE +20 -0
- data/vendor/gems/calendar_date_select-1.15/Manifest.txt +42 -0
- data/vendor/gems/calendar_date_select-1.15/Rakefile +31 -0
- data/vendor/gems/calendar_date_select-1.15/Readme.txt +16 -0
- data/vendor/gems/calendar_date_select-1.15/init.rb +1 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/functional/cds_test.html +334 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/prototype.js +4184 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/test.css +40 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unit/cds_helper_methods.html +46 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unittest.js +564 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select.rb +33 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/calendar_date_select.rb +116 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb +225 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/includes_helper.rb +29 -0
- data/vendor/gems/calendar_date_select-1.15/public/blank_iframe.html +2 -0
- data/vendor/gems/calendar_date_select-1.15/public/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/calendar_date_select.js +443 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/de.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/default.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/red.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/calendar_date_select_spec.rb +14 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/form_helpers_spec.rb +166 -0
- data/vendor/gems/calendar_date_select-1.15/spec/spec_helper.rb +26 -0
- data/vendor/gems/coderay-0.8.260/.specification +2 -1
- data/vendor/gems/htmlentities-4.0.0/.specification +68 -0
- data/vendor/gems/htmlentities-4.0.0/COPYING.txt +21 -0
- data/vendor/gems/htmlentities-4.0.0/History.txt +47 -0
- data/vendor/gems/htmlentities-4.0.0/README.txt +44 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities.rb +165 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/html4.rb +257 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/legacy.rb +27 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/string.rb +26 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/xhtml1.rb +258 -0
- data/vendor/gems/htmlentities-4.0.0/test/entities_test.rb +206 -0
- data/vendor/gems/htmlentities-4.0.0/test/html4_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/legacy_test.rb +34 -0
- data/vendor/gems/htmlentities-4.0.0/test/roundtrip_test.rb +94 -0
- data/vendor/gems/htmlentities-4.0.0/test/string_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/test_all.rb +3 -0
- data/vendor/gems/htmlentities-4.0.0/test/xhtml1_test.rb +23 -0
- data/vendor/gems/json-1.1.3/.require_paths +4 -0
- data/vendor/gems/json-1.1.3/.specification +58 -0
- data/vendor/gems/json-1.1.3/CHANGES +93 -0
- data/vendor/gems/json-1.1.3/GPL +340 -0
- data/vendor/gems/json-1.1.3/README +78 -0
- data/vendor/gems/json-1.1.3/RUBY +58 -0
- data/vendor/gems/json-1.1.3/Rakefile +309 -0
- data/vendor/gems/json-1.1.3/TODO +1 -0
- data/vendor/gems/json-1.1.3/VERSION +1 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark.txt +133 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/gems/json-1.1.3/bin/edit_json.rb +10 -0
- data/vendor/gems/json-1.1.3/bin/prettify_json.rb +76 -0
- data/vendor/gems/json-1.1.3/data/example.json +1 -0
- data/vendor/gems/json-1.1.3/data/index.html +38 -0
- data/vendor/gems/json-1.1.3/data/prototype.js +4184 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.c +875 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/install.rb +26 -0
- data/vendor/gems/json-1.1.3/lib/json.rb +235 -0
- data/vendor/gems/json-1.1.3/lib/json/Array.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/FalseClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Hash.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Key.xpm +73 -0
- data/vendor/gems/json-1.1.3/lib/json/NilClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Numeric.xpm +28 -0
- data/vendor/gems/json-1.1.3/lib/json/String.xpm +96 -0
- data/vendor/gems/json-1.1.3/lib/json/TrueClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/add/core.rb +135 -0
- data/vendor/gems/json-1.1.3/lib/json/add/rails.rb +58 -0
- data/vendor/gems/json-1.1.3/lib/json/common.rb +354 -0
- data/vendor/gems/json-1.1.3/lib/json/editor.rb +1362 -0
- data/vendor/gems/json-1.1.3/lib/json/ext.rb +13 -0
- data/vendor/gems/json-1.1.3/lib/json/json.xpm +1499 -0
- data/vendor/gems/json-1.1.3/lib/json/pure.rb +75 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/generator.rb +394 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/parser.rb +259 -0
- data/vendor/gems/json-1.1.3/lib/json/version.rb +9 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail1.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail10.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail11.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail12.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail13.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail14.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail18.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail19.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail20.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail21.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail22.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail23.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail24.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail25.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail27.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail28.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail3.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail4.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail5.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail6.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail7.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail8.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail9.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass1.json +56 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass15.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass16.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass17.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass26.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass3.json +6 -0
- data/vendor/gems/json-1.1.3/tests/runner.rb +25 -0
- data/vendor/gems/json-1.1.3/tests/test_json.rb +293 -0
- data/vendor/gems/json-1.1.3/tests/test_json_addition.rb +161 -0
- data/vendor/gems/json-1.1.3/tests/test_json_fixtures.rb +30 -0
- data/vendor/gems/json-1.1.3/tests/test_json_generate.rb +100 -0
- data/vendor/gems/json-1.1.3/tests/test_json_rails.rb +118 -0
- data/vendor/gems/json-1.1.3/tests/test_json_unicode.rb +61 -0
- data/vendor/gems/json-1.1.3/tools/fuzz.rb +140 -0
- data/vendor/gems/json-1.1.3/tools/server.rb +62 -0
- data/vendor/plugins/localization/bin/make_language.rb +2 -2
- data/vendor/plugins/localization/lib/localization.rb +2 -2
- data/vendor/plugins/will_paginate/CHANGELOG.rdoc +110 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +107 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +82 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +146 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +260 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +170 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +37 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +383 -0
- data/vendor/plugins/will_paginate/test/boot.rb +21 -0
- data/vendor/plugins/will_paginate/test/collection_test.rb +143 -0
- data/vendor/plugins/will_paginate/test/console +8 -0
- data/vendor/plugins/will_paginate/test/database.yml +22 -0
- data/vendor/plugins/will_paginate/test/finder_test.rb +476 -0
- data/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/vendor/plugins/will_paginate/test/fixtures/developer.rb +14 -0
- data/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/will_paginate/test/fixtures/project.rb +15 -0
- data/vendor/plugins/will_paginate/test/fixtures/projects.yml +6 -0
- data/vendor/plugins/will_paginate/test/fixtures/replies.yml +29 -0
- data/vendor/plugins/will_paginate/test/fixtures/reply.rb +7 -0
- data/vendor/plugins/will_paginate/test/fixtures/schema.rb +38 -0
- data/vendor/plugins/will_paginate/test/fixtures/topic.rb +10 -0
- data/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/vendor/plugins/will_paginate/test/helper.rb +37 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +36 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +73 -0
- data/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +11 -0
- data/vendor/plugins/will_paginate/test/lib/view_test_process.rb +165 -0
- data/vendor/plugins/will_paginate/test/tasks.rake +59 -0
- data/vendor/plugins/will_paginate/test/view_test.rb +363 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +22 -0
- data/vendor/plugins/xml_sidebar/lib/xml_sidebar.rb +1 -1
- metadata +349 -16
- data/migrate.txt +0 -142
Binary file
|
@@ -0,0 +1,638 @@
|
|
1
|
+
#include "ruby.h"
|
2
|
+
#include "re.h"
|
3
|
+
#include "st.h"
|
4
|
+
#include "unicode.h"
|
5
|
+
|
6
|
+
#define EVIL 0x666
|
7
|
+
|
8
|
+
static VALUE mJSON, mExt, cParser, eParserError, eNestingError;
|
9
|
+
static VALUE CNaN, CInfinity, CMinusInfinity;
|
10
|
+
|
11
|
+
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
12
|
+
i_chr, i_max_nesting, i_allow_nan;
|
13
|
+
|
14
|
+
#define MinusInfinity "-Infinity"
|
15
|
+
|
16
|
+
typedef struct JSON_ParserStruct {
|
17
|
+
VALUE Vsource;
|
18
|
+
char *source;
|
19
|
+
long len;
|
20
|
+
char *memo;
|
21
|
+
VALUE create_id;
|
22
|
+
int max_nesting;
|
23
|
+
int current_nesting;
|
24
|
+
int allow_nan;
|
25
|
+
} JSON_Parser;
|
26
|
+
|
27
|
+
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
28
|
+
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
29
|
+
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
30
|
+
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
31
|
+
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
32
|
+
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
33
|
+
|
34
|
+
#define GET_STRUCT \
|
35
|
+
JSON_Parser *json; \
|
36
|
+
Data_Get_Struct(self, JSON_Parser, json);
|
37
|
+
|
38
|
+
%%{
|
39
|
+
machine JSON_common;
|
40
|
+
|
41
|
+
cr = '\n';
|
42
|
+
cr_neg = [^\n];
|
43
|
+
ws = [ \t\r\n];
|
44
|
+
c_comment = '/*' ( any* - (any* '*/' any* ) ) '*/';
|
45
|
+
cpp_comment = '//' cr_neg* cr;
|
46
|
+
comment = c_comment | cpp_comment;
|
47
|
+
ignore = ws | comment;
|
48
|
+
name_separator = ':';
|
49
|
+
value_separator = ',';
|
50
|
+
Vnull = 'null';
|
51
|
+
Vfalse = 'false';
|
52
|
+
Vtrue = 'true';
|
53
|
+
VNaN = 'NaN';
|
54
|
+
VInfinity = 'Infinity';
|
55
|
+
VMinusInfinity = '-Infinity';
|
56
|
+
begin_value = [nft"\-[{NI] | digit;
|
57
|
+
begin_object = '{';
|
58
|
+
end_object = '}';
|
59
|
+
begin_array = '[';
|
60
|
+
end_array = ']';
|
61
|
+
begin_string = '"';
|
62
|
+
begin_name = begin_string;
|
63
|
+
begin_number = digit | '-';
|
64
|
+
}%%
|
65
|
+
|
66
|
+
%%{
|
67
|
+
machine JSON_object;
|
68
|
+
include JSON_common;
|
69
|
+
|
70
|
+
write data;
|
71
|
+
|
72
|
+
action parse_value {
|
73
|
+
VALUE v = Qnil;
|
74
|
+
char *np = JSON_parse_value(json, fpc, pe, &v);
|
75
|
+
if (np == NULL) {
|
76
|
+
fhold; fbreak;
|
77
|
+
} else {
|
78
|
+
rb_hash_aset(*result, last_name, v);
|
79
|
+
fexec np;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
action parse_name {
|
84
|
+
char *np = JSON_parse_string(json, fpc, pe, &last_name);
|
85
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
86
|
+
}
|
87
|
+
|
88
|
+
action exit { fhold; fbreak; }
|
89
|
+
|
90
|
+
a_pair = ignore* begin_name >parse_name
|
91
|
+
ignore* name_separator ignore*
|
92
|
+
begin_value >parse_value;
|
93
|
+
|
94
|
+
main := begin_object
|
95
|
+
(a_pair (ignore* value_separator a_pair)*)?
|
96
|
+
ignore* end_object @exit;
|
97
|
+
}%%
|
98
|
+
|
99
|
+
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
100
|
+
{
|
101
|
+
int cs = EVIL;
|
102
|
+
VALUE last_name = Qnil;
|
103
|
+
|
104
|
+
if (json->max_nesting && json->current_nesting > json->max_nesting) {
|
105
|
+
rb_raise(eNestingError, "nesting of %d is to deep", json->current_nesting);
|
106
|
+
}
|
107
|
+
|
108
|
+
*result = rb_hash_new();
|
109
|
+
|
110
|
+
%% write init;
|
111
|
+
%% write exec;
|
112
|
+
|
113
|
+
if (cs >= JSON_object_first_final) {
|
114
|
+
if (RTEST(json->create_id)) {
|
115
|
+
VALUE klassname = rb_hash_aref(*result, json->create_id);
|
116
|
+
if (!NIL_P(klassname)) {
|
117
|
+
VALUE klass = rb_path2class(StringValueCStr(klassname));
|
118
|
+
if RTEST(rb_funcall(klass, i_json_creatable_p, 0)) {
|
119
|
+
*result = rb_funcall(klass, i_json_create, 1, *result);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
return p + 1;
|
124
|
+
} else {
|
125
|
+
return NULL;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
%%{
|
130
|
+
machine JSON_value;
|
131
|
+
include JSON_common;
|
132
|
+
|
133
|
+
write data;
|
134
|
+
|
135
|
+
action parse_null {
|
136
|
+
*result = Qnil;
|
137
|
+
}
|
138
|
+
action parse_false {
|
139
|
+
*result = Qfalse;
|
140
|
+
}
|
141
|
+
action parse_true {
|
142
|
+
*result = Qtrue;
|
143
|
+
}
|
144
|
+
action parse_nan {
|
145
|
+
if (json->allow_nan) {
|
146
|
+
*result = CNaN;
|
147
|
+
} else {
|
148
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
|
149
|
+
}
|
150
|
+
}
|
151
|
+
action parse_infinity {
|
152
|
+
if (json->allow_nan) {
|
153
|
+
*result = CInfinity;
|
154
|
+
} else {
|
155
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
action parse_string {
|
159
|
+
char *np = JSON_parse_string(json, fpc, pe, result);
|
160
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
161
|
+
}
|
162
|
+
|
163
|
+
action parse_number {
|
164
|
+
char *np;
|
165
|
+
if(pe > fpc + 9 && !strncmp(MinusInfinity, fpc, 9)) {
|
166
|
+
if (json->allow_nan) {
|
167
|
+
*result = CMinusInfinity;
|
168
|
+
fexec p + 10;
|
169
|
+
fhold; fbreak;
|
170
|
+
} else {
|
171
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
np = JSON_parse_float(json, fpc, pe, result);
|
175
|
+
if (np != NULL) fexec np;
|
176
|
+
np = JSON_parse_integer(json, fpc, pe, result);
|
177
|
+
if (np != NULL) fexec np;
|
178
|
+
fhold; fbreak;
|
179
|
+
}
|
180
|
+
|
181
|
+
action parse_array {
|
182
|
+
char *np;
|
183
|
+
json->current_nesting++;
|
184
|
+
np = JSON_parse_array(json, fpc, pe, result);
|
185
|
+
json->current_nesting--;
|
186
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
187
|
+
}
|
188
|
+
|
189
|
+
action parse_object {
|
190
|
+
char *np;
|
191
|
+
json->current_nesting++;
|
192
|
+
np = JSON_parse_object(json, fpc, pe, result);
|
193
|
+
json->current_nesting--;
|
194
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
195
|
+
}
|
196
|
+
|
197
|
+
action exit { fhold; fbreak; }
|
198
|
+
|
199
|
+
main := (
|
200
|
+
Vnull @parse_null |
|
201
|
+
Vfalse @parse_false |
|
202
|
+
Vtrue @parse_true |
|
203
|
+
VNaN @parse_nan |
|
204
|
+
VInfinity @parse_infinity |
|
205
|
+
begin_number >parse_number |
|
206
|
+
begin_string >parse_string |
|
207
|
+
begin_array >parse_array |
|
208
|
+
begin_object >parse_object
|
209
|
+
) %*exit;
|
210
|
+
}%%
|
211
|
+
|
212
|
+
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
213
|
+
{
|
214
|
+
int cs = EVIL;
|
215
|
+
|
216
|
+
%% write init;
|
217
|
+
%% write exec;
|
218
|
+
|
219
|
+
if (cs >= JSON_value_first_final) {
|
220
|
+
return p;
|
221
|
+
} else {
|
222
|
+
return NULL;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
%%{
|
227
|
+
machine JSON_integer;
|
228
|
+
|
229
|
+
write data;
|
230
|
+
|
231
|
+
action exit { fhold; fbreak; }
|
232
|
+
|
233
|
+
main := '-'? ('0' | [1-9][0-9]*) (^[0-9] @exit);
|
234
|
+
}%%
|
235
|
+
|
236
|
+
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
237
|
+
{
|
238
|
+
int cs = EVIL;
|
239
|
+
|
240
|
+
%% write init;
|
241
|
+
json->memo = p;
|
242
|
+
%% write exec;
|
243
|
+
|
244
|
+
if (cs >= JSON_integer_first_final) {
|
245
|
+
long len = p - json->memo;
|
246
|
+
*result = rb_Integer(rb_str_new(json->memo, len));
|
247
|
+
return p + 1;
|
248
|
+
} else {
|
249
|
+
return NULL;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
%%{
|
254
|
+
machine JSON_float;
|
255
|
+
include JSON_common;
|
256
|
+
|
257
|
+
write data;
|
258
|
+
|
259
|
+
action exit { fhold; fbreak; }
|
260
|
+
|
261
|
+
main := '-'? (
|
262
|
+
(('0' | [1-9][0-9]*) '.' [0-9]+ ([Ee] [+\-]?[0-9]+)?)
|
263
|
+
| (('0' | [1-9][0-9]*) ([Ee] [+\-]?[0-9]+))
|
264
|
+
) (^[0-9Ee.\-] @exit );
|
265
|
+
}%%
|
266
|
+
|
267
|
+
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
268
|
+
{
|
269
|
+
int cs = EVIL;
|
270
|
+
|
271
|
+
%% write init;
|
272
|
+
json->memo = p;
|
273
|
+
%% write exec;
|
274
|
+
|
275
|
+
if (cs >= JSON_float_first_final) {
|
276
|
+
long len = p - json->memo;
|
277
|
+
*result = rb_Float(rb_str_new(json->memo, len));
|
278
|
+
return p + 1;
|
279
|
+
} else {
|
280
|
+
return NULL;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
%%{
|
286
|
+
machine JSON_array;
|
287
|
+
include JSON_common;
|
288
|
+
|
289
|
+
write data;
|
290
|
+
|
291
|
+
action parse_value {
|
292
|
+
VALUE v = Qnil;
|
293
|
+
char *np = JSON_parse_value(json, fpc, pe, &v);
|
294
|
+
if (np == NULL) {
|
295
|
+
fhold; fbreak;
|
296
|
+
} else {
|
297
|
+
rb_ary_push(*result, v);
|
298
|
+
fexec np;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
302
|
+
action exit { fhold; fbreak; }
|
303
|
+
|
304
|
+
next_element = value_separator ignore* begin_value >parse_value;
|
305
|
+
|
306
|
+
main := begin_array ignore*
|
307
|
+
((begin_value >parse_value ignore*)
|
308
|
+
(ignore* next_element ignore*)*)?
|
309
|
+
end_array @exit;
|
310
|
+
}%%
|
311
|
+
|
312
|
+
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
313
|
+
{
|
314
|
+
int cs = EVIL;
|
315
|
+
|
316
|
+
if (json->max_nesting && json->current_nesting > json->max_nesting) {
|
317
|
+
rb_raise(eNestingError, "nesting of %d is to deep", json->current_nesting);
|
318
|
+
}
|
319
|
+
*result = rb_ary_new();
|
320
|
+
|
321
|
+
%% write init;
|
322
|
+
%% write exec;
|
323
|
+
|
324
|
+
if(cs >= JSON_array_first_final) {
|
325
|
+
return p + 1;
|
326
|
+
} else {
|
327
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
static VALUE json_string_unescape(char *p, char *pe)
|
332
|
+
{
|
333
|
+
VALUE result = rb_str_buf_new(pe - p + 1);
|
334
|
+
|
335
|
+
while (p < pe) {
|
336
|
+
if (*p == '\\') {
|
337
|
+
p++;
|
338
|
+
if (p >= pe) return Qnil; /* raise an exception later, \ at end */
|
339
|
+
switch (*p) {
|
340
|
+
case '"':
|
341
|
+
case '\\':
|
342
|
+
rb_str_buf_cat(result, p, 1);
|
343
|
+
p++;
|
344
|
+
break;
|
345
|
+
case 'b':
|
346
|
+
rb_str_buf_cat2(result, "\b");
|
347
|
+
p++;
|
348
|
+
break;
|
349
|
+
case 'f':
|
350
|
+
rb_str_buf_cat2(result, "\f");
|
351
|
+
p++;
|
352
|
+
break;
|
353
|
+
case 'n':
|
354
|
+
rb_str_buf_cat2(result, "\n");
|
355
|
+
p++;
|
356
|
+
break;
|
357
|
+
case 'r':
|
358
|
+
rb_str_buf_cat2(result, "\r");
|
359
|
+
p++;
|
360
|
+
break;
|
361
|
+
case 't':
|
362
|
+
rb_str_buf_cat2(result, "\t");
|
363
|
+
p++;
|
364
|
+
break;
|
365
|
+
case 'u':
|
366
|
+
if (p > pe - 4) {
|
367
|
+
return Qnil;
|
368
|
+
} else {
|
369
|
+
p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion);
|
370
|
+
}
|
371
|
+
break;
|
372
|
+
default:
|
373
|
+
rb_str_buf_cat(result, p, 1);
|
374
|
+
p++;
|
375
|
+
break;
|
376
|
+
}
|
377
|
+
} else {
|
378
|
+
char *q = p;
|
379
|
+
while (*q != '\\' && q < pe) q++;
|
380
|
+
rb_str_buf_cat(result, p, q - p);
|
381
|
+
p = q;
|
382
|
+
}
|
383
|
+
}
|
384
|
+
return result;
|
385
|
+
}
|
386
|
+
|
387
|
+
%%{
|
388
|
+
machine JSON_string;
|
389
|
+
include JSON_common;
|
390
|
+
|
391
|
+
write data;
|
392
|
+
|
393
|
+
action parse_string {
|
394
|
+
*result = json_string_unescape(json->memo + 1, p);
|
395
|
+
if (NIL_P(*result)) { fhold; fbreak; } else fexec p + 1;
|
396
|
+
}
|
397
|
+
|
398
|
+
action exit { fhold; fbreak; }
|
399
|
+
|
400
|
+
main := '"' ((^(["\\] | 0..0x1f) | '\\'["\\/bfnrt] | '\\u'[0-9a-fA-F]{4} | '\\'^(["\\/bfnrtu]|0..0x1f))* %parse_string) '"' @exit;
|
401
|
+
}%%
|
402
|
+
|
403
|
+
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
404
|
+
{
|
405
|
+
int cs = EVIL;
|
406
|
+
|
407
|
+
*result = rb_str_new("", 0);
|
408
|
+
%% write init;
|
409
|
+
json->memo = p;
|
410
|
+
%% write exec;
|
411
|
+
|
412
|
+
if (cs >= JSON_string_first_final) {
|
413
|
+
return p + 1;
|
414
|
+
} else {
|
415
|
+
return NULL;
|
416
|
+
}
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
%%{
|
421
|
+
machine JSON;
|
422
|
+
|
423
|
+
write data;
|
424
|
+
|
425
|
+
include JSON_common;
|
426
|
+
|
427
|
+
action parse_object {
|
428
|
+
char *np;
|
429
|
+
json->current_nesting = 1;
|
430
|
+
np = JSON_parse_object(json, fpc, pe, &result);
|
431
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
432
|
+
}
|
433
|
+
|
434
|
+
action parse_array {
|
435
|
+
char *np;
|
436
|
+
json->current_nesting = 1;
|
437
|
+
np = JSON_parse_array(json, fpc, pe, &result);
|
438
|
+
if (np == NULL) { fhold; fbreak; } else fexec np;
|
439
|
+
}
|
440
|
+
|
441
|
+
main := ignore* (
|
442
|
+
begin_object >parse_object |
|
443
|
+
begin_array >parse_array
|
444
|
+
) ignore*;
|
445
|
+
}%%
|
446
|
+
|
447
|
+
/*
|
448
|
+
* Document-class: JSON::Ext::Parser
|
449
|
+
*
|
450
|
+
* This is the JSON parser implemented as a C extension. It can be configured
|
451
|
+
* to be used by setting
|
452
|
+
*
|
453
|
+
* JSON.parser = JSON::Ext::Parser
|
454
|
+
*
|
455
|
+
* with the method parser= in JSON.
|
456
|
+
*
|
457
|
+
*/
|
458
|
+
|
459
|
+
/*
|
460
|
+
* call-seq: new(source, opts => {})
|
461
|
+
*
|
462
|
+
* Creates a new JSON::Ext::Parser instance for the string _source_.
|
463
|
+
*
|
464
|
+
* Creates a new JSON::Ext::Parser instance for the string _source_.
|
465
|
+
*
|
466
|
+
* It will be configured by the _opts_ hash. _opts_ can have the following
|
467
|
+
* keys:
|
468
|
+
*
|
469
|
+
* _opts_ can have the following keys:
|
470
|
+
* * *max_nesting*: The maximum depth of nesting allowed in the parsed data
|
471
|
+
* structures. Disable depth checking with :max_nesting => false|nil|0, it
|
472
|
+
* defaults to 19.
|
473
|
+
* * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
|
474
|
+
* defiance of RFC 4627 to be parsed by the Parser. This option defaults to
|
475
|
+
* false.
|
476
|
+
* * *create_additions*: If set to false, the Parser doesn't create
|
477
|
+
* additions even if a matchin class and create_id was found. This option
|
478
|
+
* defaults to true.
|
479
|
+
*/
|
480
|
+
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
481
|
+
{
|
482
|
+
char *ptr;
|
483
|
+
long len;
|
484
|
+
VALUE source, opts;
|
485
|
+
GET_STRUCT;
|
486
|
+
rb_scan_args(argc, argv, "11", &source, &opts);
|
487
|
+
source = StringValue(source);
|
488
|
+
ptr = RSTRING_PTR(source);
|
489
|
+
len = RSTRING_LEN(source);
|
490
|
+
if (len < 2) {
|
491
|
+
rb_raise(eParserError, "A JSON text must at least contain two octets!");
|
492
|
+
}
|
493
|
+
if (!NIL_P(opts)) {
|
494
|
+
opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
|
495
|
+
if (NIL_P(opts)) {
|
496
|
+
rb_raise(rb_eArgError, "opts needs to be like a hash");
|
497
|
+
} else {
|
498
|
+
VALUE tmp = ID2SYM(i_max_nesting);
|
499
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
500
|
+
VALUE max_nesting = rb_hash_aref(opts, tmp);
|
501
|
+
if (RTEST(max_nesting)) {
|
502
|
+
Check_Type(max_nesting, T_FIXNUM);
|
503
|
+
json->max_nesting = FIX2INT(max_nesting);
|
504
|
+
} else {
|
505
|
+
json->max_nesting = 0;
|
506
|
+
}
|
507
|
+
} else {
|
508
|
+
json->max_nesting = 19;
|
509
|
+
}
|
510
|
+
tmp = ID2SYM(i_allow_nan);
|
511
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
512
|
+
VALUE allow_nan = rb_hash_aref(opts, tmp);
|
513
|
+
json->allow_nan = RTEST(allow_nan) ? 1 : 0;
|
514
|
+
} else {
|
515
|
+
json->allow_nan = 0;
|
516
|
+
}
|
517
|
+
tmp = ID2SYM(i_create_additions);
|
518
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
519
|
+
VALUE create_additions = rb_hash_aref(opts, tmp);
|
520
|
+
if (RTEST(create_additions)) {
|
521
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
522
|
+
} else {
|
523
|
+
json->create_id = Qnil;
|
524
|
+
}
|
525
|
+
} else {
|
526
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
527
|
+
}
|
528
|
+
}
|
529
|
+
} else {
|
530
|
+
json->max_nesting = 19;
|
531
|
+
json->allow_nan = 0;
|
532
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
533
|
+
}
|
534
|
+
json->current_nesting = 0;
|
535
|
+
/*
|
536
|
+
Convert these?
|
537
|
+
if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
|
538
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
539
|
+
} else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
|
540
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
541
|
+
} else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
|
542
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
543
|
+
} else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
|
544
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
545
|
+
}
|
546
|
+
*/
|
547
|
+
json->len = len;
|
548
|
+
json->source = ptr;
|
549
|
+
json->Vsource = source;
|
550
|
+
return self;
|
551
|
+
}
|
552
|
+
|
553
|
+
/*
|
554
|
+
* call-seq: parse()
|
555
|
+
*
|
556
|
+
* Parses the current JSON text _source_ and returns the complete data
|
557
|
+
* structure as a result.
|
558
|
+
*/
|
559
|
+
static VALUE cParser_parse(VALUE self)
|
560
|
+
{
|
561
|
+
char *p, *pe;
|
562
|
+
int cs = EVIL;
|
563
|
+
VALUE result = Qnil;
|
564
|
+
GET_STRUCT;
|
565
|
+
|
566
|
+
%% write init;
|
567
|
+
p = json->source;
|
568
|
+
pe = p + json->len;
|
569
|
+
%% write exec;
|
570
|
+
|
571
|
+
if (cs >= JSON_first_final && p == pe) {
|
572
|
+
return result;
|
573
|
+
} else {
|
574
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
575
|
+
}
|
576
|
+
}
|
577
|
+
|
578
|
+
inline static JSON_Parser *JSON_allocate()
|
579
|
+
{
|
580
|
+
JSON_Parser *json = ALLOC(JSON_Parser);
|
581
|
+
MEMZERO(json, JSON_Parser, 1);
|
582
|
+
return json;
|
583
|
+
}
|
584
|
+
|
585
|
+
static void JSON_mark(JSON_Parser *json)
|
586
|
+
{
|
587
|
+
rb_gc_mark_maybe(json->Vsource);
|
588
|
+
rb_gc_mark_maybe(json->create_id);
|
589
|
+
}
|
590
|
+
|
591
|
+
static void JSON_free(JSON_Parser *json)
|
592
|
+
{
|
593
|
+
free(json);
|
594
|
+
}
|
595
|
+
|
596
|
+
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
597
|
+
{
|
598
|
+
JSON_Parser *json = JSON_allocate();
|
599
|
+
return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
|
600
|
+
}
|
601
|
+
|
602
|
+
/*
|
603
|
+
* call-seq: source()
|
604
|
+
*
|
605
|
+
* Returns a copy of the current _source_ string, that was used to construct
|
606
|
+
* this Parser.
|
607
|
+
*/
|
608
|
+
static VALUE cParser_source(VALUE self)
|
609
|
+
{
|
610
|
+
GET_STRUCT;
|
611
|
+
return rb_str_dup(json->Vsource);
|
612
|
+
}
|
613
|
+
|
614
|
+
void Init_parser()
|
615
|
+
{
|
616
|
+
rb_require("json/common");
|
617
|
+
mJSON = rb_define_module("JSON");
|
618
|
+
mExt = rb_define_module_under(mJSON, "Ext");
|
619
|
+
cParser = rb_define_class_under(mExt, "Parser", rb_cObject);
|
620
|
+
eParserError = rb_path2class("JSON::ParserError");
|
621
|
+
eNestingError = rb_path2class("JSON::NestingError");
|
622
|
+
rb_define_alloc_func(cParser, cJSON_parser_s_allocate);
|
623
|
+
rb_define_method(cParser, "initialize", cParser_initialize, -1);
|
624
|
+
rb_define_method(cParser, "parse", cParser_parse, 0);
|
625
|
+
rb_define_method(cParser, "source", cParser_source, 0);
|
626
|
+
|
627
|
+
CNaN = rb_const_get(mJSON, rb_intern("NaN"));
|
628
|
+
CInfinity = rb_const_get(mJSON, rb_intern("Infinity"));
|
629
|
+
CMinusInfinity = rb_const_get(mJSON, rb_intern("MinusInfinity"));
|
630
|
+
|
631
|
+
i_json_creatable_p = rb_intern("json_creatable?");
|
632
|
+
i_json_create = rb_intern("json_create");
|
633
|
+
i_create_id = rb_intern("create_id");
|
634
|
+
i_create_additions = rb_intern("create_additions");
|
635
|
+
i_chr = rb_intern("chr");
|
636
|
+
i_max_nesting = rb_intern("max_nesting");
|
637
|
+
i_allow_nan = rb_intern("allow_nan");
|
638
|
+
}
|