Пример #1
0
/**
 * @param   {Source} xjs - Source of the XJS file.
 * @returns {undefined}
 */
function parseXJS( xjs ) {
    const xjsFileContent = xjs.read();
    try {
        return ToloframeworkPermissiveJson.parse( xjsFileContent );
    } catch ( ex ) {
        const code = getFewLinesOfCode( xjsFileContent, ex.index, 3 );
        throw Error( `Invalid permissive JSON syntax:${ex.message}\n\n${code}` );
    }
}
Пример #2
0
function parsePropertyJSON( root, libs, com ) {
  var text = libs.Tree.text( root ).trim( );
  try {
    var obj = ToloframeworkPermissiveJson.parse( text );
    com.prop[root.name] = JSON.stringify( obj , null, '  ' );
    console.info("[x-widget.com] obj=", obj);
  } catch ( ex ) {
    libs.fatal( "Unable to parse JSON value of property `" + root.name + "`: " + ex + "\n" + text );
  }
}