factorylabs-castronaut 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +67 -0
- data/Rakefile +78 -0
- data/bin/castronaut +75 -0
- data/config/castronaut.example.yml +41 -0
- data/config/castronaut.sample.yml +40 -0
- data/config/castronaut.yml +40 -0
- data/config/nginx_vhost.conf +17 -0
- data/config/thin_config.yml +13 -0
- data/lib/castronaut.rb +50 -0
- data/lib/castronaut/adapters.rb +13 -0
- data/lib/castronaut/adapters/development/adapter.rb +13 -0
- data/lib/castronaut/adapters/development/user.rb +25 -0
- data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
- data/lib/castronaut/adapters/ldap/user.rb +40 -0
- data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
- data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
- data/lib/castronaut/application.rb +1 -0
- data/lib/castronaut/application/application.rb +70 -0
- data/lib/castronaut/application/public/javascripts/application.js +3 -0
- data/lib/castronaut/application/public/javascripts/jquery.js +32 -0
- data/lib/castronaut/application/public/stylesheets/screen.css +122 -0
- data/lib/castronaut/application/views/layout.erb +27 -0
- data/lib/castronaut/application/views/login.erb +31 -0
- data/lib/castronaut/application/views/logout.erb +13 -0
- data/lib/castronaut/application/views/proxy_validate.erb +21 -0
- data/lib/castronaut/application/views/service_validate.erb +14 -0
- data/lib/castronaut/authentication_result.rb +24 -0
- data/lib/castronaut/configuration.rb +110 -0
- data/lib/castronaut/db/001_create_cas_database.rb +47 -0
- data/lib/castronaut/models/consumeable.rb +18 -0
- data/lib/castronaut/models/dispenser.rb +14 -0
- data/lib/castronaut/models/login_ticket.rb +53 -0
- data/lib/castronaut/models/proxy_granting_ticket.rb +70 -0
- data/lib/castronaut/models/proxy_ticket.rb +43 -0
- data/lib/castronaut/models/service_ticket.rb +91 -0
- data/lib/castronaut/models/ticket_granting_ticket.rb +52 -0
- data/lib/castronaut/presenters/login.rb +84 -0
- data/lib/castronaut/presenters/logout.rb +56 -0
- data/lib/castronaut/presenters/process_login.rb +149 -0
- data/lib/castronaut/presenters/proxy_validate.rb +67 -0
- data/lib/castronaut/presenters/service_validate.rb +68 -0
- data/lib/castronaut/support/sample.rb +21 -0
- data/lib/castronaut/ticket_result.rb +27 -0
- data/lib/castronaut/utilities/random_string.rb +24 -0
- data/spec/app/controllers/application_spec.rb +86 -0
- data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/development/user_spec.rb +55 -0
- data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
- data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
- data/spec/castronaut/adapters_spec.rb +13 -0
- data/spec/castronaut/authentication_result_spec.rb +20 -0
- data/spec/castronaut/configuration_spec.rb +172 -0
- data/spec/castronaut/models/consumeable_spec.rb +39 -0
- data/spec/castronaut/models/dispenser_spec.rb +30 -0
- data/spec/castronaut/models/login_ticket_spec.rb +107 -0
- data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
- data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
- data/spec/castronaut/models/service_ticket_spec.rb +269 -0
- data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
- data/spec/castronaut/presenters/login_spec.rb +152 -0
- data/spec/castronaut/presenters/logout_spec.rb +85 -0
- data/spec/castronaut/presenters/process_login_spec.rb +300 -0
- data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
- data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
- data/spec/castronaut/ticket_result_spec.rb +42 -0
- data/spec/castronaut/utilities/random_string_spec.rb +14 -0
- data/spec/castronaut_spec.rb +26 -0
- data/spec/spec_controller_helper.rb +17 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/spec_rails_mocks.rb +132 -0
- data/vendor/activerecord/CHANGELOG +5786 -0
- data/vendor/activerecord/README +351 -0
- data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
- data/vendor/activerecord/Rakefile +247 -0
- data/vendor/activerecord/examples/associations.png +0 -0
- data/vendor/activerecord/install.rb +30 -0
- data/vendor/activerecord/lib/active_record.rb +81 -0
- data/vendor/activerecord/lib/active_record/aggregations.rb +261 -0
- data/vendor/activerecord/lib/active_record/association_preload.rb +374 -0
- data/vendor/activerecord/lib/active_record/associations.rb +2227 -0
- data/vendor/activerecord/lib/active_record/associations/association_collection.rb +453 -0
- data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +272 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
- data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +256 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +115 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +31 -0
- data/vendor/activerecord/lib/active_record/attribute_methods.rb +387 -0
- data/vendor/activerecord/lib/active_record/base.rb +2967 -0
- data/vendor/activerecord/lib/active_record/calculations.rb +299 -0
- data/vendor/activerecord/lib/active_record/callbacks.rb +331 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
- data/vendor/activerecord/lib/active_record/dirty.rb +183 -0
- data/vendor/activerecord/lib/active_record/dynamic_finder_match.rb +41 -0
- data/vendor/activerecord/lib/active_record/fixtures.rb +998 -0
- data/vendor/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
- data/vendor/activerecord/lib/active_record/locale/en.yml +54 -0
- data/vendor/activerecord/lib/active_record/locking/optimistic.rb +148 -0
- data/vendor/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/vendor/activerecord/lib/active_record/migration.rb +560 -0
- data/vendor/activerecord/lib/active_record/named_scope.rb +181 -0
- data/vendor/activerecord/lib/active_record/observer.rb +197 -0
- data/vendor/activerecord/lib/active_record/query_cache.rb +21 -0
- data/vendor/activerecord/lib/active_record/reflection.rb +307 -0
- data/vendor/activerecord/lib/active_record/schema.rb +51 -0
- data/vendor/activerecord/lib/active_record/schema_dumper.rb +177 -0
- data/vendor/activerecord/lib/active_record/serialization.rb +98 -0
- data/vendor/activerecord/lib/active_record/serializers/json_serializer.rb +80 -0
- data/vendor/activerecord/lib/active_record/serializers/xml_serializer.rb +338 -0
- data/vendor/activerecord/lib/active_record/test_case.rb +60 -0
- data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
- data/vendor/activerecord/lib/active_record/transactions.rb +185 -0
- data/vendor/activerecord/lib/active_record/validations.rb +1061 -0
- data/vendor/activerecord/lib/active_record/version.rb +9 -0
- data/vendor/activerecord/lib/activerecord.rb +1 -0
- data/vendor/activerecord/test/assets/example.log +1 -0
- data/vendor/activerecord/test/assets/flowers.jpg +0 -0
- data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
- data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +100 -0
- data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
- data/vendor/activerecord/test/cases/adapter_test.rb +133 -0
- data/vendor/activerecord/test/cases/aggregations_test.rb +167 -0
- data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
- data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +441 -0
- data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
- data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +101 -0
- data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
- data/vendor/activerecord/test/cases/associations/eager_test.rb +692 -0
- data/vendor/activerecord/test/cases/associations/extension_test.rb +62 -0
- data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +773 -0
- data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1101 -0
- data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +247 -0
- data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +362 -0
- data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
- data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
- data/vendor/activerecord/test/cases/associations_test.rb +262 -0
- data/vendor/activerecord/test/cases/attribute_methods_test.rb +293 -0
- data/vendor/activerecord/test/cases/base_test.rb +2087 -0
- data/vendor/activerecord/test/cases/binary_test.rb +30 -0
- data/vendor/activerecord/test/cases/calculations_test.rb +328 -0
- data/vendor/activerecord/test/cases/callbacks_observers_test.rb +38 -0
- data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
- data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
- data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
- data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
- data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
- data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
- data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
- data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
- data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
- data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
- data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
- data/vendor/activerecord/test/cases/defaults_test.rb +100 -0
- data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
- data/vendor/activerecord/test/cases/dirty_test.rb +270 -0
- data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
- data/vendor/activerecord/test/cases/finder_test.rb +1048 -0
- data/vendor/activerecord/test/cases/fixtures_test.rb +655 -0
- data/vendor/activerecord/test/cases/helper.rb +62 -0
- data/vendor/activerecord/test/cases/i18n_test.rb +41 -0
- data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
- data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
- data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
- data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
- data/vendor/activerecord/test/cases/locking_test.rb +304 -0
- data/vendor/activerecord/test/cases/method_scoping_test.rb +569 -0
- data/vendor/activerecord/test/cases/migration_test.rb +1479 -0
- data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
- data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
- data/vendor/activerecord/test/cases/modules_test.rb +39 -0
- data/vendor/activerecord/test/cases/multiple_db_test.rb +85 -0
- data/vendor/activerecord/test/cases/named_scope_test.rb +280 -0
- data/vendor/activerecord/test/cases/pk_test.rb +101 -0
- data/vendor/activerecord/test/cases/pooled_connections_test.rb +103 -0
- data/vendor/activerecord/test/cases/query_cache_test.rb +127 -0
- data/vendor/activerecord/test/cases/readonly_test.rb +107 -0
- data/vendor/activerecord/test/cases/reflection_test.rb +184 -0
- data/vendor/activerecord/test/cases/reload_models_test.rb +20 -0
- data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
- data/vendor/activerecord/test/cases/sanitize_test.rb +25 -0
- data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
- data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
- data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
- data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
- data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
- data/vendor/activerecord/test/cases/transactions_test.rb +357 -0
- data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
- data/vendor/activerecord/test/cases/validations_i18n_test.rb +921 -0
- data/vendor/activerecord/test/cases/validations_test.rb +1552 -0
- data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
- data/vendor/activerecord/test/config.rb +5 -0
- data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
- data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_mysql/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -0
- data/vendor/activerecord/test/fixtures/accounts.yml +28 -0
- data/vendor/activerecord/test/fixtures/all/developers.yml +0 -0
- data/vendor/activerecord/test/fixtures/all/people.csv +0 -0
- data/vendor/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/vendor/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/vendor/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/vendor/activerecord/test/fixtures/authors.yml +9 -0
- data/vendor/activerecord/test/fixtures/binaries.yml +132 -0
- data/vendor/activerecord/test/fixtures/books.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories.yml +14 -0
- data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/vendor/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories_posts.yml +23 -0
- data/vendor/activerecord/test/fixtures/categorizations.yml +17 -0
- data/vendor/activerecord/test/fixtures/clubs.yml +6 -0
- data/vendor/activerecord/test/fixtures/comments.yml +59 -0
- data/vendor/activerecord/test/fixtures/companies.yml +56 -0
- data/vendor/activerecord/test/fixtures/computers.yml +4 -0
- data/vendor/activerecord/test/fixtures/courses.yml +7 -0
- data/vendor/activerecord/test/fixtures/customers.yml +26 -0
- data/vendor/activerecord/test/fixtures/developers.yml +21 -0
- data/vendor/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/vendor/activerecord/test/fixtures/edges.yml +6 -0
- data/vendor/activerecord/test/fixtures/entrants.yml +14 -0
- data/vendor/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/vendor/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/vendor/activerecord/test/fixtures/items.yml +4 -0
- data/vendor/activerecord/test/fixtures/jobs.yml +7 -0
- data/vendor/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/vendor/activerecord/test/fixtures/mateys.yml +4 -0
- data/vendor/activerecord/test/fixtures/members.yml +4 -0
- data/vendor/activerecord/test/fixtures/memberships.yml +20 -0
- data/vendor/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/vendor/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/vendor/activerecord/test/fixtures/mixins.yml +29 -0
- data/vendor/activerecord/test/fixtures/movies.yml +7 -0
- data/vendor/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/vendor/activerecord/test/fixtures/organizations.yml +5 -0
- data/vendor/activerecord/test/fixtures/owners.yml +7 -0
- data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
- data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/vendor/activerecord/test/fixtures/people.yml +6 -0
- data/vendor/activerecord/test/fixtures/pets.yml +14 -0
- data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
- data/vendor/activerecord/test/fixtures/posts.yml +49 -0
- data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/vendor/activerecord/test/fixtures/projects.yml +7 -0
- data/vendor/activerecord/test/fixtures/readers.yml +9 -0
- data/vendor/activerecord/test/fixtures/references.yml +17 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/vendor/activerecord/test/fixtures/ships.yml +5 -0
- data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
- data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
- data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
- data/vendor/activerecord/test/fixtures/tags.yml +7 -0
- data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
- data/vendor/activerecord/test/fixtures/topics.yml +42 -0
- data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
- data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
- data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/vendor/activerecord/test/migrations/broken/100_migration_that_raises_exception.rb +10 -0
- data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/models/author.rb +140 -0
- data/vendor/activerecord/test/models/auto_id.rb +4 -0
- data/vendor/activerecord/test/models/binary.rb +2 -0
- data/vendor/activerecord/test/models/book.rb +4 -0
- data/vendor/activerecord/test/models/categorization.rb +5 -0
- data/vendor/activerecord/test/models/category.rb +33 -0
- data/vendor/activerecord/test/models/citation.rb +6 -0
- data/vendor/activerecord/test/models/club.rb +13 -0
- data/vendor/activerecord/test/models/column_name.rb +3 -0
- data/vendor/activerecord/test/models/comment.rb +25 -0
- data/vendor/activerecord/test/models/company.rb +156 -0
- data/vendor/activerecord/test/models/company_in_module.rb +61 -0
- data/vendor/activerecord/test/models/computer.rb +3 -0
- data/vendor/activerecord/test/models/contact.rb +16 -0
- data/vendor/activerecord/test/models/course.rb +3 -0
- data/vendor/activerecord/test/models/customer.rb +73 -0
- data/vendor/activerecord/test/models/default.rb +2 -0
- data/vendor/activerecord/test/models/developer.rb +79 -0
- data/vendor/activerecord/test/models/edge.rb +5 -0
- data/vendor/activerecord/test/models/entrant.rb +3 -0
- data/vendor/activerecord/test/models/guid.rb +2 -0
- data/vendor/activerecord/test/models/item.rb +7 -0
- data/vendor/activerecord/test/models/job.rb +5 -0
- data/vendor/activerecord/test/models/joke.rb +3 -0
- data/vendor/activerecord/test/models/keyboard.rb +3 -0
- data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
- data/vendor/activerecord/test/models/matey.rb +4 -0
- data/vendor/activerecord/test/models/member.rb +11 -0
- data/vendor/activerecord/test/models/member_detail.rb +4 -0
- data/vendor/activerecord/test/models/membership.rb +9 -0
- data/vendor/activerecord/test/models/minimalistic.rb +2 -0
- data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/vendor/activerecord/test/models/movie.rb +5 -0
- data/vendor/activerecord/test/models/order.rb +4 -0
- data/vendor/activerecord/test/models/organization.rb +4 -0
- data/vendor/activerecord/test/models/owner.rb +4 -0
- data/vendor/activerecord/test/models/parrot.rb +14 -0
- data/vendor/activerecord/test/models/person.rb +10 -0
- data/vendor/activerecord/test/models/pet.rb +4 -0
- data/vendor/activerecord/test/models/pirate.rb +9 -0
- data/vendor/activerecord/test/models/post.rb +88 -0
- data/vendor/activerecord/test/models/price_estimate.rb +3 -0
- data/vendor/activerecord/test/models/project.rb +29 -0
- data/vendor/activerecord/test/models/reader.rb +4 -0
- data/vendor/activerecord/test/models/reference.rb +4 -0
- data/vendor/activerecord/test/models/reply.rb +39 -0
- data/vendor/activerecord/test/models/ship.rb +3 -0
- data/vendor/activerecord/test/models/sponsor.rb +4 -0
- data/vendor/activerecord/test/models/subject.rb +4 -0
- data/vendor/activerecord/test/models/subscriber.rb +8 -0
- data/vendor/activerecord/test/models/subscription.rb +4 -0
- data/vendor/activerecord/test/models/tag.rb +7 -0
- data/vendor/activerecord/test/models/tagging.rb +10 -0
- data/vendor/activerecord/test/models/task.rb +3 -0
- data/vendor/activerecord/test/models/topic.rb +69 -0
- data/vendor/activerecord/test/models/treasure.rb +6 -0
- data/vendor/activerecord/test/models/vertex.rb +9 -0
- data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
- data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
- data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
- data/vendor/activerecord/test/schema/schema.rb +440 -0
- data/vendor/activerecord/test/schema/schema2.rb +6 -0
- data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
- data/vendor/activesupport/CHANGELOG +1257 -0
- data/vendor/activesupport/README +43 -0
- data/vendor/activesupport/lib/active_support.rb +61 -0
- data/vendor/activesupport/lib/active_support/base64.rb +33 -0
- data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
- data/vendor/activesupport/lib/active_support/buffered_logger.rb +122 -0
- data/vendor/activesupport/lib/active_support/cache.rb +223 -0
- data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
- data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
- data/vendor/activesupport/lib/active_support/cache/file_store.rb +72 -0
- data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +127 -0
- data/vendor/activesupport/lib/active_support/cache/memory_store.rb +52 -0
- data/vendor/activesupport/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/vendor/activesupport/lib/active_support/callbacks.rb +280 -0
- data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +53 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +183 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +106 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +16 -0
- data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
- data/vendor/activesupport/lib/active_support/core_ext/blank.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
- data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +230 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +126 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
- data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +43 -0
- data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
- data/vendor/activesupport/lib/active_support/core_ext/file.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/float.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/time.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +33 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/time.rb +45 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
- data/vendor/activesupport/lib/active_support/core_ext/logger.rb +143 -0
- data/vendor/activesupport/lib/active_support/core_ext/module.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +95 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/object.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +80 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
- data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
- data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +36 -0
- data/vendor/activesupport/lib/active_support/core_ext/string.rb +22 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +167 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +303 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
- data/vendor/activesupport/lib/active_support/dependencies.rb +621 -0
- data/vendor/activesupport/lib/active_support/deprecation.rb +243 -0
- data/vendor/activesupport/lib/active_support/duration.rb +96 -0
- data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
- data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
- data/vendor/activesupport/lib/active_support/inflector.rb +397 -0
- data/vendor/activesupport/lib/active_support/json.rb +23 -0
- data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
- data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
- data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
- data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
- data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
- data/vendor/activesupport/lib/active_support/locale/en.yml +32 -0
- data/vendor/activesupport/lib/active_support/memoizable.rb +82 -0
- data/vendor/activesupport/lib/active_support/multibyte.rb +33 -0
- data/vendor/activesupport/lib/active_support/multibyte/chars.rb +679 -0
- data/vendor/activesupport/lib/active_support/multibyte/exceptions.rb +8 -0
- data/vendor/activesupport/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/vendor/activesupport/lib/active_support/option_merger.rb +17 -0
- data/vendor/activesupport/lib/active_support/ordered_hash.rb +58 -0
- data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
- data/vendor/activesupport/lib/active_support/rescuable.rb +108 -0
- data/vendor/activesupport/lib/active_support/secure_random.rb +197 -0
- data/vendor/activesupport/lib/active_support/string_inquirer.rb +21 -0
- data/vendor/activesupport/lib/active_support/test_case.rb +24 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test.rb +6 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
- data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
- data/vendor/activesupport/lib/active_support/testing/performance.rb +452 -0
- data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +120 -0
- data/vendor/activesupport/lib/active_support/time_with_zone.rb +328 -0
- data/vendor/activesupport/lib/active_support/values/time_zone.rb +403 -0
- data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/activesupport/lib/active_support/vendor.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
- data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/vendor/activesupport/lib/active_support/version.rb +9 -0
- data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
- data/vendor/activesupport/lib/activesupport.rb +1 -0
- data/vendor/isaac/LICENSE +26 -0
- data/vendor/isaac/README +78 -0
- data/vendor/isaac/TODO +3 -0
- data/vendor/isaac/VERSIONS +3 -0
- data/vendor/isaac/crypt/ISAAC.rb +171 -0
- data/vendor/isaac/isaac.gemspec +39 -0
- data/vendor/isaac/setup.rb +596 -0
- data/vendor/isaac/test/TC_ISAAC.rb +76 -0
- data/vendor/json/CHANGES +93 -0
- data/vendor/json/GPL +340 -0
- data/vendor/json/README +78 -0
- data/vendor/json/RUBY +58 -0
- data/vendor/json/Rakefile +309 -0
- data/vendor/json/TODO +1 -0
- data/vendor/json/VERSION +1 -0
- data/vendor/json/benchmarks/benchmark.txt +133 -0
- data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/json/bin/edit_json.rb +10 -0
- data/vendor/json/bin/prettify_json.rb +76 -0
- data/vendor/json/data/example.json +1 -0
- data/vendor/json/data/index.html +38 -0
- data/vendor/json/data/prototype.js +4184 -0
- data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/generator/generator.c +875 -0
- data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json/install.rb +26 -0
- data/vendor/json/lib/json.rb +235 -0
- data/vendor/json/lib/json/Array.xpm +21 -0
- data/vendor/json/lib/json/FalseClass.xpm +21 -0
- data/vendor/json/lib/json/Hash.xpm +21 -0
- data/vendor/json/lib/json/Key.xpm +73 -0
- data/vendor/json/lib/json/NilClass.xpm +21 -0
- data/vendor/json/lib/json/Numeric.xpm +28 -0
- data/vendor/json/lib/json/String.xpm +96 -0
- data/vendor/json/lib/json/TrueClass.xpm +21 -0
- data/vendor/json/lib/json/add/core.rb +135 -0
- data/vendor/json/lib/json/add/rails.rb +58 -0
- data/vendor/json/lib/json/common.rb +354 -0
- data/vendor/json/lib/json/editor.rb +1362 -0
- data/vendor/json/lib/json/ext.rb +13 -0
- data/vendor/json/lib/json/json.xpm +1499 -0
- data/vendor/json/lib/json/pure.rb +75 -0
- data/vendor/json/lib/json/pure/generator.rb +394 -0
- data/vendor/json/lib/json/pure/parser.rb +259 -0
- data/vendor/json/lib/json/version.rb +9 -0
- data/vendor/json/tests/fixtures/fail1.json +1 -0
- data/vendor/json/tests/fixtures/fail10.json +1 -0
- data/vendor/json/tests/fixtures/fail11.json +1 -0
- data/vendor/json/tests/fixtures/fail12.json +1 -0
- data/vendor/json/tests/fixtures/fail13.json +1 -0
- data/vendor/json/tests/fixtures/fail14.json +1 -0
- data/vendor/json/tests/fixtures/fail18.json +1 -0
- data/vendor/json/tests/fixtures/fail19.json +1 -0
- data/vendor/json/tests/fixtures/fail2.json +1 -0
- data/vendor/json/tests/fixtures/fail20.json +1 -0
- data/vendor/json/tests/fixtures/fail21.json +1 -0
- data/vendor/json/tests/fixtures/fail22.json +1 -0
- data/vendor/json/tests/fixtures/fail23.json +1 -0
- data/vendor/json/tests/fixtures/fail24.json +1 -0
- data/vendor/json/tests/fixtures/fail25.json +1 -0
- data/vendor/json/tests/fixtures/fail27.json +2 -0
- data/vendor/json/tests/fixtures/fail28.json +2 -0
- data/vendor/json/tests/fixtures/fail3.json +1 -0
- data/vendor/json/tests/fixtures/fail4.json +1 -0
- data/vendor/json/tests/fixtures/fail5.json +1 -0
- data/vendor/json/tests/fixtures/fail6.json +1 -0
- data/vendor/json/tests/fixtures/fail7.json +1 -0
- data/vendor/json/tests/fixtures/fail8.json +1 -0
- data/vendor/json/tests/fixtures/fail9.json +1 -0
- data/vendor/json/tests/fixtures/pass1.json +56 -0
- data/vendor/json/tests/fixtures/pass15.json +1 -0
- data/vendor/json/tests/fixtures/pass16.json +1 -0
- data/vendor/json/tests/fixtures/pass17.json +1 -0
- data/vendor/json/tests/fixtures/pass2.json +1 -0
- data/vendor/json/tests/fixtures/pass26.json +1 -0
- data/vendor/json/tests/fixtures/pass3.json +6 -0
- data/vendor/json/tests/runner.rb +25 -0
- data/vendor/json/tests/test_json.rb +293 -0
- data/vendor/json/tests/test_json_addition.rb +161 -0
- data/vendor/json/tests/test_json_fixtures.rb +30 -0
- data/vendor/json/tests/test_json_generate.rb +100 -0
- data/vendor/json/tests/test_json_rails.rb +118 -0
- data/vendor/json/tests/test_json_unicode.rb +61 -0
- data/vendor/json/tools/fuzz.rb +140 -0
- data/vendor/json/tools/server.rb +62 -0
- metadata +841 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
#include "unicode.h"
|
2
|
+
|
3
|
+
#define unicode_escape(buffer, character) \
|
4
|
+
snprintf(buf, 7, "\\u%04x", (unsigned int) (character)); \
|
5
|
+
rb_str_buf_cat(buffer, buf, 6);
|
6
|
+
|
7
|
+
/*
|
8
|
+
* Copyright 2001-2004 Unicode, Inc.
|
9
|
+
*
|
10
|
+
* Disclaimer
|
11
|
+
*
|
12
|
+
* This source code is provided as is by Unicode, Inc. No claims are
|
13
|
+
* made as to fitness for any particular purpose. No warranties of any
|
14
|
+
* kind are expressed or implied. The recipient agrees to determine
|
15
|
+
* applicability of information provided. If this file has been
|
16
|
+
* purchased on magnetic or optical media from Unicode, Inc., the
|
17
|
+
* sole remedy for any claim will be exchange of defective media
|
18
|
+
* within 90 days of receipt.
|
19
|
+
*
|
20
|
+
* Limitations on Rights to Redistribute This Code
|
21
|
+
*
|
22
|
+
* Unicode, Inc. hereby grants the right to freely use the information
|
23
|
+
* supplied in this file in the creation of products supporting the
|
24
|
+
* Unicode Standard, and to make copies of this file in any form
|
25
|
+
* for internal or external distribution as long as this notice
|
26
|
+
* remains attached.
|
27
|
+
*/
|
28
|
+
|
29
|
+
/*
|
30
|
+
* Index into the table below with the first byte of a UTF-8 sequence to
|
31
|
+
* get the number of trailing bytes that are supposed to follow it.
|
32
|
+
* Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
|
33
|
+
* left as-is for anyone who may want to do such conversion, which was
|
34
|
+
* allowed in earlier algorithms.
|
35
|
+
*/
|
36
|
+
static const char trailingBytesForUTF8[256] = {
|
37
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
38
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
39
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
40
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
41
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
42
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
43
|
+
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
44
|
+
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
45
|
+
};
|
46
|
+
|
47
|
+
/*
|
48
|
+
* Magic values subtracted from a buffer value during UTF8 conversion.
|
49
|
+
* This table contains as many values as there might be trailing bytes
|
50
|
+
* in a UTF-8 sequence.
|
51
|
+
*/
|
52
|
+
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
53
|
+
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
|
54
|
+
|
55
|
+
/*
|
56
|
+
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
|
57
|
+
* into the first byte, depending on how many bytes follow. There are
|
58
|
+
* as many entries in this table as there are UTF-8 sequence types.
|
59
|
+
* (I.e., one byte sequence, two byte... etc.). Remember that sequencs
|
60
|
+
* for *legal* UTF-8 will be 4 or fewer bytes total.
|
61
|
+
*/
|
62
|
+
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
63
|
+
|
64
|
+
/*
|
65
|
+
* Utility routine to tell whether a sequence of bytes is legal UTF-8.
|
66
|
+
* This must be called with the length pre-determined by the first byte.
|
67
|
+
* If not calling this from ConvertUTF8to*, then the length can be set by:
|
68
|
+
* length = trailingBytesForUTF8[*source]+1;
|
69
|
+
* and the sequence is illegal right away if there aren't that many bytes
|
70
|
+
* available.
|
71
|
+
* If presented with a length > 4, this returns 0. The Unicode
|
72
|
+
* definition of UTF-8 goes up to 4-byte sequences.
|
73
|
+
*/
|
74
|
+
|
75
|
+
inline static unsigned char isLegalUTF8(const UTF8 *source, int length)
|
76
|
+
{
|
77
|
+
UTF8 a;
|
78
|
+
const UTF8 *srcptr = source+length;
|
79
|
+
switch (length) {
|
80
|
+
default: return 0;
|
81
|
+
/* Everything else falls through when "1"... */
|
82
|
+
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
|
83
|
+
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
|
84
|
+
case 2: if ((a = (*--srcptr)) > 0xBF) return 0;
|
85
|
+
|
86
|
+
switch (*source) {
|
87
|
+
/* no fall-through in this inner switch */
|
88
|
+
case 0xE0: if (a < 0xA0) return 0; break;
|
89
|
+
case 0xED: if (a > 0x9F) return 0; break;
|
90
|
+
case 0xF0: if (a < 0x90) return 0; break;
|
91
|
+
case 0xF4: if (a > 0x8F) return 0; break;
|
92
|
+
default: if (a < 0x80) return 0;
|
93
|
+
}
|
94
|
+
|
95
|
+
case 1: if (*source >= 0x80 && *source < 0xC2) return 0;
|
96
|
+
}
|
97
|
+
if (*source > 0xF4) return 0;
|
98
|
+
return 1;
|
99
|
+
}
|
100
|
+
|
101
|
+
void JSON_convert_UTF8_to_JSON(VALUE buffer, VALUE string, ConversionFlags flags)
|
102
|
+
{
|
103
|
+
char buf[7];
|
104
|
+
const UTF8* source = (UTF8 *) RSTRING_PTR(string);
|
105
|
+
const UTF8* sourceEnd = source + RSTRING_LEN(string);
|
106
|
+
|
107
|
+
while (source < sourceEnd) {
|
108
|
+
UTF32 ch = 0;
|
109
|
+
unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
|
110
|
+
if (source + extraBytesToRead >= sourceEnd) {
|
111
|
+
rb_raise(rb_path2class("JSON::GeneratorError"),
|
112
|
+
"partial character in source, but hit end");
|
113
|
+
}
|
114
|
+
if (!isLegalUTF8(source, extraBytesToRead+1)) {
|
115
|
+
rb_raise(rb_path2class("JSON::GeneratorError"),
|
116
|
+
"source sequence is illegal/malformed");
|
117
|
+
}
|
118
|
+
/*
|
119
|
+
* The cases all fall through. See "Note A" below.
|
120
|
+
*/
|
121
|
+
switch (extraBytesToRead) {
|
122
|
+
case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
123
|
+
case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
|
124
|
+
case 3: ch += *source++; ch <<= 6;
|
125
|
+
case 2: ch += *source++; ch <<= 6;
|
126
|
+
case 1: ch += *source++; ch <<= 6;
|
127
|
+
case 0: ch += *source++;
|
128
|
+
}
|
129
|
+
ch -= offsetsFromUTF8[extraBytesToRead];
|
130
|
+
|
131
|
+
if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
|
132
|
+
/* UTF-16 surrogate values are illegal in UTF-32 */
|
133
|
+
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
|
134
|
+
if (flags == strictConversion) {
|
135
|
+
source -= (extraBytesToRead+1); /* return to the illegal value itself */
|
136
|
+
rb_raise(rb_path2class("JSON::GeneratorError"),
|
137
|
+
"source sequence is illegal/malformed");
|
138
|
+
} else {
|
139
|
+
unicode_escape(buffer, UNI_REPLACEMENT_CHAR);
|
140
|
+
}
|
141
|
+
} else {
|
142
|
+
/* normal case */
|
143
|
+
if (ch == '"') {
|
144
|
+
rb_str_buf_cat2(buffer, "\\\"");
|
145
|
+
} else if (ch == '\\') {
|
146
|
+
rb_str_buf_cat2(buffer, "\\\\");
|
147
|
+
} else if (ch == '/') {
|
148
|
+
rb_str_buf_cat2(buffer, "\\/");
|
149
|
+
} else if (ch >= 0x20 && ch <= 0x7f) {
|
150
|
+
rb_str_buf_cat(buffer, (char *) source - 1, 1);
|
151
|
+
} else if (ch == '\n') {
|
152
|
+
rb_str_buf_cat2(buffer, "\\n");
|
153
|
+
} else if (ch == '\r') {
|
154
|
+
rb_str_buf_cat2(buffer, "\\r");
|
155
|
+
} else if (ch == '\t') {
|
156
|
+
rb_str_buf_cat2(buffer, "\\t");
|
157
|
+
} else if (ch == '\f') {
|
158
|
+
rb_str_buf_cat2(buffer, "\\f");
|
159
|
+
} else if (ch == '\b') {
|
160
|
+
rb_str_buf_cat2(buffer, "\\b");
|
161
|
+
} else if (ch < 0x20) {
|
162
|
+
unicode_escape(buffer, (UTF16) ch);
|
163
|
+
} else {
|
164
|
+
unicode_escape(buffer, (UTF16) ch);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
} else if (ch > UNI_MAX_UTF16) {
|
168
|
+
if (flags == strictConversion) {
|
169
|
+
source -= (extraBytesToRead+1); /* return to the start */
|
170
|
+
rb_raise(rb_path2class("JSON::GeneratorError"),
|
171
|
+
"source sequence is illegal/malformed");
|
172
|
+
} else {
|
173
|
+
unicode_escape(buffer, UNI_REPLACEMENT_CHAR);
|
174
|
+
}
|
175
|
+
} else {
|
176
|
+
/* target is a character in range 0xFFFF - 0x10FFFF. */
|
177
|
+
ch -= halfBase;
|
178
|
+
unicode_escape(buffer, (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START));
|
179
|
+
unicode_escape(buffer, (UTF16)((ch & halfMask) + UNI_SUR_LOW_START));
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#include "ruby.h"
|
2
|
+
|
3
|
+
#ifndef _GENERATOR_UNICODE_H_
|
4
|
+
#define _GENERATOR_UNICODE_H_
|
5
|
+
|
6
|
+
typedef enum {
|
7
|
+
conversionOK = 0, /* conversion successful */
|
8
|
+
sourceExhausted, /* partial character in source, but hit end */
|
9
|
+
targetExhausted, /* insuff. room in target for conversion */
|
10
|
+
sourceIllegal /* source sequence is illegal/malformed */
|
11
|
+
} ConversionResult;
|
12
|
+
|
13
|
+
typedef enum {
|
14
|
+
strictConversion = 0,
|
15
|
+
lenientConversion
|
16
|
+
} ConversionFlags;
|
17
|
+
|
18
|
+
typedef unsigned long UTF32; /* at least 32 bits */
|
19
|
+
typedef unsigned short UTF16; /* at least 16 bits */
|
20
|
+
typedef unsigned char UTF8; /* typically 8 bits */
|
21
|
+
|
22
|
+
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
23
|
+
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
24
|
+
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
25
|
+
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
26
|
+
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
27
|
+
|
28
|
+
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
29
|
+
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
30
|
+
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
31
|
+
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
32
|
+
|
33
|
+
static const int halfShift = 10; /* used for shifting by 10 bits */
|
34
|
+
|
35
|
+
static const UTF32 halfBase = 0x0010000UL;
|
36
|
+
static const UTF32 halfMask = 0x3FFUL;
|
37
|
+
|
38
|
+
void JSON_convert_UTF8_to_JSON(VALUE buffer, VALUE string, ConversionFlags flags);
|
39
|
+
|
40
|
+
#ifndef RARRAY_PTR
|
41
|
+
#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
|
42
|
+
#endif
|
43
|
+
#ifndef RARRAY_LEN
|
44
|
+
#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
|
45
|
+
#endif
|
46
|
+
#ifndef RSTRING_PTR
|
47
|
+
#define RSTRING_PTR(string) RSTRING(string)->ptr
|
48
|
+
#endif
|
49
|
+
#ifndef RSTRING_LEN
|
50
|
+
#define RSTRING_LEN(string) RSTRING(string)->len
|
51
|
+
#endif
|
52
|
+
|
53
|
+
#endif
|
@@ -0,0 +1,1758 @@
|
|
1
|
+
#line 1 "parser.rl"
|
2
|
+
#include "ruby.h"
|
3
|
+
#include "re.h"
|
4
|
+
#include "st.h"
|
5
|
+
#include "unicode.h"
|
6
|
+
|
7
|
+
#define EVIL 0x666
|
8
|
+
|
9
|
+
static VALUE mJSON, mExt, cParser, eParserError, eNestingError;
|
10
|
+
static VALUE CNaN, CInfinity, CMinusInfinity;
|
11
|
+
|
12
|
+
static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
13
|
+
i_chr, i_max_nesting, i_allow_nan;
|
14
|
+
|
15
|
+
#define MinusInfinity "-Infinity"
|
16
|
+
|
17
|
+
typedef struct JSON_ParserStruct {
|
18
|
+
VALUE Vsource;
|
19
|
+
char *source;
|
20
|
+
long len;
|
21
|
+
char *memo;
|
22
|
+
VALUE create_id;
|
23
|
+
int max_nesting;
|
24
|
+
int current_nesting;
|
25
|
+
int allow_nan;
|
26
|
+
} JSON_Parser;
|
27
|
+
|
28
|
+
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
29
|
+
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
30
|
+
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
31
|
+
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
32
|
+
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
33
|
+
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
|
34
|
+
|
35
|
+
#define GET_STRUCT \
|
36
|
+
JSON_Parser *json; \
|
37
|
+
Data_Get_Struct(self, JSON_Parser, json);
|
38
|
+
|
39
|
+
#line 64 "parser.rl"
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
#line 44 "parser.c"
|
44
|
+
static const int JSON_object_start = 1;
|
45
|
+
static const int JSON_object_first_final = 27;
|
46
|
+
static const int JSON_object_error = 0;
|
47
|
+
|
48
|
+
static const int JSON_object_en_main = 1;
|
49
|
+
|
50
|
+
#line 97 "parser.rl"
|
51
|
+
|
52
|
+
|
53
|
+
static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
54
|
+
{
|
55
|
+
int cs = EVIL;
|
56
|
+
VALUE last_name = Qnil;
|
57
|
+
|
58
|
+
if (json->max_nesting && json->current_nesting > json->max_nesting) {
|
59
|
+
rb_raise(eNestingError, "nesting of %d is to deep", json->current_nesting);
|
60
|
+
}
|
61
|
+
|
62
|
+
*result = rb_hash_new();
|
63
|
+
|
64
|
+
|
65
|
+
#line 66 "parser.c"
|
66
|
+
{
|
67
|
+
cs = JSON_object_start;
|
68
|
+
}
|
69
|
+
#line 111 "parser.rl"
|
70
|
+
|
71
|
+
#line 72 "parser.c"
|
72
|
+
{
|
73
|
+
if ( p == pe )
|
74
|
+
goto _test_eof;
|
75
|
+
switch ( cs )
|
76
|
+
{
|
77
|
+
case 1:
|
78
|
+
if ( (*p) == 123 )
|
79
|
+
goto st2;
|
80
|
+
goto st0;
|
81
|
+
st0:
|
82
|
+
cs = 0;
|
83
|
+
goto _out;
|
84
|
+
st2:
|
85
|
+
if ( ++p == pe )
|
86
|
+
goto _test_eof2;
|
87
|
+
case 2:
|
88
|
+
switch( (*p) ) {
|
89
|
+
case 13: goto st2;
|
90
|
+
case 32: goto st2;
|
91
|
+
case 34: goto tr2;
|
92
|
+
case 47: goto st23;
|
93
|
+
case 125: goto tr4;
|
94
|
+
}
|
95
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
96
|
+
goto st2;
|
97
|
+
goto st0;
|
98
|
+
tr2:
|
99
|
+
#line 83 "parser.rl"
|
100
|
+
{
|
101
|
+
char *np = JSON_parse_string(json, p, pe, &last_name);
|
102
|
+
if (np == NULL) { p--; {p++; cs = 3; goto _out;} } else {p = (( np))-1;}
|
103
|
+
}
|
104
|
+
goto st3;
|
105
|
+
st3:
|
106
|
+
if ( ++p == pe )
|
107
|
+
goto _test_eof3;
|
108
|
+
case 3:
|
109
|
+
#line 110 "parser.c"
|
110
|
+
switch( (*p) ) {
|
111
|
+
case 13: goto st3;
|
112
|
+
case 32: goto st3;
|
113
|
+
case 47: goto st4;
|
114
|
+
case 58: goto st8;
|
115
|
+
}
|
116
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
117
|
+
goto st3;
|
118
|
+
goto st0;
|
119
|
+
st4:
|
120
|
+
if ( ++p == pe )
|
121
|
+
goto _test_eof4;
|
122
|
+
case 4:
|
123
|
+
switch( (*p) ) {
|
124
|
+
case 42: goto st5;
|
125
|
+
case 47: goto st7;
|
126
|
+
}
|
127
|
+
goto st0;
|
128
|
+
st5:
|
129
|
+
if ( ++p == pe )
|
130
|
+
goto _test_eof5;
|
131
|
+
case 5:
|
132
|
+
if ( (*p) == 42 )
|
133
|
+
goto st6;
|
134
|
+
goto st5;
|
135
|
+
st6:
|
136
|
+
if ( ++p == pe )
|
137
|
+
goto _test_eof6;
|
138
|
+
case 6:
|
139
|
+
switch( (*p) ) {
|
140
|
+
case 42: goto st6;
|
141
|
+
case 47: goto st3;
|
142
|
+
}
|
143
|
+
goto st5;
|
144
|
+
st7:
|
145
|
+
if ( ++p == pe )
|
146
|
+
goto _test_eof7;
|
147
|
+
case 7:
|
148
|
+
if ( (*p) == 10 )
|
149
|
+
goto st3;
|
150
|
+
goto st7;
|
151
|
+
st8:
|
152
|
+
if ( ++p == pe )
|
153
|
+
goto _test_eof8;
|
154
|
+
case 8:
|
155
|
+
switch( (*p) ) {
|
156
|
+
case 13: goto st8;
|
157
|
+
case 32: goto st8;
|
158
|
+
case 34: goto tr11;
|
159
|
+
case 45: goto tr11;
|
160
|
+
case 47: goto st19;
|
161
|
+
case 73: goto tr11;
|
162
|
+
case 78: goto tr11;
|
163
|
+
case 91: goto tr11;
|
164
|
+
case 102: goto tr11;
|
165
|
+
case 110: goto tr11;
|
166
|
+
case 116: goto tr11;
|
167
|
+
case 123: goto tr11;
|
168
|
+
}
|
169
|
+
if ( (*p) > 10 ) {
|
170
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
171
|
+
goto tr11;
|
172
|
+
} else if ( (*p) >= 9 )
|
173
|
+
goto st8;
|
174
|
+
goto st0;
|
175
|
+
tr11:
|
176
|
+
#line 72 "parser.rl"
|
177
|
+
{
|
178
|
+
VALUE v = Qnil;
|
179
|
+
char *np = JSON_parse_value(json, p, pe, &v);
|
180
|
+
if (np == NULL) {
|
181
|
+
p--; {p++; cs = 9; goto _out;}
|
182
|
+
} else {
|
183
|
+
rb_hash_aset(*result, last_name, v);
|
184
|
+
{p = (( np))-1;}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
goto st9;
|
188
|
+
st9:
|
189
|
+
if ( ++p == pe )
|
190
|
+
goto _test_eof9;
|
191
|
+
case 9:
|
192
|
+
#line 193 "parser.c"
|
193
|
+
switch( (*p) ) {
|
194
|
+
case 13: goto st9;
|
195
|
+
case 32: goto st9;
|
196
|
+
case 44: goto st10;
|
197
|
+
case 47: goto st15;
|
198
|
+
case 125: goto tr4;
|
199
|
+
}
|
200
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
201
|
+
goto st9;
|
202
|
+
goto st0;
|
203
|
+
st10:
|
204
|
+
if ( ++p == pe )
|
205
|
+
goto _test_eof10;
|
206
|
+
case 10:
|
207
|
+
switch( (*p) ) {
|
208
|
+
case 13: goto st10;
|
209
|
+
case 32: goto st10;
|
210
|
+
case 34: goto tr2;
|
211
|
+
case 47: goto st11;
|
212
|
+
}
|
213
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
214
|
+
goto st10;
|
215
|
+
goto st0;
|
216
|
+
st11:
|
217
|
+
if ( ++p == pe )
|
218
|
+
goto _test_eof11;
|
219
|
+
case 11:
|
220
|
+
switch( (*p) ) {
|
221
|
+
case 42: goto st12;
|
222
|
+
case 47: goto st14;
|
223
|
+
}
|
224
|
+
goto st0;
|
225
|
+
st12:
|
226
|
+
if ( ++p == pe )
|
227
|
+
goto _test_eof12;
|
228
|
+
case 12:
|
229
|
+
if ( (*p) == 42 )
|
230
|
+
goto st13;
|
231
|
+
goto st12;
|
232
|
+
st13:
|
233
|
+
if ( ++p == pe )
|
234
|
+
goto _test_eof13;
|
235
|
+
case 13:
|
236
|
+
switch( (*p) ) {
|
237
|
+
case 42: goto st13;
|
238
|
+
case 47: goto st10;
|
239
|
+
}
|
240
|
+
goto st12;
|
241
|
+
st14:
|
242
|
+
if ( ++p == pe )
|
243
|
+
goto _test_eof14;
|
244
|
+
case 14:
|
245
|
+
if ( (*p) == 10 )
|
246
|
+
goto st10;
|
247
|
+
goto st14;
|
248
|
+
st15:
|
249
|
+
if ( ++p == pe )
|
250
|
+
goto _test_eof15;
|
251
|
+
case 15:
|
252
|
+
switch( (*p) ) {
|
253
|
+
case 42: goto st16;
|
254
|
+
case 47: goto st18;
|
255
|
+
}
|
256
|
+
goto st0;
|
257
|
+
st16:
|
258
|
+
if ( ++p == pe )
|
259
|
+
goto _test_eof16;
|
260
|
+
case 16:
|
261
|
+
if ( (*p) == 42 )
|
262
|
+
goto st17;
|
263
|
+
goto st16;
|
264
|
+
st17:
|
265
|
+
if ( ++p == pe )
|
266
|
+
goto _test_eof17;
|
267
|
+
case 17:
|
268
|
+
switch( (*p) ) {
|
269
|
+
case 42: goto st17;
|
270
|
+
case 47: goto st9;
|
271
|
+
}
|
272
|
+
goto st16;
|
273
|
+
st18:
|
274
|
+
if ( ++p == pe )
|
275
|
+
goto _test_eof18;
|
276
|
+
case 18:
|
277
|
+
if ( (*p) == 10 )
|
278
|
+
goto st9;
|
279
|
+
goto st18;
|
280
|
+
tr4:
|
281
|
+
#line 88 "parser.rl"
|
282
|
+
{ p--; {p++; cs = 27; goto _out;} }
|
283
|
+
goto st27;
|
284
|
+
st27:
|
285
|
+
if ( ++p == pe )
|
286
|
+
goto _test_eof27;
|
287
|
+
case 27:
|
288
|
+
#line 289 "parser.c"
|
289
|
+
goto st0;
|
290
|
+
st19:
|
291
|
+
if ( ++p == pe )
|
292
|
+
goto _test_eof19;
|
293
|
+
case 19:
|
294
|
+
switch( (*p) ) {
|
295
|
+
case 42: goto st20;
|
296
|
+
case 47: goto st22;
|
297
|
+
}
|
298
|
+
goto st0;
|
299
|
+
st20:
|
300
|
+
if ( ++p == pe )
|
301
|
+
goto _test_eof20;
|
302
|
+
case 20:
|
303
|
+
if ( (*p) == 42 )
|
304
|
+
goto st21;
|
305
|
+
goto st20;
|
306
|
+
st21:
|
307
|
+
if ( ++p == pe )
|
308
|
+
goto _test_eof21;
|
309
|
+
case 21:
|
310
|
+
switch( (*p) ) {
|
311
|
+
case 42: goto st21;
|
312
|
+
case 47: goto st8;
|
313
|
+
}
|
314
|
+
goto st20;
|
315
|
+
st22:
|
316
|
+
if ( ++p == pe )
|
317
|
+
goto _test_eof22;
|
318
|
+
case 22:
|
319
|
+
if ( (*p) == 10 )
|
320
|
+
goto st8;
|
321
|
+
goto st22;
|
322
|
+
st23:
|
323
|
+
if ( ++p == pe )
|
324
|
+
goto _test_eof23;
|
325
|
+
case 23:
|
326
|
+
switch( (*p) ) {
|
327
|
+
case 42: goto st24;
|
328
|
+
case 47: goto st26;
|
329
|
+
}
|
330
|
+
goto st0;
|
331
|
+
st24:
|
332
|
+
if ( ++p == pe )
|
333
|
+
goto _test_eof24;
|
334
|
+
case 24:
|
335
|
+
if ( (*p) == 42 )
|
336
|
+
goto st25;
|
337
|
+
goto st24;
|
338
|
+
st25:
|
339
|
+
if ( ++p == pe )
|
340
|
+
goto _test_eof25;
|
341
|
+
case 25:
|
342
|
+
switch( (*p) ) {
|
343
|
+
case 42: goto st25;
|
344
|
+
case 47: goto st2;
|
345
|
+
}
|
346
|
+
goto st24;
|
347
|
+
st26:
|
348
|
+
if ( ++p == pe )
|
349
|
+
goto _test_eof26;
|
350
|
+
case 26:
|
351
|
+
if ( (*p) == 10 )
|
352
|
+
goto st2;
|
353
|
+
goto st26;
|
354
|
+
}
|
355
|
+
_test_eof2: cs = 2; goto _test_eof;
|
356
|
+
_test_eof3: cs = 3; goto _test_eof;
|
357
|
+
_test_eof4: cs = 4; goto _test_eof;
|
358
|
+
_test_eof5: cs = 5; goto _test_eof;
|
359
|
+
_test_eof6: cs = 6; goto _test_eof;
|
360
|
+
_test_eof7: cs = 7; goto _test_eof;
|
361
|
+
_test_eof8: cs = 8; goto _test_eof;
|
362
|
+
_test_eof9: cs = 9; goto _test_eof;
|
363
|
+
_test_eof10: cs = 10; goto _test_eof;
|
364
|
+
_test_eof11: cs = 11; goto _test_eof;
|
365
|
+
_test_eof12: cs = 12; goto _test_eof;
|
366
|
+
_test_eof13: cs = 13; goto _test_eof;
|
367
|
+
_test_eof14: cs = 14; goto _test_eof;
|
368
|
+
_test_eof15: cs = 15; goto _test_eof;
|
369
|
+
_test_eof16: cs = 16; goto _test_eof;
|
370
|
+
_test_eof17: cs = 17; goto _test_eof;
|
371
|
+
_test_eof18: cs = 18; goto _test_eof;
|
372
|
+
_test_eof27: cs = 27; goto _test_eof;
|
373
|
+
_test_eof19: cs = 19; goto _test_eof;
|
374
|
+
_test_eof20: cs = 20; goto _test_eof;
|
375
|
+
_test_eof21: cs = 21; goto _test_eof;
|
376
|
+
_test_eof22: cs = 22; goto _test_eof;
|
377
|
+
_test_eof23: cs = 23; goto _test_eof;
|
378
|
+
_test_eof24: cs = 24; goto _test_eof;
|
379
|
+
_test_eof25: cs = 25; goto _test_eof;
|
380
|
+
_test_eof26: cs = 26; goto _test_eof;
|
381
|
+
|
382
|
+
_test_eof: {}
|
383
|
+
_out: {}
|
384
|
+
}
|
385
|
+
#line 112 "parser.rl"
|
386
|
+
|
387
|
+
if (cs >= JSON_object_first_final) {
|
388
|
+
if (RTEST(json->create_id)) {
|
389
|
+
VALUE klassname = rb_hash_aref(*result, json->create_id);
|
390
|
+
if (!NIL_P(klassname)) {
|
391
|
+
VALUE klass = rb_path2class(StringValueCStr(klassname));
|
392
|
+
if RTEST(rb_funcall(klass, i_json_creatable_p, 0)) {
|
393
|
+
*result = rb_funcall(klass, i_json_create, 1, *result);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
}
|
397
|
+
return p + 1;
|
398
|
+
} else {
|
399
|
+
return NULL;
|
400
|
+
}
|
401
|
+
}
|
402
|
+
|
403
|
+
|
404
|
+
#line 405 "parser.c"
|
405
|
+
static const int JSON_value_start = 1;
|
406
|
+
static const int JSON_value_first_final = 21;
|
407
|
+
static const int JSON_value_error = 0;
|
408
|
+
|
409
|
+
static const int JSON_value_en_main = 1;
|
410
|
+
|
411
|
+
#line 210 "parser.rl"
|
412
|
+
|
413
|
+
|
414
|
+
static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
415
|
+
{
|
416
|
+
int cs = EVIL;
|
417
|
+
|
418
|
+
|
419
|
+
#line 420 "parser.c"
|
420
|
+
{
|
421
|
+
cs = JSON_value_start;
|
422
|
+
}
|
423
|
+
#line 217 "parser.rl"
|
424
|
+
|
425
|
+
#line 426 "parser.c"
|
426
|
+
{
|
427
|
+
if ( p == pe )
|
428
|
+
goto _test_eof;
|
429
|
+
switch ( cs )
|
430
|
+
{
|
431
|
+
case 1:
|
432
|
+
switch( (*p) ) {
|
433
|
+
case 34: goto tr0;
|
434
|
+
case 45: goto tr2;
|
435
|
+
case 73: goto st2;
|
436
|
+
case 78: goto st9;
|
437
|
+
case 91: goto tr5;
|
438
|
+
case 102: goto st11;
|
439
|
+
case 110: goto st15;
|
440
|
+
case 116: goto st18;
|
441
|
+
case 123: goto tr9;
|
442
|
+
}
|
443
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
444
|
+
goto tr2;
|
445
|
+
goto st0;
|
446
|
+
st0:
|
447
|
+
cs = 0;
|
448
|
+
goto _out;
|
449
|
+
tr0:
|
450
|
+
#line 158 "parser.rl"
|
451
|
+
{
|
452
|
+
char *np = JSON_parse_string(json, p, pe, result);
|
453
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
454
|
+
}
|
455
|
+
goto st21;
|
456
|
+
tr2:
|
457
|
+
#line 163 "parser.rl"
|
458
|
+
{
|
459
|
+
char *np;
|
460
|
+
if(pe > p + 9 && !strncmp(MinusInfinity, p, 9)) {
|
461
|
+
if (json->allow_nan) {
|
462
|
+
*result = CMinusInfinity;
|
463
|
+
{p = (( p + 10))-1;}
|
464
|
+
p--; {p++; cs = 21; goto _out;}
|
465
|
+
} else {
|
466
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
np = JSON_parse_float(json, p, pe, result);
|
470
|
+
if (np != NULL) {p = (( np))-1;}
|
471
|
+
np = JSON_parse_integer(json, p, pe, result);
|
472
|
+
if (np != NULL) {p = (( np))-1;}
|
473
|
+
p--; {p++; cs = 21; goto _out;}
|
474
|
+
}
|
475
|
+
goto st21;
|
476
|
+
tr5:
|
477
|
+
#line 181 "parser.rl"
|
478
|
+
{
|
479
|
+
char *np;
|
480
|
+
json->current_nesting++;
|
481
|
+
np = JSON_parse_array(json, p, pe, result);
|
482
|
+
json->current_nesting--;
|
483
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
484
|
+
}
|
485
|
+
goto st21;
|
486
|
+
tr9:
|
487
|
+
#line 189 "parser.rl"
|
488
|
+
{
|
489
|
+
char *np;
|
490
|
+
json->current_nesting++;
|
491
|
+
np = JSON_parse_object(json, p, pe, result);
|
492
|
+
json->current_nesting--;
|
493
|
+
if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;}
|
494
|
+
}
|
495
|
+
goto st21;
|
496
|
+
tr16:
|
497
|
+
#line 151 "parser.rl"
|
498
|
+
{
|
499
|
+
if (json->allow_nan) {
|
500
|
+
*result = CInfinity;
|
501
|
+
} else {
|
502
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 8);
|
503
|
+
}
|
504
|
+
}
|
505
|
+
goto st21;
|
506
|
+
tr18:
|
507
|
+
#line 144 "parser.rl"
|
508
|
+
{
|
509
|
+
if (json->allow_nan) {
|
510
|
+
*result = CNaN;
|
511
|
+
} else {
|
512
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p - 2);
|
513
|
+
}
|
514
|
+
}
|
515
|
+
goto st21;
|
516
|
+
tr22:
|
517
|
+
#line 138 "parser.rl"
|
518
|
+
{
|
519
|
+
*result = Qfalse;
|
520
|
+
}
|
521
|
+
goto st21;
|
522
|
+
tr25:
|
523
|
+
#line 135 "parser.rl"
|
524
|
+
{
|
525
|
+
*result = Qnil;
|
526
|
+
}
|
527
|
+
goto st21;
|
528
|
+
tr28:
|
529
|
+
#line 141 "parser.rl"
|
530
|
+
{
|
531
|
+
*result = Qtrue;
|
532
|
+
}
|
533
|
+
goto st21;
|
534
|
+
st21:
|
535
|
+
if ( ++p == pe )
|
536
|
+
goto _test_eof21;
|
537
|
+
case 21:
|
538
|
+
#line 197 "parser.rl"
|
539
|
+
{ p--; {p++; cs = 21; goto _out;} }
|
540
|
+
#line 541 "parser.c"
|
541
|
+
goto st0;
|
542
|
+
st2:
|
543
|
+
if ( ++p == pe )
|
544
|
+
goto _test_eof2;
|
545
|
+
case 2:
|
546
|
+
if ( (*p) == 110 )
|
547
|
+
goto st3;
|
548
|
+
goto st0;
|
549
|
+
st3:
|
550
|
+
if ( ++p == pe )
|
551
|
+
goto _test_eof3;
|
552
|
+
case 3:
|
553
|
+
if ( (*p) == 102 )
|
554
|
+
goto st4;
|
555
|
+
goto st0;
|
556
|
+
st4:
|
557
|
+
if ( ++p == pe )
|
558
|
+
goto _test_eof4;
|
559
|
+
case 4:
|
560
|
+
if ( (*p) == 105 )
|
561
|
+
goto st5;
|
562
|
+
goto st0;
|
563
|
+
st5:
|
564
|
+
if ( ++p == pe )
|
565
|
+
goto _test_eof5;
|
566
|
+
case 5:
|
567
|
+
if ( (*p) == 110 )
|
568
|
+
goto st6;
|
569
|
+
goto st0;
|
570
|
+
st6:
|
571
|
+
if ( ++p == pe )
|
572
|
+
goto _test_eof6;
|
573
|
+
case 6:
|
574
|
+
if ( (*p) == 105 )
|
575
|
+
goto st7;
|
576
|
+
goto st0;
|
577
|
+
st7:
|
578
|
+
if ( ++p == pe )
|
579
|
+
goto _test_eof7;
|
580
|
+
case 7:
|
581
|
+
if ( (*p) == 116 )
|
582
|
+
goto st8;
|
583
|
+
goto st0;
|
584
|
+
st8:
|
585
|
+
if ( ++p == pe )
|
586
|
+
goto _test_eof8;
|
587
|
+
case 8:
|
588
|
+
if ( (*p) == 121 )
|
589
|
+
goto tr16;
|
590
|
+
goto st0;
|
591
|
+
st9:
|
592
|
+
if ( ++p == pe )
|
593
|
+
goto _test_eof9;
|
594
|
+
case 9:
|
595
|
+
if ( (*p) == 97 )
|
596
|
+
goto st10;
|
597
|
+
goto st0;
|
598
|
+
st10:
|
599
|
+
if ( ++p == pe )
|
600
|
+
goto _test_eof10;
|
601
|
+
case 10:
|
602
|
+
if ( (*p) == 78 )
|
603
|
+
goto tr18;
|
604
|
+
goto st0;
|
605
|
+
st11:
|
606
|
+
if ( ++p == pe )
|
607
|
+
goto _test_eof11;
|
608
|
+
case 11:
|
609
|
+
if ( (*p) == 97 )
|
610
|
+
goto st12;
|
611
|
+
goto st0;
|
612
|
+
st12:
|
613
|
+
if ( ++p == pe )
|
614
|
+
goto _test_eof12;
|
615
|
+
case 12:
|
616
|
+
if ( (*p) == 108 )
|
617
|
+
goto st13;
|
618
|
+
goto st0;
|
619
|
+
st13:
|
620
|
+
if ( ++p == pe )
|
621
|
+
goto _test_eof13;
|
622
|
+
case 13:
|
623
|
+
if ( (*p) == 115 )
|
624
|
+
goto st14;
|
625
|
+
goto st0;
|
626
|
+
st14:
|
627
|
+
if ( ++p == pe )
|
628
|
+
goto _test_eof14;
|
629
|
+
case 14:
|
630
|
+
if ( (*p) == 101 )
|
631
|
+
goto tr22;
|
632
|
+
goto st0;
|
633
|
+
st15:
|
634
|
+
if ( ++p == pe )
|
635
|
+
goto _test_eof15;
|
636
|
+
case 15:
|
637
|
+
if ( (*p) == 117 )
|
638
|
+
goto st16;
|
639
|
+
goto st0;
|
640
|
+
st16:
|
641
|
+
if ( ++p == pe )
|
642
|
+
goto _test_eof16;
|
643
|
+
case 16:
|
644
|
+
if ( (*p) == 108 )
|
645
|
+
goto st17;
|
646
|
+
goto st0;
|
647
|
+
st17:
|
648
|
+
if ( ++p == pe )
|
649
|
+
goto _test_eof17;
|
650
|
+
case 17:
|
651
|
+
if ( (*p) == 108 )
|
652
|
+
goto tr25;
|
653
|
+
goto st0;
|
654
|
+
st18:
|
655
|
+
if ( ++p == pe )
|
656
|
+
goto _test_eof18;
|
657
|
+
case 18:
|
658
|
+
if ( (*p) == 114 )
|
659
|
+
goto st19;
|
660
|
+
goto st0;
|
661
|
+
st19:
|
662
|
+
if ( ++p == pe )
|
663
|
+
goto _test_eof19;
|
664
|
+
case 19:
|
665
|
+
if ( (*p) == 117 )
|
666
|
+
goto st20;
|
667
|
+
goto st0;
|
668
|
+
st20:
|
669
|
+
if ( ++p == pe )
|
670
|
+
goto _test_eof20;
|
671
|
+
case 20:
|
672
|
+
if ( (*p) == 101 )
|
673
|
+
goto tr28;
|
674
|
+
goto st0;
|
675
|
+
}
|
676
|
+
_test_eof21: cs = 21; goto _test_eof;
|
677
|
+
_test_eof2: cs = 2; goto _test_eof;
|
678
|
+
_test_eof3: cs = 3; goto _test_eof;
|
679
|
+
_test_eof4: cs = 4; goto _test_eof;
|
680
|
+
_test_eof5: cs = 5; goto _test_eof;
|
681
|
+
_test_eof6: cs = 6; goto _test_eof;
|
682
|
+
_test_eof7: cs = 7; goto _test_eof;
|
683
|
+
_test_eof8: cs = 8; goto _test_eof;
|
684
|
+
_test_eof9: cs = 9; goto _test_eof;
|
685
|
+
_test_eof10: cs = 10; goto _test_eof;
|
686
|
+
_test_eof11: cs = 11; goto _test_eof;
|
687
|
+
_test_eof12: cs = 12; goto _test_eof;
|
688
|
+
_test_eof13: cs = 13; goto _test_eof;
|
689
|
+
_test_eof14: cs = 14; goto _test_eof;
|
690
|
+
_test_eof15: cs = 15; goto _test_eof;
|
691
|
+
_test_eof16: cs = 16; goto _test_eof;
|
692
|
+
_test_eof17: cs = 17; goto _test_eof;
|
693
|
+
_test_eof18: cs = 18; goto _test_eof;
|
694
|
+
_test_eof19: cs = 19; goto _test_eof;
|
695
|
+
_test_eof20: cs = 20; goto _test_eof;
|
696
|
+
|
697
|
+
_test_eof: {}
|
698
|
+
_out: {}
|
699
|
+
}
|
700
|
+
#line 218 "parser.rl"
|
701
|
+
|
702
|
+
if (cs >= JSON_value_first_final) {
|
703
|
+
return p;
|
704
|
+
} else {
|
705
|
+
return NULL;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
|
709
|
+
|
710
|
+
#line 711 "parser.c"
|
711
|
+
static const int JSON_integer_start = 1;
|
712
|
+
static const int JSON_integer_first_final = 5;
|
713
|
+
static const int JSON_integer_error = 0;
|
714
|
+
|
715
|
+
static const int JSON_integer_en_main = 1;
|
716
|
+
|
717
|
+
#line 234 "parser.rl"
|
718
|
+
|
719
|
+
|
720
|
+
static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
721
|
+
{
|
722
|
+
int cs = EVIL;
|
723
|
+
|
724
|
+
|
725
|
+
#line 726 "parser.c"
|
726
|
+
{
|
727
|
+
cs = JSON_integer_start;
|
728
|
+
}
|
729
|
+
#line 241 "parser.rl"
|
730
|
+
json->memo = p;
|
731
|
+
|
732
|
+
#line 733 "parser.c"
|
733
|
+
{
|
734
|
+
if ( p == pe )
|
735
|
+
goto _test_eof;
|
736
|
+
switch ( cs )
|
737
|
+
{
|
738
|
+
case 1:
|
739
|
+
switch( (*p) ) {
|
740
|
+
case 45: goto st2;
|
741
|
+
case 48: goto st3;
|
742
|
+
}
|
743
|
+
if ( 49 <= (*p) && (*p) <= 57 )
|
744
|
+
goto st4;
|
745
|
+
goto st0;
|
746
|
+
st0:
|
747
|
+
cs = 0;
|
748
|
+
goto _out;
|
749
|
+
st2:
|
750
|
+
if ( ++p == pe )
|
751
|
+
goto _test_eof2;
|
752
|
+
case 2:
|
753
|
+
if ( (*p) == 48 )
|
754
|
+
goto st3;
|
755
|
+
if ( 49 <= (*p) && (*p) <= 57 )
|
756
|
+
goto st4;
|
757
|
+
goto st0;
|
758
|
+
st3:
|
759
|
+
if ( ++p == pe )
|
760
|
+
goto _test_eof3;
|
761
|
+
case 3:
|
762
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
763
|
+
goto st0;
|
764
|
+
goto tr4;
|
765
|
+
tr4:
|
766
|
+
#line 231 "parser.rl"
|
767
|
+
{ p--; {p++; cs = 5; goto _out;} }
|
768
|
+
goto st5;
|
769
|
+
st5:
|
770
|
+
if ( ++p == pe )
|
771
|
+
goto _test_eof5;
|
772
|
+
case 5:
|
773
|
+
#line 774 "parser.c"
|
774
|
+
goto st0;
|
775
|
+
st4:
|
776
|
+
if ( ++p == pe )
|
777
|
+
goto _test_eof4;
|
778
|
+
case 4:
|
779
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
780
|
+
goto st4;
|
781
|
+
goto tr4;
|
782
|
+
}
|
783
|
+
_test_eof2: cs = 2; goto _test_eof;
|
784
|
+
_test_eof3: cs = 3; goto _test_eof;
|
785
|
+
_test_eof5: cs = 5; goto _test_eof;
|
786
|
+
_test_eof4: cs = 4; goto _test_eof;
|
787
|
+
|
788
|
+
_test_eof: {}
|
789
|
+
_out: {}
|
790
|
+
}
|
791
|
+
#line 243 "parser.rl"
|
792
|
+
|
793
|
+
if (cs >= JSON_integer_first_final) {
|
794
|
+
long len = p - json->memo;
|
795
|
+
*result = rb_Integer(rb_str_new(json->memo, len));
|
796
|
+
return p + 1;
|
797
|
+
} else {
|
798
|
+
return NULL;
|
799
|
+
}
|
800
|
+
}
|
801
|
+
|
802
|
+
|
803
|
+
#line 804 "parser.c"
|
804
|
+
static const int JSON_float_start = 1;
|
805
|
+
static const int JSON_float_first_final = 10;
|
806
|
+
static const int JSON_float_error = 0;
|
807
|
+
|
808
|
+
static const int JSON_float_en_main = 1;
|
809
|
+
|
810
|
+
#line 265 "parser.rl"
|
811
|
+
|
812
|
+
|
813
|
+
static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
814
|
+
{
|
815
|
+
int cs = EVIL;
|
816
|
+
|
817
|
+
|
818
|
+
#line 819 "parser.c"
|
819
|
+
{
|
820
|
+
cs = JSON_float_start;
|
821
|
+
}
|
822
|
+
#line 272 "parser.rl"
|
823
|
+
json->memo = p;
|
824
|
+
|
825
|
+
#line 826 "parser.c"
|
826
|
+
{
|
827
|
+
if ( p == pe )
|
828
|
+
goto _test_eof;
|
829
|
+
switch ( cs )
|
830
|
+
{
|
831
|
+
case 1:
|
832
|
+
switch( (*p) ) {
|
833
|
+
case 45: goto st2;
|
834
|
+
case 48: goto st3;
|
835
|
+
}
|
836
|
+
if ( 49 <= (*p) && (*p) <= 57 )
|
837
|
+
goto st9;
|
838
|
+
goto st0;
|
839
|
+
st0:
|
840
|
+
cs = 0;
|
841
|
+
goto _out;
|
842
|
+
st2:
|
843
|
+
if ( ++p == pe )
|
844
|
+
goto _test_eof2;
|
845
|
+
case 2:
|
846
|
+
if ( (*p) == 48 )
|
847
|
+
goto st3;
|
848
|
+
if ( 49 <= (*p) && (*p) <= 57 )
|
849
|
+
goto st9;
|
850
|
+
goto st0;
|
851
|
+
st3:
|
852
|
+
if ( ++p == pe )
|
853
|
+
goto _test_eof3;
|
854
|
+
case 3:
|
855
|
+
switch( (*p) ) {
|
856
|
+
case 46: goto st4;
|
857
|
+
case 69: goto st6;
|
858
|
+
case 101: goto st6;
|
859
|
+
}
|
860
|
+
goto st0;
|
861
|
+
st4:
|
862
|
+
if ( ++p == pe )
|
863
|
+
goto _test_eof4;
|
864
|
+
case 4:
|
865
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
866
|
+
goto st5;
|
867
|
+
goto st0;
|
868
|
+
st5:
|
869
|
+
if ( ++p == pe )
|
870
|
+
goto _test_eof5;
|
871
|
+
case 5:
|
872
|
+
switch( (*p) ) {
|
873
|
+
case 69: goto st6;
|
874
|
+
case 101: goto st6;
|
875
|
+
}
|
876
|
+
if ( (*p) > 46 ) {
|
877
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
878
|
+
goto st5;
|
879
|
+
} else if ( (*p) >= 45 )
|
880
|
+
goto st0;
|
881
|
+
goto tr7;
|
882
|
+
tr7:
|
883
|
+
#line 259 "parser.rl"
|
884
|
+
{ p--; {p++; cs = 10; goto _out;} }
|
885
|
+
goto st10;
|
886
|
+
st10:
|
887
|
+
if ( ++p == pe )
|
888
|
+
goto _test_eof10;
|
889
|
+
case 10:
|
890
|
+
#line 891 "parser.c"
|
891
|
+
goto st0;
|
892
|
+
st6:
|
893
|
+
if ( ++p == pe )
|
894
|
+
goto _test_eof6;
|
895
|
+
case 6:
|
896
|
+
switch( (*p) ) {
|
897
|
+
case 43: goto st7;
|
898
|
+
case 45: goto st7;
|
899
|
+
}
|
900
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
901
|
+
goto st8;
|
902
|
+
goto st0;
|
903
|
+
st7:
|
904
|
+
if ( ++p == pe )
|
905
|
+
goto _test_eof7;
|
906
|
+
case 7:
|
907
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
908
|
+
goto st8;
|
909
|
+
goto st0;
|
910
|
+
st8:
|
911
|
+
if ( ++p == pe )
|
912
|
+
goto _test_eof8;
|
913
|
+
case 8:
|
914
|
+
switch( (*p) ) {
|
915
|
+
case 69: goto st0;
|
916
|
+
case 101: goto st0;
|
917
|
+
}
|
918
|
+
if ( (*p) > 46 ) {
|
919
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
920
|
+
goto st8;
|
921
|
+
} else if ( (*p) >= 45 )
|
922
|
+
goto st0;
|
923
|
+
goto tr7;
|
924
|
+
st9:
|
925
|
+
if ( ++p == pe )
|
926
|
+
goto _test_eof9;
|
927
|
+
case 9:
|
928
|
+
switch( (*p) ) {
|
929
|
+
case 46: goto st4;
|
930
|
+
case 69: goto st6;
|
931
|
+
case 101: goto st6;
|
932
|
+
}
|
933
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
934
|
+
goto st9;
|
935
|
+
goto st0;
|
936
|
+
}
|
937
|
+
_test_eof2: cs = 2; goto _test_eof;
|
938
|
+
_test_eof3: cs = 3; goto _test_eof;
|
939
|
+
_test_eof4: cs = 4; goto _test_eof;
|
940
|
+
_test_eof5: cs = 5; goto _test_eof;
|
941
|
+
_test_eof10: cs = 10; goto _test_eof;
|
942
|
+
_test_eof6: cs = 6; goto _test_eof;
|
943
|
+
_test_eof7: cs = 7; goto _test_eof;
|
944
|
+
_test_eof8: cs = 8; goto _test_eof;
|
945
|
+
_test_eof9: cs = 9; goto _test_eof;
|
946
|
+
|
947
|
+
_test_eof: {}
|
948
|
+
_out: {}
|
949
|
+
}
|
950
|
+
#line 274 "parser.rl"
|
951
|
+
|
952
|
+
if (cs >= JSON_float_first_final) {
|
953
|
+
long len = p - json->memo;
|
954
|
+
*result = rb_Float(rb_str_new(json->memo, len));
|
955
|
+
return p + 1;
|
956
|
+
} else {
|
957
|
+
return NULL;
|
958
|
+
}
|
959
|
+
}
|
960
|
+
|
961
|
+
|
962
|
+
|
963
|
+
#line 964 "parser.c"
|
964
|
+
static const int JSON_array_start = 1;
|
965
|
+
static const int JSON_array_first_final = 17;
|
966
|
+
static const int JSON_array_error = 0;
|
967
|
+
|
968
|
+
static const int JSON_array_en_main = 1;
|
969
|
+
|
970
|
+
#line 310 "parser.rl"
|
971
|
+
|
972
|
+
|
973
|
+
static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
974
|
+
{
|
975
|
+
int cs = EVIL;
|
976
|
+
|
977
|
+
if (json->max_nesting && json->current_nesting > json->max_nesting) {
|
978
|
+
rb_raise(eNestingError, "nesting of %d is to deep", json->current_nesting);
|
979
|
+
}
|
980
|
+
*result = rb_ary_new();
|
981
|
+
|
982
|
+
|
983
|
+
#line 984 "parser.c"
|
984
|
+
{
|
985
|
+
cs = JSON_array_start;
|
986
|
+
}
|
987
|
+
#line 322 "parser.rl"
|
988
|
+
|
989
|
+
#line 990 "parser.c"
|
990
|
+
{
|
991
|
+
if ( p == pe )
|
992
|
+
goto _test_eof;
|
993
|
+
switch ( cs )
|
994
|
+
{
|
995
|
+
case 1:
|
996
|
+
if ( (*p) == 91 )
|
997
|
+
goto st2;
|
998
|
+
goto st0;
|
999
|
+
st0:
|
1000
|
+
cs = 0;
|
1001
|
+
goto _out;
|
1002
|
+
st2:
|
1003
|
+
if ( ++p == pe )
|
1004
|
+
goto _test_eof2;
|
1005
|
+
case 2:
|
1006
|
+
switch( (*p) ) {
|
1007
|
+
case 13: goto st2;
|
1008
|
+
case 32: goto st2;
|
1009
|
+
case 34: goto tr2;
|
1010
|
+
case 45: goto tr2;
|
1011
|
+
case 47: goto st13;
|
1012
|
+
case 73: goto tr2;
|
1013
|
+
case 78: goto tr2;
|
1014
|
+
case 91: goto tr2;
|
1015
|
+
case 93: goto tr4;
|
1016
|
+
case 102: goto tr2;
|
1017
|
+
case 110: goto tr2;
|
1018
|
+
case 116: goto tr2;
|
1019
|
+
case 123: goto tr2;
|
1020
|
+
}
|
1021
|
+
if ( (*p) > 10 ) {
|
1022
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1023
|
+
goto tr2;
|
1024
|
+
} else if ( (*p) >= 9 )
|
1025
|
+
goto st2;
|
1026
|
+
goto st0;
|
1027
|
+
tr2:
|
1028
|
+
#line 291 "parser.rl"
|
1029
|
+
{
|
1030
|
+
VALUE v = Qnil;
|
1031
|
+
char *np = JSON_parse_value(json, p, pe, &v);
|
1032
|
+
if (np == NULL) {
|
1033
|
+
p--; {p++; cs = 3; goto _out;}
|
1034
|
+
} else {
|
1035
|
+
rb_ary_push(*result, v);
|
1036
|
+
{p = (( np))-1;}
|
1037
|
+
}
|
1038
|
+
}
|
1039
|
+
goto st3;
|
1040
|
+
st3:
|
1041
|
+
if ( ++p == pe )
|
1042
|
+
goto _test_eof3;
|
1043
|
+
case 3:
|
1044
|
+
#line 1045 "parser.c"
|
1045
|
+
switch( (*p) ) {
|
1046
|
+
case 13: goto st3;
|
1047
|
+
case 32: goto st3;
|
1048
|
+
case 44: goto st4;
|
1049
|
+
case 47: goto st9;
|
1050
|
+
case 93: goto tr4;
|
1051
|
+
}
|
1052
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
1053
|
+
goto st3;
|
1054
|
+
goto st0;
|
1055
|
+
st4:
|
1056
|
+
if ( ++p == pe )
|
1057
|
+
goto _test_eof4;
|
1058
|
+
case 4:
|
1059
|
+
switch( (*p) ) {
|
1060
|
+
case 13: goto st4;
|
1061
|
+
case 32: goto st4;
|
1062
|
+
case 34: goto tr2;
|
1063
|
+
case 45: goto tr2;
|
1064
|
+
case 47: goto st5;
|
1065
|
+
case 73: goto tr2;
|
1066
|
+
case 78: goto tr2;
|
1067
|
+
case 91: goto tr2;
|
1068
|
+
case 102: goto tr2;
|
1069
|
+
case 110: goto tr2;
|
1070
|
+
case 116: goto tr2;
|
1071
|
+
case 123: goto tr2;
|
1072
|
+
}
|
1073
|
+
if ( (*p) > 10 ) {
|
1074
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1075
|
+
goto tr2;
|
1076
|
+
} else if ( (*p) >= 9 )
|
1077
|
+
goto st4;
|
1078
|
+
goto st0;
|
1079
|
+
st5:
|
1080
|
+
if ( ++p == pe )
|
1081
|
+
goto _test_eof5;
|
1082
|
+
case 5:
|
1083
|
+
switch( (*p) ) {
|
1084
|
+
case 42: goto st6;
|
1085
|
+
case 47: goto st8;
|
1086
|
+
}
|
1087
|
+
goto st0;
|
1088
|
+
st6:
|
1089
|
+
if ( ++p == pe )
|
1090
|
+
goto _test_eof6;
|
1091
|
+
case 6:
|
1092
|
+
if ( (*p) == 42 )
|
1093
|
+
goto st7;
|
1094
|
+
goto st6;
|
1095
|
+
st7:
|
1096
|
+
if ( ++p == pe )
|
1097
|
+
goto _test_eof7;
|
1098
|
+
case 7:
|
1099
|
+
switch( (*p) ) {
|
1100
|
+
case 42: goto st7;
|
1101
|
+
case 47: goto st4;
|
1102
|
+
}
|
1103
|
+
goto st6;
|
1104
|
+
st8:
|
1105
|
+
if ( ++p == pe )
|
1106
|
+
goto _test_eof8;
|
1107
|
+
case 8:
|
1108
|
+
if ( (*p) == 10 )
|
1109
|
+
goto st4;
|
1110
|
+
goto st8;
|
1111
|
+
st9:
|
1112
|
+
if ( ++p == pe )
|
1113
|
+
goto _test_eof9;
|
1114
|
+
case 9:
|
1115
|
+
switch( (*p) ) {
|
1116
|
+
case 42: goto st10;
|
1117
|
+
case 47: goto st12;
|
1118
|
+
}
|
1119
|
+
goto st0;
|
1120
|
+
st10:
|
1121
|
+
if ( ++p == pe )
|
1122
|
+
goto _test_eof10;
|
1123
|
+
case 10:
|
1124
|
+
if ( (*p) == 42 )
|
1125
|
+
goto st11;
|
1126
|
+
goto st10;
|
1127
|
+
st11:
|
1128
|
+
if ( ++p == pe )
|
1129
|
+
goto _test_eof11;
|
1130
|
+
case 11:
|
1131
|
+
switch( (*p) ) {
|
1132
|
+
case 42: goto st11;
|
1133
|
+
case 47: goto st3;
|
1134
|
+
}
|
1135
|
+
goto st10;
|
1136
|
+
st12:
|
1137
|
+
if ( ++p == pe )
|
1138
|
+
goto _test_eof12;
|
1139
|
+
case 12:
|
1140
|
+
if ( (*p) == 10 )
|
1141
|
+
goto st3;
|
1142
|
+
goto st12;
|
1143
|
+
tr4:
|
1144
|
+
#line 302 "parser.rl"
|
1145
|
+
{ p--; {p++; cs = 17; goto _out;} }
|
1146
|
+
goto st17;
|
1147
|
+
st17:
|
1148
|
+
if ( ++p == pe )
|
1149
|
+
goto _test_eof17;
|
1150
|
+
case 17:
|
1151
|
+
#line 1152 "parser.c"
|
1152
|
+
goto st0;
|
1153
|
+
st13:
|
1154
|
+
if ( ++p == pe )
|
1155
|
+
goto _test_eof13;
|
1156
|
+
case 13:
|
1157
|
+
switch( (*p) ) {
|
1158
|
+
case 42: goto st14;
|
1159
|
+
case 47: goto st16;
|
1160
|
+
}
|
1161
|
+
goto st0;
|
1162
|
+
st14:
|
1163
|
+
if ( ++p == pe )
|
1164
|
+
goto _test_eof14;
|
1165
|
+
case 14:
|
1166
|
+
if ( (*p) == 42 )
|
1167
|
+
goto st15;
|
1168
|
+
goto st14;
|
1169
|
+
st15:
|
1170
|
+
if ( ++p == pe )
|
1171
|
+
goto _test_eof15;
|
1172
|
+
case 15:
|
1173
|
+
switch( (*p) ) {
|
1174
|
+
case 42: goto st15;
|
1175
|
+
case 47: goto st2;
|
1176
|
+
}
|
1177
|
+
goto st14;
|
1178
|
+
st16:
|
1179
|
+
if ( ++p == pe )
|
1180
|
+
goto _test_eof16;
|
1181
|
+
case 16:
|
1182
|
+
if ( (*p) == 10 )
|
1183
|
+
goto st2;
|
1184
|
+
goto st16;
|
1185
|
+
}
|
1186
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1187
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1188
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1189
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1190
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1191
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1192
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1193
|
+
_test_eof9: cs = 9; goto _test_eof;
|
1194
|
+
_test_eof10: cs = 10; goto _test_eof;
|
1195
|
+
_test_eof11: cs = 11; goto _test_eof;
|
1196
|
+
_test_eof12: cs = 12; goto _test_eof;
|
1197
|
+
_test_eof17: cs = 17; goto _test_eof;
|
1198
|
+
_test_eof13: cs = 13; goto _test_eof;
|
1199
|
+
_test_eof14: cs = 14; goto _test_eof;
|
1200
|
+
_test_eof15: cs = 15; goto _test_eof;
|
1201
|
+
_test_eof16: cs = 16; goto _test_eof;
|
1202
|
+
|
1203
|
+
_test_eof: {}
|
1204
|
+
_out: {}
|
1205
|
+
}
|
1206
|
+
#line 323 "parser.rl"
|
1207
|
+
|
1208
|
+
if(cs >= JSON_array_first_final) {
|
1209
|
+
return p + 1;
|
1210
|
+
} else {
|
1211
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
static VALUE json_string_unescape(char *p, char *pe)
|
1216
|
+
{
|
1217
|
+
VALUE result = rb_str_buf_new(pe - p + 1);
|
1218
|
+
|
1219
|
+
while (p < pe) {
|
1220
|
+
if (*p == '\\') {
|
1221
|
+
p++;
|
1222
|
+
if (p >= pe) return Qnil; /* raise an exception later, \ at end */
|
1223
|
+
switch (*p) {
|
1224
|
+
case '"':
|
1225
|
+
case '\\':
|
1226
|
+
rb_str_buf_cat(result, p, 1);
|
1227
|
+
p++;
|
1228
|
+
break;
|
1229
|
+
case 'b':
|
1230
|
+
rb_str_buf_cat2(result, "\b");
|
1231
|
+
p++;
|
1232
|
+
break;
|
1233
|
+
case 'f':
|
1234
|
+
rb_str_buf_cat2(result, "\f");
|
1235
|
+
p++;
|
1236
|
+
break;
|
1237
|
+
case 'n':
|
1238
|
+
rb_str_buf_cat2(result, "\n");
|
1239
|
+
p++;
|
1240
|
+
break;
|
1241
|
+
case 'r':
|
1242
|
+
rb_str_buf_cat2(result, "\r");
|
1243
|
+
p++;
|
1244
|
+
break;
|
1245
|
+
case 't':
|
1246
|
+
rb_str_buf_cat2(result, "\t");
|
1247
|
+
p++;
|
1248
|
+
break;
|
1249
|
+
case 'u':
|
1250
|
+
if (p > pe - 4) {
|
1251
|
+
return Qnil;
|
1252
|
+
} else {
|
1253
|
+
p = JSON_convert_UTF16_to_UTF8(result, p, pe, strictConversion);
|
1254
|
+
}
|
1255
|
+
break;
|
1256
|
+
default:
|
1257
|
+
rb_str_buf_cat(result, p, 1);
|
1258
|
+
p++;
|
1259
|
+
break;
|
1260
|
+
}
|
1261
|
+
} else {
|
1262
|
+
char *q = p;
|
1263
|
+
while (*q != '\\' && q < pe) q++;
|
1264
|
+
rb_str_buf_cat(result, p, q - p);
|
1265
|
+
p = q;
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
return result;
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
|
1272
|
+
#line 1273 "parser.c"
|
1273
|
+
static const int JSON_string_start = 1;
|
1274
|
+
static const int JSON_string_first_final = 8;
|
1275
|
+
static const int JSON_string_error = 0;
|
1276
|
+
|
1277
|
+
static const int JSON_string_en_main = 1;
|
1278
|
+
|
1279
|
+
#line 401 "parser.rl"
|
1280
|
+
|
1281
|
+
|
1282
|
+
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
1283
|
+
{
|
1284
|
+
int cs = EVIL;
|
1285
|
+
|
1286
|
+
*result = rb_str_new("", 0);
|
1287
|
+
|
1288
|
+
#line 1289 "parser.c"
|
1289
|
+
{
|
1290
|
+
cs = JSON_string_start;
|
1291
|
+
}
|
1292
|
+
#line 409 "parser.rl"
|
1293
|
+
json->memo = p;
|
1294
|
+
|
1295
|
+
#line 1296 "parser.c"
|
1296
|
+
{
|
1297
|
+
if ( p == pe )
|
1298
|
+
goto _test_eof;
|
1299
|
+
switch ( cs )
|
1300
|
+
{
|
1301
|
+
case 1:
|
1302
|
+
if ( (*p) == 34 )
|
1303
|
+
goto st2;
|
1304
|
+
goto st0;
|
1305
|
+
st0:
|
1306
|
+
cs = 0;
|
1307
|
+
goto _out;
|
1308
|
+
st2:
|
1309
|
+
if ( ++p == pe )
|
1310
|
+
goto _test_eof2;
|
1311
|
+
case 2:
|
1312
|
+
switch( (*p) ) {
|
1313
|
+
case 34: goto tr2;
|
1314
|
+
case 92: goto st3;
|
1315
|
+
}
|
1316
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
1317
|
+
goto st0;
|
1318
|
+
goto st2;
|
1319
|
+
tr2:
|
1320
|
+
#line 393 "parser.rl"
|
1321
|
+
{
|
1322
|
+
*result = json_string_unescape(json->memo + 1, p);
|
1323
|
+
if (NIL_P(*result)) { p--; {p++; cs = 8; goto _out;} } else {p = (( p + 1))-1;}
|
1324
|
+
}
|
1325
|
+
#line 398 "parser.rl"
|
1326
|
+
{ p--; {p++; cs = 8; goto _out;} }
|
1327
|
+
goto st8;
|
1328
|
+
st8:
|
1329
|
+
if ( ++p == pe )
|
1330
|
+
goto _test_eof8;
|
1331
|
+
case 8:
|
1332
|
+
#line 1333 "parser.c"
|
1333
|
+
goto st0;
|
1334
|
+
st3:
|
1335
|
+
if ( ++p == pe )
|
1336
|
+
goto _test_eof3;
|
1337
|
+
case 3:
|
1338
|
+
if ( (*p) == 117 )
|
1339
|
+
goto st4;
|
1340
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
1341
|
+
goto st0;
|
1342
|
+
goto st2;
|
1343
|
+
st4:
|
1344
|
+
if ( ++p == pe )
|
1345
|
+
goto _test_eof4;
|
1346
|
+
case 4:
|
1347
|
+
if ( (*p) < 65 ) {
|
1348
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1349
|
+
goto st5;
|
1350
|
+
} else if ( (*p) > 70 ) {
|
1351
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
1352
|
+
goto st5;
|
1353
|
+
} else
|
1354
|
+
goto st5;
|
1355
|
+
goto st0;
|
1356
|
+
st5:
|
1357
|
+
if ( ++p == pe )
|
1358
|
+
goto _test_eof5;
|
1359
|
+
case 5:
|
1360
|
+
if ( (*p) < 65 ) {
|
1361
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1362
|
+
goto st6;
|
1363
|
+
} else if ( (*p) > 70 ) {
|
1364
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
1365
|
+
goto st6;
|
1366
|
+
} else
|
1367
|
+
goto st6;
|
1368
|
+
goto st0;
|
1369
|
+
st6:
|
1370
|
+
if ( ++p == pe )
|
1371
|
+
goto _test_eof6;
|
1372
|
+
case 6:
|
1373
|
+
if ( (*p) < 65 ) {
|
1374
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1375
|
+
goto st7;
|
1376
|
+
} else if ( (*p) > 70 ) {
|
1377
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
1378
|
+
goto st7;
|
1379
|
+
} else
|
1380
|
+
goto st7;
|
1381
|
+
goto st0;
|
1382
|
+
st7:
|
1383
|
+
if ( ++p == pe )
|
1384
|
+
goto _test_eof7;
|
1385
|
+
case 7:
|
1386
|
+
if ( (*p) < 65 ) {
|
1387
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
1388
|
+
goto st2;
|
1389
|
+
} else if ( (*p) > 70 ) {
|
1390
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
1391
|
+
goto st2;
|
1392
|
+
} else
|
1393
|
+
goto st2;
|
1394
|
+
goto st0;
|
1395
|
+
}
|
1396
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1397
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1398
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1399
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1400
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1401
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1402
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1403
|
+
|
1404
|
+
_test_eof: {}
|
1405
|
+
_out: {}
|
1406
|
+
}
|
1407
|
+
#line 411 "parser.rl"
|
1408
|
+
|
1409
|
+
if (cs >= JSON_string_first_final) {
|
1410
|
+
return p + 1;
|
1411
|
+
} else {
|
1412
|
+
return NULL;
|
1413
|
+
}
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
|
1417
|
+
|
1418
|
+
#line 1419 "parser.c"
|
1419
|
+
static const int JSON_start = 1;
|
1420
|
+
static const int JSON_first_final = 10;
|
1421
|
+
static const int JSON_error = 0;
|
1422
|
+
|
1423
|
+
static const int JSON_en_main = 1;
|
1424
|
+
|
1425
|
+
#line 445 "parser.rl"
|
1426
|
+
|
1427
|
+
|
1428
|
+
/*
|
1429
|
+
* Document-class: JSON::Ext::Parser
|
1430
|
+
*
|
1431
|
+
* This is the JSON parser implemented as a C extension. It can be configured
|
1432
|
+
* to be used by setting
|
1433
|
+
*
|
1434
|
+
* JSON.parser = JSON::Ext::Parser
|
1435
|
+
*
|
1436
|
+
* with the method parser= in JSON.
|
1437
|
+
*
|
1438
|
+
*/
|
1439
|
+
|
1440
|
+
/*
|
1441
|
+
* call-seq: new(source, opts => {})
|
1442
|
+
*
|
1443
|
+
* Creates a new JSON::Ext::Parser instance for the string _source_.
|
1444
|
+
*
|
1445
|
+
* Creates a new JSON::Ext::Parser instance for the string _source_.
|
1446
|
+
*
|
1447
|
+
* It will be configured by the _opts_ hash. _opts_ can have the following
|
1448
|
+
* keys:
|
1449
|
+
*
|
1450
|
+
* _opts_ can have the following keys:
|
1451
|
+
* * *max_nesting*: The maximum depth of nesting allowed in the parsed data
|
1452
|
+
* structures. Disable depth checking with :max_nesting => false|nil|0, it
|
1453
|
+
* defaults to 19.
|
1454
|
+
* * *allow_nan*: If set to true, allow NaN, Infinity and -Infinity in
|
1455
|
+
* defiance of RFC 4627 to be parsed by the Parser. This option defaults to
|
1456
|
+
* false.
|
1457
|
+
* * *create_additions*: If set to false, the Parser doesn't create
|
1458
|
+
* additions even if a matchin class and create_id was found. This option
|
1459
|
+
* defaults to true.
|
1460
|
+
*/
|
1461
|
+
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
1462
|
+
{
|
1463
|
+
char *ptr;
|
1464
|
+
long len;
|
1465
|
+
VALUE source, opts;
|
1466
|
+
GET_STRUCT;
|
1467
|
+
rb_scan_args(argc, argv, "11", &source, &opts);
|
1468
|
+
source = StringValue(source);
|
1469
|
+
ptr = RSTRING_PTR(source);
|
1470
|
+
len = RSTRING_LEN(source);
|
1471
|
+
if (len < 2) {
|
1472
|
+
rb_raise(eParserError, "A JSON text must at least contain two octets!");
|
1473
|
+
}
|
1474
|
+
if (!NIL_P(opts)) {
|
1475
|
+
opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
|
1476
|
+
if (NIL_P(opts)) {
|
1477
|
+
rb_raise(rb_eArgError, "opts needs to be like a hash");
|
1478
|
+
} else {
|
1479
|
+
VALUE tmp = ID2SYM(i_max_nesting);
|
1480
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
1481
|
+
VALUE max_nesting = rb_hash_aref(opts, tmp);
|
1482
|
+
if (RTEST(max_nesting)) {
|
1483
|
+
Check_Type(max_nesting, T_FIXNUM);
|
1484
|
+
json->max_nesting = FIX2INT(max_nesting);
|
1485
|
+
} else {
|
1486
|
+
json->max_nesting = 0;
|
1487
|
+
}
|
1488
|
+
} else {
|
1489
|
+
json->max_nesting = 19;
|
1490
|
+
}
|
1491
|
+
tmp = ID2SYM(i_allow_nan);
|
1492
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
1493
|
+
VALUE allow_nan = rb_hash_aref(opts, tmp);
|
1494
|
+
json->allow_nan = RTEST(allow_nan) ? 1 : 0;
|
1495
|
+
} else {
|
1496
|
+
json->allow_nan = 0;
|
1497
|
+
}
|
1498
|
+
tmp = ID2SYM(i_create_additions);
|
1499
|
+
if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
|
1500
|
+
VALUE create_additions = rb_hash_aref(opts, tmp);
|
1501
|
+
if (RTEST(create_additions)) {
|
1502
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
1503
|
+
} else {
|
1504
|
+
json->create_id = Qnil;
|
1505
|
+
}
|
1506
|
+
} else {
|
1507
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
1508
|
+
}
|
1509
|
+
}
|
1510
|
+
} else {
|
1511
|
+
json->max_nesting = 19;
|
1512
|
+
json->allow_nan = 0;
|
1513
|
+
json->create_id = rb_funcall(mJSON, i_create_id, 0);
|
1514
|
+
}
|
1515
|
+
json->current_nesting = 0;
|
1516
|
+
/*
|
1517
|
+
Convert these?
|
1518
|
+
if (len >= 4 && ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0) {
|
1519
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
1520
|
+
} else if (len >= 4 && ptr[0] == 0 && ptr[2] == 0) {
|
1521
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
1522
|
+
} else if (len >= 4 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) {
|
1523
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
1524
|
+
} else if (len >= 4 && ptr[1] == 0 && ptr[3] == 0) {
|
1525
|
+
rb_raise(eParserError, "Only UTF8 octet streams are supported atm!");
|
1526
|
+
}
|
1527
|
+
*/
|
1528
|
+
json->len = len;
|
1529
|
+
json->source = ptr;
|
1530
|
+
json->Vsource = source;
|
1531
|
+
return self;
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
/*
|
1535
|
+
* call-seq: parse()
|
1536
|
+
*
|
1537
|
+
* Parses the current JSON text _source_ and returns the complete data
|
1538
|
+
* structure as a result.
|
1539
|
+
*/
|
1540
|
+
static VALUE cParser_parse(VALUE self)
|
1541
|
+
{
|
1542
|
+
char *p, *pe;
|
1543
|
+
int cs = EVIL;
|
1544
|
+
VALUE result = Qnil;
|
1545
|
+
GET_STRUCT;
|
1546
|
+
|
1547
|
+
|
1548
|
+
#line 1549 "parser.c"
|
1549
|
+
{
|
1550
|
+
cs = JSON_start;
|
1551
|
+
}
|
1552
|
+
#line 567 "parser.rl"
|
1553
|
+
p = json->source;
|
1554
|
+
pe = p + json->len;
|
1555
|
+
|
1556
|
+
#line 1557 "parser.c"
|
1557
|
+
{
|
1558
|
+
if ( p == pe )
|
1559
|
+
goto _test_eof;
|
1560
|
+
switch ( cs )
|
1561
|
+
{
|
1562
|
+
st1:
|
1563
|
+
if ( ++p == pe )
|
1564
|
+
goto _test_eof1;
|
1565
|
+
case 1:
|
1566
|
+
switch( (*p) ) {
|
1567
|
+
case 13: goto st1;
|
1568
|
+
case 32: goto st1;
|
1569
|
+
case 47: goto st2;
|
1570
|
+
case 91: goto tr3;
|
1571
|
+
case 123: goto tr4;
|
1572
|
+
}
|
1573
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
1574
|
+
goto st1;
|
1575
|
+
goto st0;
|
1576
|
+
st0:
|
1577
|
+
cs = 0;
|
1578
|
+
goto _out;
|
1579
|
+
st2:
|
1580
|
+
if ( ++p == pe )
|
1581
|
+
goto _test_eof2;
|
1582
|
+
case 2:
|
1583
|
+
switch( (*p) ) {
|
1584
|
+
case 42: goto st3;
|
1585
|
+
case 47: goto st5;
|
1586
|
+
}
|
1587
|
+
goto st0;
|
1588
|
+
st3:
|
1589
|
+
if ( ++p == pe )
|
1590
|
+
goto _test_eof3;
|
1591
|
+
case 3:
|
1592
|
+
if ( (*p) == 42 )
|
1593
|
+
goto st4;
|
1594
|
+
goto st3;
|
1595
|
+
st4:
|
1596
|
+
if ( ++p == pe )
|
1597
|
+
goto _test_eof4;
|
1598
|
+
case 4:
|
1599
|
+
switch( (*p) ) {
|
1600
|
+
case 42: goto st4;
|
1601
|
+
case 47: goto st1;
|
1602
|
+
}
|
1603
|
+
goto st3;
|
1604
|
+
st5:
|
1605
|
+
if ( ++p == pe )
|
1606
|
+
goto _test_eof5;
|
1607
|
+
case 5:
|
1608
|
+
if ( (*p) == 10 )
|
1609
|
+
goto st1;
|
1610
|
+
goto st5;
|
1611
|
+
tr3:
|
1612
|
+
#line 434 "parser.rl"
|
1613
|
+
{
|
1614
|
+
char *np;
|
1615
|
+
json->current_nesting = 1;
|
1616
|
+
np = JSON_parse_array(json, p, pe, &result);
|
1617
|
+
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
1618
|
+
}
|
1619
|
+
goto st10;
|
1620
|
+
tr4:
|
1621
|
+
#line 427 "parser.rl"
|
1622
|
+
{
|
1623
|
+
char *np;
|
1624
|
+
json->current_nesting = 1;
|
1625
|
+
np = JSON_parse_object(json, p, pe, &result);
|
1626
|
+
if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
|
1627
|
+
}
|
1628
|
+
goto st10;
|
1629
|
+
st10:
|
1630
|
+
if ( ++p == pe )
|
1631
|
+
goto _test_eof10;
|
1632
|
+
case 10:
|
1633
|
+
#line 1634 "parser.c"
|
1634
|
+
switch( (*p) ) {
|
1635
|
+
case 13: goto st10;
|
1636
|
+
case 32: goto st10;
|
1637
|
+
case 47: goto st6;
|
1638
|
+
}
|
1639
|
+
if ( 9 <= (*p) && (*p) <= 10 )
|
1640
|
+
goto st10;
|
1641
|
+
goto st0;
|
1642
|
+
st6:
|
1643
|
+
if ( ++p == pe )
|
1644
|
+
goto _test_eof6;
|
1645
|
+
case 6:
|
1646
|
+
switch( (*p) ) {
|
1647
|
+
case 42: goto st7;
|
1648
|
+
case 47: goto st9;
|
1649
|
+
}
|
1650
|
+
goto st0;
|
1651
|
+
st7:
|
1652
|
+
if ( ++p == pe )
|
1653
|
+
goto _test_eof7;
|
1654
|
+
case 7:
|
1655
|
+
if ( (*p) == 42 )
|
1656
|
+
goto st8;
|
1657
|
+
goto st7;
|
1658
|
+
st8:
|
1659
|
+
if ( ++p == pe )
|
1660
|
+
goto _test_eof8;
|
1661
|
+
case 8:
|
1662
|
+
switch( (*p) ) {
|
1663
|
+
case 42: goto st8;
|
1664
|
+
case 47: goto st10;
|
1665
|
+
}
|
1666
|
+
goto st7;
|
1667
|
+
st9:
|
1668
|
+
if ( ++p == pe )
|
1669
|
+
goto _test_eof9;
|
1670
|
+
case 9:
|
1671
|
+
if ( (*p) == 10 )
|
1672
|
+
goto st10;
|
1673
|
+
goto st9;
|
1674
|
+
}
|
1675
|
+
_test_eof1: cs = 1; goto _test_eof;
|
1676
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1677
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1678
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1679
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1680
|
+
_test_eof10: cs = 10; goto _test_eof;
|
1681
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1682
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1683
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1684
|
+
_test_eof9: cs = 9; goto _test_eof;
|
1685
|
+
|
1686
|
+
_test_eof: {}
|
1687
|
+
_out: {}
|
1688
|
+
}
|
1689
|
+
#line 570 "parser.rl"
|
1690
|
+
|
1691
|
+
if (cs >= JSON_first_final && p == pe) {
|
1692
|
+
return result;
|
1693
|
+
} else {
|
1694
|
+
rb_raise(eParserError, "%u: unexpected token at '%s'", __LINE__, p);
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
|
1698
|
+
inline static JSON_Parser *JSON_allocate()
|
1699
|
+
{
|
1700
|
+
JSON_Parser *json = ALLOC(JSON_Parser);
|
1701
|
+
MEMZERO(json, JSON_Parser, 1);
|
1702
|
+
return json;
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
static void JSON_mark(JSON_Parser *json)
|
1706
|
+
{
|
1707
|
+
rb_gc_mark_maybe(json->Vsource);
|
1708
|
+
rb_gc_mark_maybe(json->create_id);
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
static void JSON_free(JSON_Parser *json)
|
1712
|
+
{
|
1713
|
+
free(json);
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
1717
|
+
{
|
1718
|
+
JSON_Parser *json = JSON_allocate();
|
1719
|
+
return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
/*
|
1723
|
+
* call-seq: source()
|
1724
|
+
*
|
1725
|
+
* Returns a copy of the current _source_ string, that was used to construct
|
1726
|
+
* this Parser.
|
1727
|
+
*/
|
1728
|
+
static VALUE cParser_source(VALUE self)
|
1729
|
+
{
|
1730
|
+
GET_STRUCT;
|
1731
|
+
return rb_str_dup(json->Vsource);
|
1732
|
+
}
|
1733
|
+
|
1734
|
+
void Init_parser()
|
1735
|
+
{
|
1736
|
+
rb_require("json/common");
|
1737
|
+
mJSON = rb_define_module("JSON");
|
1738
|
+
mExt = rb_define_module_under(mJSON, "Ext");
|
1739
|
+
cParser = rb_define_class_under(mExt, "Parser", rb_cObject);
|
1740
|
+
eParserError = rb_path2class("JSON::ParserError");
|
1741
|
+
eNestingError = rb_path2class("JSON::NestingError");
|
1742
|
+
rb_define_alloc_func(cParser, cJSON_parser_s_allocate);
|
1743
|
+
rb_define_method(cParser, "initialize", cParser_initialize, -1);
|
1744
|
+
rb_define_method(cParser, "parse", cParser_parse, 0);
|
1745
|
+
rb_define_method(cParser, "source", cParser_source, 0);
|
1746
|
+
|
1747
|
+
CNaN = rb_const_get(mJSON, rb_intern("NaN"));
|
1748
|
+
CInfinity = rb_const_get(mJSON, rb_intern("Infinity"));
|
1749
|
+
CMinusInfinity = rb_const_get(mJSON, rb_intern("MinusInfinity"));
|
1750
|
+
|
1751
|
+
i_json_creatable_p = rb_intern("json_creatable?");
|
1752
|
+
i_json_create = rb_intern("json_create");
|
1753
|
+
i_create_id = rb_intern("create_id");
|
1754
|
+
i_create_additions = rb_intern("create_additions");
|
1755
|
+
i_chr = rb_intern("chr");
|
1756
|
+
i_max_nesting = rb_intern("max_nesting");
|
1757
|
+
i_allow_nan = rb_intern("allow_nan");
|
1758
|
+
}
|