From 137af843af3bffe343515f4a449928080bf03417 Mon Sep 17 00:00:00 2001 From: jvelilla Date: Thu, 7 Nov 2013 18:14:59 -0300 Subject: [PATCH] Fixed normalized line endings --- History.txt | 50 ++--- License.txt | 38 ++-- Readme.txt | 192 +++++++++--------- library/extras/file/json_file_reader.e | 75 ++++--- library/extras/visitor/json_visitor.e | 118 +++++------ .../autotest/test_suite/json_menu_example.txt | 2 +- 6 files changed, 237 insertions(+), 238 deletions(-) diff --git a/History.txt b/History.txt index 10ff48c6..5cf7f2ec 100644 --- a/History.txt +++ b/History.txt @@ -1,26 +1,26 @@ -History file for EJSON -====================== - -team: "" -date: "2011-07-06" -revision: "0.3.0" - - -+++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++ - -*Updated skip_white_spaces, now check %U and %T codes - -*Undo changes to is_a_valid_number, because it's doesn't follow the -JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid -with this implementation, so we go back to the previous -implementation. - -*Added autotest test suite - -*Added getest based test program - -*Updated Eiffel configuration file, updated to the new clusters - -*Added converters and factory classes - +History file for EJSON +====================== + +team: "" +date: "2011-07-06" +revision: "0.3.0" + + ++++++++++++++++++++++Important Changes since 0.2.0 version++++++++++++++++++++++++++++++++++++++++++++++ + +*Updated skip_white_spaces, now check %U and %T codes + +*Undo changes to is_a_valid_number, because it's doesn't follow the +JSON spec. Tests : fail13.json, fail29.json and fail30.json are valid +with this implementation, so we go back to the previous +implementation. + +*Added autotest test suite + +*Added getest based test program + +*Updated Eiffel configuration file, updated to the new clusters + +*Added converters and factory classes + *Added new top level directories; library, test, build and example \ No newline at end of file diff --git a/License.txt b/License.txt index 24c06993..1c17b708 100644 --- a/License.txt +++ b/License.txt @@ -1,20 +1,20 @@ -Copyright (c) 2010 Javier Velilla and others, http://ejson.origo.ethz.ch - - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +Copyright (c) 2010 Javier Velilla and others, http://ejson.origo.ethz.ch + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Readme.txt b/Readme.txt index 1dc997a7..daf9b5a5 100644 --- a/Readme.txt +++ b/Readme.txt @@ -1,97 +1,97 @@ -Readme file for eJSON -===================== - -team: "Javier Velilla,Jocelyn Fiat, Paul Cohen" -date: "$Date$" -revision: "$Revision$" - -1. Introduction ---------------- - -eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing -with the JSON format. The objective of the library is to provide two basic -features Eiffel2JSON and JSON2Eiffel. - -2. Legal stuff --------------- - -eJSON is copyrighted by the author Javier Velilla and others. It is licensed -under the MIT License. See the file license.txt in the same directory as this -readme file. - -3. Versioning scheme --------------------- - -eJSON version numbers has the form: - - «major number».«minor number».«patch level» - -eJSON will retain the major number 0 as long as it has beta status. A change in -major number indicates that a release is not backward compatible. A change in -minor number indicates that a release is backward compatible (within that major -number) but that new useful features may have been added. A change in patch -level simply indicates that the release contains bug fixes for the previous -release. Note that as long as eJSON is in beta status (0.Y.Z) backward -compatibility is not guranteed for changes in minor numbers! - -4. Documentation ---------------- - -Currently the only documentation on eJSON is available at: - - https://github.com/eiffelhub/json/wiki/User-guide - -5. Requirements and installation --------------------------------- - -EJSON requires that you have: - -1. Gobo 3.9 installed or later -2. One of the following compiler combinations installed: - * ISE Eiffel 6.5 or later. - * gec [try to test] - * tecomp [try to test] - -eJSON probably works fine with other versions of the above compilers. -There are no known platform dependencies (Windows, Linux). - -To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate -place on your hard disk. There are no requirements on environment variables or -registry variables. - -To verify that everything works you should compile the example programs and/or -the test program. - -6. Contents of eJSON --------------------- - -All directory names below are relative to the root directory of your ejson -installation. - -Directory Description ---------- ----------- -doc Contains the eJSON.pdf documentation file. -examples Contains the two example programs. -ejson Contains the actual eJSON library classes. -test Contains a test program for eJSON. - -7. Contacting the Team ----------------------- - -Contact the team: - - Javier Velilla «javier.hector@gmail.com» - Paul Cohen «paco@seibostudios.se» - Jocelyn Fiat «jfiat@eiffel.com» - -8. Releases ------------ - -For more information on what was changed in each release look in the file -history.txt. - -Version Date Description -------- ---- ----------- -0.3.0 2011-07-06 JSON Factory Converters -0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety +Readme file for eJSON +===================== + +team: "Javier Velilla,Jocelyn Fiat, Paul Cohen" +date: "$Date$" +revision: "$Revision$" + +1. Introduction +--------------- + +eJSON stands for Eiffel JSON library and is a small Eiffel library for dealing +with the JSON format. The objective of the library is to provide two basic +features Eiffel2JSON and JSON2Eiffel. + +2. Legal stuff +-------------- + +eJSON is copyrighted by the author Javier Velilla and others. It is licensed +under the MIT License. See the file license.txt in the same directory as this +readme file. + +3. Versioning scheme +-------------------- + +eJSON version numbers has the form: + + «major number».«minor number».«patch level» + +eJSON will retain the major number 0 as long as it has beta status. A change in +major number indicates that a release is not backward compatible. A change in +minor number indicates that a release is backward compatible (within that major +number) but that new useful features may have been added. A change in patch +level simply indicates that the release contains bug fixes for the previous +release. Note that as long as eJSON is in beta status (0.Y.Z) backward +compatibility is not guranteed for changes in minor numbers! + +4. Documentation +--------------- + +Currently the only documentation on eJSON is available at: + + https://github.com/eiffelhub/json/wiki/User-guide + +5. Requirements and installation +-------------------------------- + +EJSON requires that you have: + +1. Gobo 3.9 installed or later +2. One of the following compiler combinations installed: + * ISE Eiffel 6.5 or later. + * gec [try to test] + * tecomp [try to test] + +eJSON probably works fine with other versions of the above compilers. +There are no known platform dependencies (Windows, Linux). + +To install eJSON simply extract the ejson-X.Y.Z.zip file to some appropriate +place on your hard disk. There are no requirements on environment variables or +registry variables. + +To verify that everything works you should compile the example programs and/or +the test program. + +6. Contents of eJSON +-------------------- + +All directory names below are relative to the root directory of your ejson +installation. + +Directory Description +--------- ----------- +doc Contains the eJSON.pdf documentation file. +examples Contains the two example programs. +ejson Contains the actual eJSON library classes. +test Contains a test program for eJSON. + +7. Contacting the Team +---------------------- + +Contact the team: + + Javier Velilla «javier.hector@gmail.com» + Paul Cohen «paco@seibostudios.se» + Jocelyn Fiat «jfiat@eiffel.com» + +8. Releases +----------- + +For more information on what was changed in each release look in the file +history.txt. + +Version Date Description +------- ---- ----------- +0.3.0 2011-07-06 JSON Factory Converters +0.2.0 2010-02-07 Adapted to EiffelStudio 6.4 or later, supports void-safety 0.1.0 2010-02-07 First release, Adapted to SmartEiffel 1.2r7 and EiffelStudio 6.2 or previous \ No newline at end of file diff --git a/library/extras/file/json_file_reader.e b/library/extras/file/json_file_reader.e index 3629c475..9e2ec222 100644 --- a/library/extras/file/json_file_reader.e +++ b/library/extras/file/json_file_reader.e @@ -1,38 +1,37 @@ -note - description: "Objects that ..." - author: "" - date: "$Date$" - revision: "$Revision$" - -class - JSON_FILE_READER - -feature -- Access - - read_json_from (a_path: STRING): detachable STRING - local - l_file: PLAIN_TEXT_FILE - template_content: STRING - l_last_string: detachable STRING - do - create l_file.make (a_path) - -- We perform several checks until we make a real attempt to open the file. - if not l_file.exists then - print ("error: '" + a_path + "' does not exist%N") - else - if not l_file.is_readable then - print ("error: '" + a_path + "' is not readable.%N") - else - l_file.open_read - create template_content.make_empty - l_file.read_stream (l_file.count) - l_last_string := l_file.last_string - check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream' - template_content.append (l_last_string.string) - Result := template_content - l_file.close - end - end - end - -end +note + description: "Objects that ..." + date: "$Date$" + revision: "$Revision$" + +class + JSON_FILE_READER + +feature -- Access + + read_json_from (a_path: STRING): detachable STRING + local + l_file: PLAIN_TEXT_FILE + template_content: STRING + l_last_string: detachable STRING + do + create l_file.make (a_path) + -- We perform several checks until we make a real attempt to open the file. + if not l_file.exists then + print ("error: '" + a_path + "' does not exist%N") + else + if not l_file.is_readable then + print ("error: '" + a_path + "' is not readable.%N") + else + l_file.open_read + create template_content.make_empty + l_file.read_stream (l_file.count) + l_last_string := l_file.last_string + check l_last_string /= Void end -- implied by postcondition of `l_file.read_stream' + template_content.append (l_last_string.string) + Result := template_content + l_file.close + end + end + end + +end diff --git a/library/extras/visitor/json_visitor.e b/library/extras/visitor/json_visitor.e index bf2f583e..f032b564 100644 --- a/library/extras/visitor/json_visitor.e +++ b/library/extras/visitor/json_visitor.e @@ -1,59 +1,59 @@ -note - description: - - "JSON Visitor" - - pattern: "Visitor" - author: "Javier Velilla" - license:"MIT (see http://www.opensource.org/licenses/mit-license.php)" - date: "2008/08/24" - revision: "Revision 0.1" - -deferred class - JSON_VISITOR - -feature -- Visitor Pattern - - visit_json_array (a_json_array: JSON_ARRAY) - -- Visit `a_json_array'. - require - a_json_array_not_void: a_json_array /= Void - deferred - end - - visit_json_boolean (a_json_boolean: JSON_BOOLEAN) - -- Visit `a_json_boolean'. - require - a_json_boolean_not_void: a_json_boolean /= Void - deferred - end - - visit_json_null (a_json_null: JSON_NULL) - -- Visit `a_json_null'. - require - a_json_null_not_void: a_json_null /= Void - deferred - end - - visit_json_number (a_json_number: JSON_NUMBER) - -- Visit `a_json_number'. - require - a_json_number_not_void: a_json_number /= Void - deferred - end - - visit_json_object (a_json_object: JSON_OBJECT) - -- Visit `a_json_object'. - require - a_json_object_not_void: a_json_object /= Void - deferred - end - - visit_json_string (a_json_string: JSON_STRING) - -- Visit `a_json_string'. - require - a_json_string_not_void: a_json_string /= Void - deferred - end - -end +note + description: + + "JSON Visitor" + + pattern: "Visitor" + author: "Javier Velilla" + license:"MIT (see http://www.opensource.org/licenses/mit-license.php)" + date: "2008/08/24" + revision: "Revision 0.1" + +deferred class + JSON_VISITOR + +feature -- Visitor Pattern + + visit_json_array (a_json_array: JSON_ARRAY) + -- Visit `a_json_array'. + require + a_json_array_not_void: a_json_array /= Void + deferred + end + + visit_json_boolean (a_json_boolean: JSON_BOOLEAN) + -- Visit `a_json_boolean'. + require + a_json_boolean_not_void: a_json_boolean /= Void + deferred + end + + visit_json_null (a_json_null: JSON_NULL) + -- Visit `a_json_null'. + require + a_json_null_not_void: a_json_null /= Void + deferred + end + + visit_json_number (a_json_number: JSON_NUMBER) + -- Visit `a_json_number'. + require + a_json_number_not_void: a_json_number /= Void + deferred + end + + visit_json_object (a_json_object: JSON_OBJECT) + -- Visit `a_json_object'. + require + a_json_object_not_void: a_json_object /= Void + deferred + end + + visit_json_string (a_json_string: JSON_STRING) + -- Visit `a_json_string'. + require + a_json_string_not_void: a_json_string /= Void + deferred + end + +end diff --git a/test/autotest/test_suite/json_menu_example.txt b/test/autotest/test_suite/json_menu_example.txt index fe6c37de..de6a4e94 100644 --- a/test/autotest/test_suite/json_menu_example.txt +++ b/test/autotest/test_suite/json_menu_example.txt @@ -1,4 +1,4 @@ -{"menu": { +{ "menu": { "id": "file", "value": "File", "popup": {