/*
* Copyright (c) 2011-2026 Ross Cunniff
*
* 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.
*/
namespace json {
extern read; // arr = json::read(inputFile)
extern write; // json::write(outputFile, arr)
// Base object for multi-valued key/value JSON objects
class OBJECT {
public var contents; // Array of key/value pairs
}
const E_MEMORY = -1; // Memory allocation failure
const E_EOF = -2; // Unexpected end-of-file
const E_SYNTAX = -3; // Syntax error
const E_COLON = -4; // ':' expected
const E_COMMA = -5; // ',' expected
const E_STRING = -6; // string expected
const E_LBRACE = -7; // '{' expected
const E_UTF8 = -8; // Invalid UTF-8 encoding
const E_UTF16 = -9; // Invalid UTF-16 encoding
const E_DEPTH = -10; // JSON nesting too deep
const E_EOF_EXPECTED = -11; // EOF expected
const E_OADL = -12; // Other OADL error
const READ_LONG = 0x00000001; // Read longs/doubles instead of ints/floats
var readFlags:Int; // Read behavior; from READ_*, above
var maxDepth:Int; // Maximum nested depth of JSON; default is 2*oadl::MAX_RANK
var errNumber; // Error number if read fails, from E_* above
var errLine; // Line number at which failure occurred
}
using extern "libjson";