From 4687604d31691be9aea9b8fdefb0c277f72d2dde Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Wed, 26 Oct 2016 13:34:55 -0700 Subject: [PATCH 01/17] Add support for PBXShellScriptBuildPhase --- lib/pbxProject.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 9a2f5ed..23c0408 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -811,7 +811,7 @@ pbxProject.prototype.addTargetDependency = function(target, dependencyTargets) { return { uuid: target, target: nativeTargets[target] }; } -pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, comment, target, folderType, subfolderPath) { +pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, comment, target, optionsOrFolderType, subfolderPath) { var buildPhaseSection, fileReferenceSection = this.pbxFileReferenceSection(), buildFileSection = this.pbxBuildFileSection(), @@ -827,7 +827,9 @@ pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, co filePathToBuildFile = {}; if (buildPhaseType === 'PBXCopyFilesBuildPhase') { - buildPhase = pbxCopyFilesBuildPhaseObj(buildPhase, folderType, subfolderPath, comment); + buildPhase = pbxCopyFilesBuildPhaseObj(buildPhase, optionsOrFolderType, subfolderPath, comment); + } else if (buildPhaseType === 'PBXShellScriptBuildPhase') { + buildPhase = pbxShellScriptBuildPhaseObj(buildPhase, optionsOrFolderType, comment) } if (!this.hash.project.objects[buildPhaseType]) { @@ -1490,7 +1492,7 @@ function pbxBuildPhaseObj(file) { return obj; } -function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName){ +function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName) { // Add additional properties for 'CopyFiles' build phase var DESTINATION_BY_TARGETTYPE = { @@ -1523,6 +1525,18 @@ function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName){ obj.name = '"' + phaseName + '"'; obj.dstPath = subfolderPath || '""'; obj.dstSubfolderSpec = SUBFOLDERSPEC_BY_DESTINATION[DESTINATION_BY_TARGETTYPE[folderType]]; + console.log("pbxCopyFilesBuildPhase"); + console.log(obj); + + return obj; +} + +function pbxShellScriptBuildPhaseObj(obj, options, phaseName) { + obj.name = '"' + phaseName + '"'; + obj.inputPaths = options.inputPaths || []; + obj.outputPaths = options.outputPaths || []; + obj.shellPath = options.shellPath; + obj.shellScript = '"' + options.shellScript.replace(/"/g, '\\"') + '"'; return obj; } From e8b9f7aeb31cc954117308248a5fb8c10dbac01c Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Thu, 27 Oct 2016 11:25:46 -0700 Subject: [PATCH 02/17] RM debug logs --- lib/pbxProject.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 23c0408..c568e50 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1525,8 +1525,6 @@ function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName) { obj.name = '"' + phaseName + '"'; obj.dstPath = subfolderPath || '""'; obj.dstSubfolderSpec = SUBFOLDERSPEC_BY_DESTINATION[DESTINATION_BY_TARGETTYPE[folderType]]; - console.log("pbxCopyFilesBuildPhase"); - console.log(obj); return obj; } From f7a77f1a4cc75eb5d954c138bf15aaf1b3e32ce3 Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Wed, 26 Oct 2016 13:35:40 -0700 Subject: [PATCH 03/17] Upgrade to 0.9.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dbec25f..7e1068a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Andrew Lunny ", "name": "xcode", "description": "parser for xcodeproj/project.pbxproj files", - "version": "0.8.9", + "version": "0.9.0", "main": "index.js", "repository": { "url": "https://github.com/alunny/node-xcode.git" From cab0d0d8eb3781ef6d190a1c11490f2f75d8bd5c Mon Sep 17 00:00:00 2001 From: Ryan Sundberg Date: Thu, 27 Oct 2016 11:29:51 -0700 Subject: [PATCH 04/17] Test case for PBXShellScriptBuildPhase --- test/addBuildPhase.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/addBuildPhase.js b/test/addBuildPhase.js index a9c5c39..f5dd27c 100644 --- a/test/addBuildPhase.js +++ b/test/addBuildPhase.js @@ -110,4 +110,11 @@ exports.addBuildPhase = { test.equal(buildPhase.dstSubfolderSpec, 10); test.done(); }, + 'should add a script build phase to echo "hello world!"': function(test) { + var options = {shellPath: '/bin/sh', shellScript: 'echo "hello world!"'}; + var buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase; + test.equal(buildPhase.shellPath, '/bin/sh'); + test.equal(buildPhase.shellScript, '"echo \\"hello world!\\""'); + test.done(); + }, } From e842a9e5a472ddb00f7cae97bd1e1f812f93efb5 Mon Sep 17 00:00:00 2001 From: kelvinho Date: Sat, 3 Dec 2016 03:44:49 +0800 Subject: [PATCH 05/17] added PBXVariantGroup for localization and nodeunit test cases --- lib/pbxFile.js | 6 +- lib/pbxProject.js | 162 ++++-- test/addResourceFile.js | 16 + test/parser/projects/variantgroup.pbxproj | 589 ++++++++++++++++++++++ test/variantGroup.js | 177 +++++++ 5 files changed, 915 insertions(+), 35 deletions(-) create mode 100644 test/parser/projects/variantgroup.pbxproj create mode 100644 test/variantGroup.js diff --git a/lib/pbxFile.js b/lib/pbxFile.js index 67cb6cf..768122a 100644 --- a/lib/pbxFile.js +++ b/lib/pbxFile.js @@ -29,7 +29,8 @@ var FILETYPE_BY_EXTENSION = { xcdatamodel: 'wrapper.xcdatamodel', xcodeproj: 'wrapper.pb-project', xctest: 'wrapper.cfbundle', - xib: 'file.xib' + xib: 'file.xib', + strings: 'text.plist.strings' }, GROUP_BY_FILETYPE = { 'archive.ar': 'Frameworks', @@ -59,7 +60,8 @@ var FILETYPE_BY_EXTENSION = { 'text': 4, 'text.plist.xml': 4, 'text.script.sh': 4, - 'text.xcconfig': 4 + 'text.xcconfig': 4, + 'text.plist.strings': 4 }; diff --git a/lib/pbxProject.js b/lib/pbxProject.js index c568e50..14abeac 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -241,14 +241,21 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { correctForResourcesPath(file, this); file.fileRef = this.generateUuid(); } - - this.addToPbxBuildFileSection(file); // PBXBuildFile - this.addToPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase - + + if (!opt.variantGroup) { + this.addToPbxBuildFileSection(file); // PBXBuildFile + this.addToPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase + } + if (!opt.plugin) { this.addToPbxFileReferenceSection(file); // PBXFileReference if (group) { - this.addToPbxGroup(file, group); //Group other than Resources (i.e. 'splash') + if (this.getPBXGroupByKey(group)) { + this.addToPbxGroup(file, group); //Group other than Resources (i.e. 'splash') + } + else if (this.getPBXVariantGroupByKey(group)) { + this.addToPbxVariantGroup(file, group); // PBXVariantGroup + } } else { this.addToResourcesPbxGroup(file); // PBXGroup @@ -275,7 +282,12 @@ pbxProject.prototype.removeResourceFile = function(path, opt, group) { this.removeFromPbxBuildFileSection(file); // PBXBuildFile this.removeFromPbxFileReferenceSection(file); // PBXFileReference if (group) { - this.removeFromPbxGroup(file, group); //Group other than Resources (i.e. 'splash') + if (this.getPBXGroupByKey(group)) { + this.removeFromPbxGroup(file, group); //Group other than Resources (i.e. 'splash') + } + else if (this.getPBXVariantGroupByKey(group)) { + this.removeFromPbxVariantGroup(file, group); // PBXVariantGroup + } } else { this.removeFromResourcesPbxGroup(file); // PBXGroup @@ -1696,15 +1708,20 @@ pbxProject.prototype.getFirstTarget = function() { /*** NEW ***/ -pbxProject.prototype.addToPbxGroup = function (file, groupKey) { - var group = this.getPBXGroupByKey(groupKey); +pbxProject.prototype.addToPbxGroupType = function (file, groupKey, groupType) { + var group = this.getPBXGroupByKeyAndType(groupKey, groupType); if (group && group.children !== undefined) { if (typeof file === 'string') { //Group Key var childGroup = { value:file, - comment: this.getPBXGroupByKey(file).name }; + if (this.getPBXGroupByKey(file)) { + childGroup.comment = this.getPBXGroupByKey(file).name; + } + else if (this.getPBXVariantGroupByKey(file)) { + childGroup.comment = this.getPBXVariantGroupByKey(file).name; + } group.children.push(childGroup); } @@ -1715,8 +1732,53 @@ pbxProject.prototype.addToPbxGroup = function (file, groupKey) { } } -pbxProject.prototype.removeFromPbxGroup = function (file, groupKey) { - var group = this.getPBXGroupByKey(groupKey); +pbxProject.prototype.addToPbxVariantGroup = function (file, groupKey) { + this.addToPbxGroupType(file, groupKey, 'PBXVariantGroup'); +} + +pbxProject.prototype.addToPbxGroup = function (file, groupKey) { + this.addToPbxGroupType(file, groupKey, 'PBXGroup'); +} + + + +pbxProject.prototype.pbxCreateGroupWithType = function(name, pathName, groupType) { + //Create object + var model = { + isa: '"' + groupType + '"', + children: [], + name: name, + sourceTree: '""' + }; + if (pathName) model.path = pathName; + var key = this.generateUuid(); + + //Create comment + var commendId = key + '_comment'; + + //add obj and commentObj to groups; + var groups = this.hash.project.objects[groupType]; + if (!groups) { + groups = this.hash.project.objects[groupType] = new Object(); + } + groups[commendId] = name; + groups[key] = model; + + return key; +} + +pbxProject.prototype.pbxCreateVariantGroup = function(name) { + return this.pbxCreateGroupWithType(name, undefined, 'PBXVariantGroup') +} + +pbxProject.prototype.pbxCreateGroup = function(name, pathName) { + return this.pbxCreateGroupWithType(name, pathName, 'PBXGroup'); +} + + + +pbxProject.prototype.removeFromPbxGroupAndType = function (file, groupKey, groupType) { + var group = this.getPBXGroupByKeyAndType(groupKey, groupType); if (group) { var groupChildren = group.children, i; for(i in groupChildren) { @@ -1729,12 +1791,32 @@ pbxProject.prototype.removeFromPbxGroup = function (file, groupKey) { } } +pbxProject.prototype.removeFromPbxGroup = function (file, groupKey) { + this.removeFromPbxGroupAndType(file, groupKey, 'PBXGroup'); +} + +pbxProject.prototype.removeFromPbxVariantGroup = function (file, groupKey) { + this.removeFromPbxGroupAndType(file, groupKey, 'PBXVariantGroup'); +} + + + +pbxProject.prototype.getPBXGroupByKeyAndType = function(key, groupType) { + return this.hash.project.objects[groupType][key]; +}; + pbxProject.prototype.getPBXGroupByKey = function(key) { return this.hash.project.objects['PBXGroup'][key]; }; -pbxProject.prototype.findPBXGroupKey = function(criteria) { - var groups = this.hash.project.objects['PBXGroup']; +pbxProject.prototype.getPBXVariantGroupByKey = function(key) { + return this.hash.project.objects['PBXVariantGroup'][key]; +}; + + + +pbxProject.prototype.findPBXGroupKeyAndType = function(criteria, groupType) { + var groups = this.hash.project.objects[groupType]; var target; for (var key in groups) { @@ -1765,28 +1847,30 @@ pbxProject.prototype.findPBXGroupKey = function(criteria) { return target; } -pbxProject.prototype.pbxCreateGroup = function(name, pathName) { +pbxProject.prototype.findPBXGroupKey = function(criteria) { + return this.findPBXGroupKeyAndType(criteria, 'PBXGroup'); +} - //Create object - var model = { - isa:"PBXGroup", - children: [], - name: name, - path: pathName, - sourceTree: '""' - }; - var key = this.generateUuid(); +pbxProject.prototype.findPBXVariantGroupKey = function(criteria) { + return this.findPBXGroupKeyAndType(criteria, 'PBXVariantGroup'); +} - //Create comment - var commendId = key + '_comment'; +pbxProject.prototype.addLocalizationVariantGroup = function(name) { + var groupKey = this.pbxCreateVariantGroup(name); - //add obj and commentObj to groups; - var groups = this.hash.project.objects['PBXGroup']; - groups[commendId] = name; - groups[key] = model; + var resourceGroupKey = this.findPBXGroupKey({name: 'Resources'}); + this.addToPbxGroup(groupKey, resourceGroupKey); - return key; -} + var localizationVariantGroup = { + uuid: this.generateUuid(), + fileRef: groupKey, + basename: name + } + this.addToPbxBuildFileSection(localizationVariantGroup); // PBXBuildFile + this.addToPbxResourcesBuildPhase(localizationVariantGroup); //PBXResourcesBuildPhase + + return localizationVariantGroup; +}; pbxProject.prototype.getPBXObject = function(name) { @@ -1804,7 +1888,13 @@ pbxProject.prototype.addFile = function (path, group, opt) { file.fileRef = this.generateUuid(); this.addToPbxFileReferenceSection(file); // PBXFileReference - this.addToPbxGroup(file, group); // PBXGroup + + if (this.getPBXGroupByKey(group)) { + this.addToPbxGroup(file, group); // PBXGroup + } + else if (this.getPBXVariantGroupByKey(group)) { + this.addToPbxVariantGroup(file, group); // PBXVariantGroup + } return file; } @@ -1813,7 +1903,13 @@ pbxProject.prototype.removeFile = function (path, group, opt) { var file = new pbxFile(path, opt); this.removeFromPbxFileReferenceSection(file); // PBXFileReference - this.removeFromPbxGroup(file, group); // PBXGroup + + if (this.getPBXGroupByKey(group)) { + this.removeFromPbxGroup(file, group); // PBXGroup + } + else if (this.getPBXVariantGroupByKey(group)) { + this.removeFromPbxVariantGroup(file, group); // PBXVariantGroup + } return file; } diff --git a/test/addResourceFile.js b/test/addResourceFile.js index e464ecd..3959efb 100644 --- a/test/addResourceFile.js +++ b/test/addResourceFile.js @@ -210,6 +210,22 @@ exports.addResourceFile = { test.done(); } }, + 'when added with { variantGroup: true }': { + + 'should not add to the PBXResourcesBuildPhase and PBXBuildFile': function (test) { + var newFile = proj.addResourceFile('en.lproj/Localization.strings', + { variantGroup: true }); + + var sources = proj.pbxResourcesBuildPhaseObj(); + test.equal(sources.files.length, 12); + + var buildFileSection = proj.pbxBuildFileSection(); + test.ok(buildFileSection[newFile.uuid] === undefined); + + test.done(); + }, + + }, 'duplicate entries': { 'should return false': function (test) { var newFile = proj.addResourceFile('Plugins/assets.bundle'); diff --git a/test/parser/projects/variantgroup.pbxproj b/test/parser/projects/variantgroup.pbxproj new file mode 100644 index 0000000..0e7eac2 --- /dev/null +++ b/test/parser/projects/variantgroup.pbxproj @@ -0,0 +1,589 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; }; + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 301BF552109A68D80062928A /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libCordova.a */; }; + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D95EF14D2391D003F00A1 /* MainViewController.m */; }; + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; }; + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; }; + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */; }; + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */; }; + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */; }; + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */; }; + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */; }; + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBC154F3926009F9C59 /* Default~iphone.png */; }; + 308D05371370CCF300D202BF /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052E1370CCF300D202BF /* icon-72.png */; }; + 308D05381370CCF300D202BF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052F1370CCF300D202BF /* icon.png */; }; + 308D05391370CCF300D202BF /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D05301370CCF300D202BF /* icon@2x.png */; }; + 30B4F30019D5E07200D9F7D8 /* Default-667h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */; }; + 30B4F30119D5E07200D9F7D8 /* Default-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */; }; + 30B4F30219D5E07200D9F7D8 /* Default-Landscape-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */; }; + 30C1856619D5FC0A00212699 /* icon-60@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30C1856519D5FC0A00212699 /* icon-60@3x.png */; }; + 30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30FC414816E50CA1004E6F35 /* icon-72@2x.png */; }; + 5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */; }; + 7E7966DE1810823500FA85AD /* icon-40.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D41810823500FA85AD /* icon-40.png */; }; + 7E7966DF1810823500FA85AD /* icon-40@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D51810823500FA85AD /* icon-40@2x.png */; }; + 7E7966E01810823500FA85AD /* icon-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D61810823500FA85AD /* icon-50.png */; }; + 7E7966E11810823500FA85AD /* icon-50@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D71810823500FA85AD /* icon-50@2x.png */; }; + 7E7966E21810823500FA85AD /* icon-60.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D81810823500FA85AD /* icon-60.png */; }; + 7E7966E31810823500FA85AD /* icon-60@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D91810823500FA85AD /* icon-60@2x.png */; }; + 7E7966E41810823500FA85AD /* icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DA1810823500FA85AD /* icon-76.png */; }; + 7E7966E51810823500FA85AD /* icon-76@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DB1810823500FA85AD /* icon-76@2x.png */; }; + 7E7966E61810823500FA85AD /* icon-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DC1810823500FA85AD /* icon-small.png */; }; + 7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DD1810823500FA85AD /* icon-small@2x.png */; }; + D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */; }; + 07E3BDBD1DF1DEA500E49912 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 07E3BDBF1DF1DEAF00E49912 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 301BF534109A57CC0062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D2AAC07E0554694100DB518D; + remoteInfo = CordovaLib; + }; + 301BF550109A68C00062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = CordovaLib; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 1D6058910D05DD3D006BFB54 /* HelloCordova.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloCordova.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 1F766FDD13BBADB100FB74C0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; + 1F766FE013BBADB100FB74C0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = Localizable.strings; sourceTree = ""; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = "CordovaLib/CordovaLib.xcodeproj"; sourceTree = ""; }; + 301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; }; + 302D95EE14D2391D003F00A1 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; + 302D95EF14D2391D003F00A1 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; + 302D95F014D2391D003F00A1 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = ""; }; + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = ""; }; + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = ""; }; + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = ""; }; + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = ""; }; + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x~iphone.png"; sourceTree = ""; }; + 3088BBBC154F3926009F9C59 /* Default~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default~iphone.png"; sourceTree = ""; }; + 308D052E1370CCF300D202BF /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72.png"; sourceTree = ""; }; + 308D052F1370CCF300D202BF /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; + 308D05301370CCF300D202BF /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = ""; }; + 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h.png"; sourceTree = ""; }; + 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h.png"; sourceTree = ""; }; + 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-736h.png"; sourceTree = ""; }; + 30C1856519D5FC0A00212699 /* icon-60@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60@3x.png"; sourceTree = ""; }; + 30FC414816E50CA1004E6F35 /* icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72@2x.png"; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* HelloCordova-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HelloCordova-Prefix.pch"; sourceTree = ""; }; + 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; + 7E7966D41810823500FA85AD /* icon-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40.png"; sourceTree = ""; }; + 7E7966D51810823500FA85AD /* icon-40@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40@2x.png"; sourceTree = ""; }; + 7E7966D61810823500FA85AD /* icon-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-50.png"; sourceTree = ""; }; + 7E7966D71810823500FA85AD /* icon-50@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-50@2x.png"; sourceTree = ""; }; + 7E7966D81810823500FA85AD /* icon-60.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60.png"; sourceTree = ""; }; + 7E7966D91810823500FA85AD /* icon-60@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60@2x.png"; sourceTree = ""; }; + 7E7966DA1810823500FA85AD /* icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76.png"; sourceTree = ""; }; + 7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = ""; }; + 7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = ""; }; + 7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* HelloCordova-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "HelloCordova-Info.plist"; path = "../HelloCordova-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = ""; }; + EB87FDF21871DA7A0020F90C /* merges */ = {isa = PBXFileReference; lastKnownFileType = folder; name = merges; path = ../../merges; sourceTree = ""; }; + EB87FDF31871DA8E0020F90C /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; name = www; path = ../../www; sourceTree = ""; }; + EB87FDF41871DAF40020F90C /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = ../../config.xml; sourceTree = ""; }; + F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "HelloCordova/config.xml"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */, + 301BF552109A68D80062928A /* libCordova.a in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 302D95EE14D2391D003F00A1 /* MainViewController.h */, + 302D95EF14D2391D003F00A1 /* MainViewController.m */, + 302D95F014D2391D003F00A1 /* MainViewController.xib */, + 1D3623240D0F684500981E51 /* AppDelegate.h */, + 1D3623250D0F684500981E51 /* AppDelegate.m */, + ); + name = Classes; + path = "HelloCordova/Classes"; + sourceTree = SOURCE_ROOT; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* HelloCordova.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + EB87FDF41871DAF40020F90C /* config.xml */, + EB87FDF31871DA8E0020F90C /* www */, + EB87FDF21871DA7A0020F90C /* merges */, + EB87FDF11871DA420020F90C /* Staging */, + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */, + 080E96DDFE201D6D7F000001 /* Classes */, + 307C750510C5A3420062BCA9 /* Plugins */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* HelloCordova-Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + path = "HelloCordova"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 308D052D1370CCF300D202BF /* icons */, + 308D05311370CCF300D202BF /* splash */, + 8D1107310486CEB800E47090 /* HelloCordova-Info.plist */, + ); + name = Resources; + path = "HelloCordova/Resources"; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 301BF52E109A57CC0062928A /* Products */ = { + isa = PBXGroup; + children = ( + 301BF535109A57CC0062928A /* libCordova.a */, + ); + name = Products; + sourceTree = ""; + }; + 307C750510C5A3420062BCA9 /* Plugins */ = { + isa = PBXGroup; + children = ( + ); + name = Plugins; + path = "HelloCordova/Plugins"; + sourceTree = SOURCE_ROOT; + }; + 308D052D1370CCF300D202BF /* icons */ = { + isa = PBXGroup; + children = ( + 30C1856519D5FC0A00212699 /* icon-60@3x.png */, + 7E7966D41810823500FA85AD /* icon-40.png */, + 7E7966D51810823500FA85AD /* icon-40@2x.png */, + 7E7966D61810823500FA85AD /* icon-50.png */, + 7E7966D71810823500FA85AD /* icon-50@2x.png */, + 7E7966D81810823500FA85AD /* icon-60.png */, + 7E7966D91810823500FA85AD /* icon-60@2x.png */, + 7E7966DA1810823500FA85AD /* icon-76.png */, + 7E7966DB1810823500FA85AD /* icon-76@2x.png */, + 7E7966DC1810823500FA85AD /* icon-small.png */, + 7E7966DD1810823500FA85AD /* icon-small@2x.png */, + 30FC414816E50CA1004E6F35 /* icon-72@2x.png */, + 308D052E1370CCF300D202BF /* icon-72.png */, + 308D052F1370CCF300D202BF /* icon.png */, + 308D05301370CCF300D202BF /* icon@2x.png */, + ); + path = icons; + sourceTree = ""; + }; + 308D05311370CCF300D202BF /* splash */ = { + isa = PBXGroup; + children = ( + 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */, + 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */, + 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */, + D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */, + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */, + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */, + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */, + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */, + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */, + 3088BBBC154F3926009F9C59 /* Default~iphone.png */, + ); + path = splash; + sourceTree = ""; + }; + EB87FDF11871DA420020F90C /* Staging */ = { + isa = PBXGroup; + children = ( + F840E1F0165FE0F500CFE078 /* config.xml */, + 301BF56E109A69640062928A /* www */, + ); + name = Staging; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXVariantGroup section */ +07E3BDBC1DF1DEA500E49912 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 07E3BDBD1DF1DEA500E49912 /* en */, + 07E3BDBF1DF1DEAF00E49912 /* ja */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* HelloCordova */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloCordova" */; + buildPhases = ( + 304B58A110DAC018002A0835 /* Copy www directory */, + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 301BF551109A68C00062928A /* PBXTargetDependency */, + ); + name = "HelloCordova"; + productName = "HelloCordova"; + productReference = 1D6058910D05DD3D006BFB54 /* HelloCordova.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "__CLI__" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + en, + es, + de, + se, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 301BF52E109A57CC0062928A /* Products */; + ProjectRef = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* HelloCordova */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 301BF535109A57CC0062928A /* libCordova.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libCordova.a; + remoteRef = 301BF534109A57CC0062928A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7E7966E41810823500FA85AD /* icon-76.png in Resources */, + 7E7966DF1810823500FA85AD /* icon-40@2x.png in Resources */, + 308D05371370CCF300D202BF /* icon-72.png in Resources */, + 30B4F30119D5E07200D9F7D8 /* Default-736h.png in Resources */, + 308D05381370CCF300D202BF /* icon.png in Resources */, + 308D05391370CCF300D202BF /* icon@2x.png in Resources */, + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */, + 7E7966E01810823500FA85AD /* icon-50.png in Resources */, + 7E7966E31810823500FA85AD /* icon-60@2x.png in Resources */, + 7E7966E61810823500FA85AD /* icon-small.png in Resources */, + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */, + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */, + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */, + 7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */, + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */, + 30B4F30019D5E07200D9F7D8 /* Default-667h.png in Resources */, + 7E7966DE1810823500FA85AD /* icon-40.png in Resources */, + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */, + 7E7966E21810823500FA85AD /* icon-60.png in Resources */, + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */, + D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */, + 30B4F30219D5E07200D9F7D8 /* Default-Landscape-736h.png in Resources */, + 30C1856619D5FC0A00212699 /* icon-60@3x.png in Resources */, + 7E7966E11810823500FA85AD /* icon-50@2x.png in Resources */, + 7E7966E51810823500FA85AD /* icon-76@2x.png in Resources */, + 30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 304B58A110DAC018002A0835 /* Copy www directory */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy www directory"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cordova/lib/copy-www-build-step.sh"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */, + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 301BF551109A68C00062928A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CordovaLib; + targetProxy = 301BF550109A68C00062928A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloCordova/HelloCordova-Prefix.pch"; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; + INFOPLIST_FILE = "HelloCordova/HelloCordova-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-ObjC", + ); + PRODUCT_NAME = "HelloCordova"; + TARGETED_DEVICE_FAMILY = "1"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloCordova/HelloCordova-Prefix.pch"; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; + INFOPLIST_FILE = "HelloCordova/HelloCordova-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-ObjC", + ); + PRODUCT_NAME = "HelloCordova"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-ObjC", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-ObjC", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloCordova" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "__CLI__" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/test/variantGroup.js b/test/variantGroup.js new file mode 100644 index 0000000..4b3733e --- /dev/null +++ b/test/variantGroup.js @@ -0,0 +1,177 @@ +var pbx = require('../lib/pbxProject'), + project, + projectHash; + +var findChildInGroup = function(obj, target) { + var found = false; + + for (var i = 0, j = obj.children.length; i < j; i++) { + if (obj.children[i].value === target) { + found = true; + break; + } + } + + return found; +} + +var findFileByUUID = function(obj, target) { + var found = false; + + for (var k = 0, l = obj.files.length; k < l; k++) { + if (obj.files[k].value === target) { + found = true; + break; + } + } + + return found; +} + +var findByFileRef = function(obj, target) { + var found = false; + + for (var property in obj) { + if (!/comment/.test(property)) { + if (obj[property].fileRef === target) { + found = true; + break; + } + } + } + return found; +} + +var findByName = function(obj, target) { + var found = false; + for (var property in obj) { + if (!/comment/.test(property)) { + var value = obj[property]; + if (value.name === target) { + found = true; + } + } + } + return found; +} + +exports.setUp = function(callback) { + project = new pbx('test/parser/projects/variantgroup.pbxproj'); + projectHash = project.parseSync(); + callback(); +} + +exports.getVariantGroupByKey = { + 'should return PBXVariantGroup for Localizable.strings': function(test) { + var groupKey = project.findPBXVariantGroupKey({name: 'Localizable.strings'}); + var group = project.getPBXVariantGroupByKey(groupKey); + test.ok(group.name === 'Localizable.strings'); + test.done(); + } +} + +exports.createVariantGroup = { + 'should create a new Test Variant Group': function(test) { + delete project.getPBXObject('PBXVariantGroup'); + + var found = false; + var groups = project.getPBXObject('PBXVariantGroup'); + + var found = findByName(groups, 'Test'); + test.ok(found === false); + + var group = project.findPBXVariantGroupKey({name:'Test'}); + test.ok(group === undefined); + + project.pbxCreateVariantGroup('Test'); + + groups = project.getPBXObject('PBXVariantGroup'); + found = findByName(groups, 'Test'); + test.ok(found === true); + + group = project.findPBXVariantGroupKey({name:'Test'}); + test.ok(typeof group === 'string'); + test.done(); + } +} + +exports.findVariantGroupKey = { + 'should return a valid group key':function(test) { + var keyByName = project.findPBXVariantGroupKey({ name: 'Localizable.strings'}); + var nonExistingKey = project.findPBXVariantGroupKey({ name: 'Foo'}); + + test.ok(keyByName === '07E3BDBC1DF1DEA500E49912'); + test.ok(nonExistingKey === undefined); + + test.done(); + } +} + +exports.createLocalisationVariantGroup = { + 'should create a new localisation variationgroup then add group to Resources group': function(test) { + delete project.getPBXObject('PBXVariantGroup'); + + var localizationVariantGp = project.addLocalizationVariantGroup('InfoPlist.strings'); + + var resourceGroupKey = project.findPBXGroupKey({name: 'Resources'}); + var resourceGroup = project.getPBXGroupByKey(resourceGroupKey); + var foundInResourcesGroup = findChildInGroup(resourceGroup, localizationVariantGp.fileRef ); + test.ok(foundInResourcesGroup); + + var foundInResourcesBuildPhase = false; + var sources = project.pbxResourcesBuildPhaseObj(); + for (var i = 0, j = sources.files.length; i < j; i++) { + var file = sources.files[i]; + if (file.value === localizationVariantGp.uuid) { + foundInResourcesBuildPhase = true; + } + } + test.ok(foundInResourcesBuildPhase); + + test.done(); + } +} + +exports.addResourceFileToLocalisationGroup = { + 'should add resource file to the TestVariantGroup group' : function(test) { + + var infoPlistVarGp = project.addLocalizationVariantGroup('InfoPlist.strings'); + var testKey = infoPlistVarGp.fileRef; + var file = project.addResourceFile('Resources/en.lproj/Localization.strings', {variantGroup: true}, testKey); + + var foundInLocalisationVariantGroup = findChildInGroup(project.getPBXVariantGroupByKey(testKey), file.fileRef ); + test.ok(foundInLocalisationVariantGroup); + + var foundInResourcesBuildPhase = false; + var sources = project.pbxResourcesBuildPhaseObj(); + for (var i = 0, j = sources.files.length; i < j; i++) { + var sourceFile = sources.files[i]; + if (sourceFile.value === file.fileRef) { + foundInResourcesBuildPhase = true; + } + } + test.ok(!foundInResourcesBuildPhase); + + var buildFileSection = project.pbxBuildFileSection(); + test.ok(buildFileSection[file.uuid] === undefined); + + test.done(); + } +} + +exports.removeResourceFileFromGroup = { + 'should add resource file then remove resource file from Localizable.strings group' : function(test) { + var testKey = project.findPBXVariantGroupKey({name:'Localizable.strings'}); + var file = project.addResourceFile('Resources/zh.lproj/Localization.strings', {}, testKey); + + var foundInGroup = findChildInGroup(project.getPBXVariantGroupByKey(testKey),file.fileRef ); + test.ok(foundInGroup); + + project.removeResourceFile('Resources/zh.lproj/Localization.strings', {}, testKey); + + var foundInGroup = findChildInGroup(project.getPBXVariantGroupByKey(testKey),file.fileRef ); + test.ok(!foundInGroup); + + test.done(); + } +} \ No newline at end of file From f40466f2c5155829c104ab8994621986a97bcc00 Mon Sep 17 00:00:00 2001 From: "zhenglu.zl" Date: Fri, 9 Dec 2016 17:24:02 +0800 Subject: [PATCH 06/17] change tail recursive -> iterate --- lib/parser/pbxproj.js | 2830 +++++++++++++++++++------------------- lib/parser/pbxproj.pegjs | 32 +- 2 files changed, 1454 insertions(+), 1408 deletions(-) diff --git a/lib/parser/pbxproj.js b/lib/parser/pbxproj.js index f574479..69f2a6a 100644 --- a/lib/parser/pbxproj.js +++ b/lib/parser/pbxproj.js @@ -1,1843 +1,1899 @@ -module.exports = (function() { - /* - * Generated by PEG.js 0.8.0. - * - * http://pegjs.majda.cz/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + +"use strict"; + +function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); +} + +function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); } +} - function SyntaxError(message, expected, found, offset, line, column) { - this.message = message; - this.expected = expected; - this.found = found; - this.offset = offset; - this.line = line; - this.column = column; +peg$subclass(peg$SyntaxError, Error); - this.name = "SyntaxError"; - } +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, - peg$subclass(SyntaxError, Error); + "class": function(expectation) { + var escapedParts = "", + i; - function parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } - peg$FAILED = {}, + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, - peg$startRuleFunctions = { Project: peg$parseProject }, - peg$startRuleFunction = peg$parseProject, + any: function(expectation) { + return "any character"; + }, - peg$c0 = peg$FAILED, - peg$c1 = null, - peg$c2 = function(headComment, obj) { - var proj = Object.create(null) - proj.project = obj + end: function(expectation) { + return "end of input"; + }, - if (headComment) { - proj.headComment = headComment - } + other: function(expectation) { + return expectation.description; + } + }; - return proj; - }, - peg$c3 = "{", - peg$c4 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c5 = "}", - peg$c6 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c7 = function(obj) { return obj }, - peg$c8 = function() { return Object.create(null) }, - peg$c9 = [], - peg$c10 = function(head, tail) { - if (tail) return merge(head,tail) - else return head - }, - peg$c11 = function(head, tail) { - if (tail) return merge(head,tail) - else return head - }, - peg$c12 = "=", - peg$c13 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c14 = ";", - peg$c15 = { type: "literal", value: ";", description: "\";\"" }, - peg$c16 = function(id, val) { - var result = Object.create(null); - result[id] = val - return result - }, - peg$c17 = function(commentedId, val) { - var result = Object.create(null), - commentKey = commentedId.id + '_comment'; - - result[commentedId.id] = val; - result[commentKey] = commentedId[commentKey]; - return result; - - }, - peg$c18 = function(id, commentedVal) { - var result = Object.create(null); - result[id] = commentedVal.value; - result[id + "_comment"] = commentedVal.comment; - return result; - }, - peg$c19 = function(id, comment) { - var result = Object.create(null); - result.id = id; - result[id + "_comment"] = comment.trim(); - return result - }, - peg$c20 = function(literal, comment) { - var result = Object.create(null) - result.comment = comment.trim(); - result.value = literal.trim(); - return result; - }, - peg$c21 = /^[^*]/, - peg$c22 = { type: "class", value: "[^*]", description: "[^*]" }, - peg$c23 = function(body) { return body.join('') }, - peg$c24 = "/*", - peg$c25 = { type: "literal", value: "/*", description: "\"/*\"" }, - peg$c26 = "*/", - peg$c27 = { type: "literal", value: "*/", description: "\"*/\"" }, - peg$c28 = function(begin, fields) { - var section = Object.create(null); - section[begin.name] = fields - - return section - }, - peg$c29 = "/* Begin ", - peg$c30 = { type: "literal", value: "/* Begin ", description: "\"/* Begin \"" }, - peg$c31 = " section */", - peg$c32 = { type: "literal", value: " section */", description: "\" section */\"" }, - peg$c33 = function(sectionName) { return { name: sectionName } }, - peg$c34 = "/* End ", - peg$c35 = { type: "literal", value: "/* End ", description: "\"/* End \"" }, - peg$c36 = "(", - peg$c37 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c38 = ")", - peg$c39 = { type: "literal", value: ")", description: "\")\"" }, - peg$c40 = function(arr) { return arr }, - peg$c41 = function() { return [] }, - peg$c42 = function(head, tail) { - if (tail) { - tail.unshift(head); - return tail; - } else { - return [head]; - } - }, - peg$c43 = function(val) { return val }, - peg$c44 = function(val, comment) { - var result = Object.create(null); - result.value = val.trim(); - result.comment = comment.trim(); - return result; - }, - peg$c45 = ",", - peg$c46 = { type: "literal", value: ",", description: "\",\"" }, - peg$c47 = void 0, - peg$c48 = /^[A-Za-z0-9_.]/, - peg$c49 = { type: "class", value: "[A-Za-z0-9_.]", description: "[A-Za-z0-9_.]" }, - peg$c50 = function(id) { return id.join('') }, - peg$c51 = ".", - peg$c52 = { type: "literal", value: ".", description: "\".\"" }, - peg$c53 = function(decimal) { - // store decimals as strings - // as JS doesn't differentiate bw strings and numbers - return decimal.join('') - }, - peg$c54 = function(number) { return parseInt(number.join(''), 10) }, - peg$c55 = function(str) { return '"' + str + '"' }, - peg$c56 = function(str) { return str.join('') }, - peg$c57 = { type: "any", description: "any character" }, - peg$c58 = function(char) { return char }, - peg$c59 = "\\", - peg$c60 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c61 = function() { return '\\"' }, - peg$c62 = function(literal) { return literal.join('') }, - peg$c63 = /^[^;,\n]/, - peg$c64 = { type: "class", value: "[^;,\\n]", description: "[^;,\\n]" }, - peg$c65 = "//", - peg$c66 = { type: "literal", value: "//", description: "\"//\"" }, - peg$c67 = function(contents) { return contents }, - peg$c68 = function(contents) { return contents.join('') }, - peg$c69 = /^[0-9]/, - peg$c70 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c71 = /^[A-Za-z]/, - peg$c72 = { type: "class", value: "[A-Za-z]", description: "[A-Za-z]" }, - peg$c73 = "\"", - peg$c74 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c75 = { type: "other", description: "whitespace" }, - peg$c76 = /^[\t ]/, - peg$c77 = { type: "class", value: "[\\t ]", description: "[\\t ]" }, - peg$c78 = /^[\n\r]/, - peg$c79 = { type: "class", value: "[\\n\\r]", description: "[\\n\\r]" }, - - peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$result; - - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } - function text() { - return input.substring(peg$reportedPos, peg$currPos); - } + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } - function offset() { - return peg$reportedPos; - } + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; - function column() { - return peg$computePosDetails(peg$reportedPos).column; + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); } - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - peg$reportedPos - ); + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; } - function error(message) { - throw peg$buildException(message, null, peg$reportedPos); + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; } + } - function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } - for (p = startPos; p < endPos; p++) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } - } - } + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; - } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; - } +function peg$parse(input, options) { + options = options !== void 0 ? options : {}; - return peg$cachedPosDetails; - } + var peg$FAILED = {}, - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + peg$startRuleFunctions = { Project: peg$parseProject }, + peg$startRuleFunction = peg$parseProject, - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } + peg$c0 = function(headComment, obj) { + var proj = Object.create(null) + proj.project = obj + + if (headComment) { + proj.headComment = headComment + } - peg$maxFailExpected.push(expected); + return proj; + }, + peg$c1 = "{", + peg$c2 = peg$literalExpectation("{", false), + peg$c3 = "}", + peg$c4 = peg$literalExpectation("}", false), + peg$c5 = function(obj) { return obj }, + peg$c6 = function() { return Object.create(null) }, + peg$c7 = function(list) { + var returnObject = list[0][0]; + for(var i = 1; i < list.length; i++){ + var another = list[i][0]; + returnObject = merge_obj(returnObject, another); + } + return returnObject; + }, + peg$c8 = "=", + peg$c9 = peg$literalExpectation("=", false), + peg$c10 = ";", + peg$c11 = peg$literalExpectation(";", false), + peg$c12 = function(id, val) { + var result = Object.create(null); + result[id] = val + return result + }, + peg$c13 = function(commentedId, val) { + var result = Object.create(null), + commentKey = commentedId.id + '_comment'; + + result[commentedId.id] = val; + result[commentKey] = commentedId[commentKey]; + return result; + + }, + peg$c14 = function(id, commentedVal) { + var result = Object.create(null); + result[id] = commentedVal.value; + result[id + "_comment"] = commentedVal.comment; + return result; + }, + peg$c15 = function(id, comment) { + var result = Object.create(null); + result.id = id; + result[id + "_comment"] = comment.trim(); + return result + }, + peg$c16 = function(literal, comment) { + var result = Object.create(null) + result.comment = comment.trim(); + result.value = literal.trim(); + return result; + }, + peg$c17 = /^[^*]/, + peg$c18 = peg$classExpectation(["*"], true, false), + peg$c19 = function(body) { return body.join('') }, + peg$c20 = "/*", + peg$c21 = peg$literalExpectation("/*", false), + peg$c22 = "*/", + peg$c23 = peg$literalExpectation("*/", false), + peg$c24 = function(begin, fields) { + var section = Object.create(null); + section[begin.name] = fields + + return section + }, + peg$c25 = "/* Begin ", + peg$c26 = peg$literalExpectation("/* Begin ", false), + peg$c27 = " section */", + peg$c28 = peg$literalExpectation(" section */", false), + peg$c29 = function(sectionName) { return { name: sectionName } }, + peg$c30 = "/* End ", + peg$c31 = peg$literalExpectation("/* End ", false), + peg$c32 = "(", + peg$c33 = peg$literalExpectation("(", false), + peg$c34 = ")", + peg$c35 = peg$literalExpectation(")", false), + peg$c36 = function(arr) { return arr }, + peg$c37 = function() { return [] }, + peg$c38 = function(head, tail) { + if (tail) { + tail.unshift(head); + return tail; + } else { + return [head]; + } + }, + peg$c39 = function(val) { return val }, + peg$c40 = function(val, comment) { + var result = Object.create(null); + result.value = val.trim(); + result.comment = comment.trim(); + return result; + }, + peg$c41 = ",", + peg$c42 = peg$literalExpectation(",", false), + peg$c43 = /^[A-Za-z0-9_.]/, + peg$c44 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_", "."], false, false), + peg$c45 = function(id) { return id.join('') }, + peg$c46 = ".", + peg$c47 = peg$literalExpectation(".", false), + peg$c48 = function(decimal) { + // store decimals as strings + // as JS doesn't differentiate bw strings and numbers + return decimal.join('') + }, + peg$c49 = function(number) { return parseInt(number.join(''), 10) }, + peg$c50 = function(str) { return '"' + str + '"' }, + peg$c51 = function(str) { return str.join('') }, + peg$c52 = peg$anyExpectation(), + peg$c53 = function(char) { return char }, + peg$c54 = "\\", + peg$c55 = peg$literalExpectation("\\", false), + peg$c56 = function() { return '\\"' }, + peg$c57 = function(literal) { return literal.join('') }, + peg$c58 = /^[^;,\n]/, + peg$c59 = peg$classExpectation([";", ",", "\n"], true, false), + peg$c60 = "//", + peg$c61 = peg$literalExpectation("//", false), + peg$c62 = function(contents) { return contents }, + peg$c63 = function(contents) { return contents.join('') }, + peg$c64 = /^[0-9]/, + peg$c65 = peg$classExpectation([["0", "9"]], false, false), + peg$c66 = /^[A-Za-z]/, + peg$c67 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false), + peg$c68 = "\"", + peg$c69 = peg$literalExpectation("\"", false), + peg$c70 = peg$otherExpectation("whitespace"), + peg$c71 = /^[\t ]/, + peg$c72 = peg$classExpectation(["\t", " "], false, false), + peg$c73 = /^[\n\r]/, + peg$c74 = peg$classExpectation(["\n", "\r"], false, false), + + peg$currPos = 0, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } - function peg$buildException(message, expected, pos) { - function cleanupExpected(expected) { - var i = 1; + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); + function text() { + return input.substring(peg$savedPos, peg$currPos); + } - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } + function expected(description, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } + function error(message, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; - return "Expected " + expectedDesc + " but " + foundDesc + " found."; + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; } - var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } - if (expected !== null) { - cleanupExpected(expected); + p++; } - return new SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - pos, - posDetails.line, - posDetails.column - ); + peg$posDetailsCache[pos] = details; + return details; } + } - function peg$parseProject() { - var s0, s1, s2, s3, s4, s5, s6; + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } - s0 = peg$currPos; - s1 = peg$parseSingleLineComment(); - if (s1 === peg$FAILED) { - s1 = peg$c1; + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parseProject() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parseSingleLineComment(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseInlineComment(); + if (s2 === peg$FAILED) { + s2 = null; } - if (s1 !== peg$FAILED) { - s2 = peg$parseInlineComment(); - if (s2 === peg$FAILED) { - s2 = peg$c1; - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseObject(); - if (s4 !== peg$FAILED) { - s5 = peg$parseNewLine(); - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c2(s1, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s4 = peg$parseObject(); + if (s4 !== peg$FAILED) { + s5 = peg$parseNewLine(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1, s4); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseObject() { - var s0, s1, s2, s3; + return s0; + } + + function peg$parseObject() { + var s0, s1, s2, s3; - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c3; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 123) { + s1 = peg$c1; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseAssignmentList(); + if (s2 === peg$FAILED) { + s2 = peg$parseEmptyBody(); } - if (s1 !== peg$FAILED) { - s2 = peg$parseAssignmentList(); - if (s2 === peg$FAILED) { - s2 = peg$parseEmptyBody(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c3; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c4); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c5; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c7(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c5(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseEmptyBody() { - var s0, s1; + return s0; + } - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c8(); - } - s0 = s1; + function peg$parseEmptyBody() { + var s0, s1; - return s0; + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c6(); } + s0 = s1; - function peg$parseAssignmentList() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseAssignment(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseAssignmentList(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseAssignmentList(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c10(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseAssignmentList() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseAssignment(); + if (s4 === peg$FAILED) { + s4 = peg$parseDelimitedSection(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseAssignment(); + if (s4 === peg$FAILED) { + s4 = peg$parseDelimitedSection(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; } else { - peg$currPos = s0; - s0 = peg$c0; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$c0; + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - peg$currPos = s0; - s0 = peg$c0; } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c7(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseDelimitedSection(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseAssignmentList(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseAssignmentList(); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseAssignment() { + var s0; + + s0 = peg$parseSimpleAssignment(); + if (s0 === peg$FAILED) { + s0 = peg$parseCommentedAssignment(); + } + + return s0; + } + + function peg$parseSimpleAssignment() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parseIdentifier(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c8; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseValue(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s6 = peg$c10; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c11(s2, s4); + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c12(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseAssignment() { - var s0; - - s0 = peg$parseSimpleAssignment(); - if (s0 === peg$FAILED) { - s0 = peg$parseCommentedAssignment(); - } - - return s0; - } + return s0; + } - function peg$parseSimpleAssignment() { - var s0, s1, s2, s3, s4, s5, s6; + function peg$parseCommentedAssignment() { + var s0, s1, s2, s3, s4, s5, s6; - s0 = peg$currPos; - s1 = peg$parseIdentifier(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c12; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseValue(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s6 = peg$c14; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c16(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + s0 = peg$currPos; + s1 = peg$parseCommentedIdentifier(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s3 = peg$c8; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseValue(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s6 = peg$c10; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c13(s1, s5); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - function peg$parseCommentedAssignment() { - var s0, s1, s2, s3, s4, s5, s6; - + if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$parseCommentedIdentifier(); + s1 = peg$parseIdentifier(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c12; + s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (s4 !== peg$FAILED) { - s5 = peg$parseValue(); + s5 = peg$parseCommentedValue(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 59) { - s6 = peg$c14; + s6 = peg$c10; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c17(s1, s5); + peg$savedPos = s0; + s1 = peg$c14(s1, s5); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parseIdentifier(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c12; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseCommentedValue(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s6 = peg$c14; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c18(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } - - return s0; } - function peg$parseCommentedIdentifier() { - var s0, s1, s2, s3; + return s0; + } + + function peg$parseCommentedIdentifier() { + var s0, s1, s2, s3; - s0 = peg$currPos; - s1 = peg$parseIdentifier(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseInlineComment(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c19(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + s0 = peg$currPos; + s1 = peg$parseIdentifier(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseInlineComment(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c15(s1, s3); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseCommentedValue() { - var s0, s1, s2, s3; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseInlineComment(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c20(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseCommentedValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseInlineComment(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s1, s3); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseInlineComment() { - var s0, s1, s2, s3; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseInlineCommentOpen(); - if (s1 !== peg$FAILED) { - s2 = []; - if (peg$c21.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c22); } - } - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - if (peg$c21.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c22); } - } - } - } else { - s2 = peg$c0; - } - if (s2 !== peg$FAILED) { - s3 = peg$parseInlineCommentClose(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c23(s2); - s0 = s1; + function peg$parseInlineComment() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseInlineCommentOpen(); + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c17.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c17.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s0; - s0 = peg$c0; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parseInlineCommentClose(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; - } - - return s0; - } - - function peg$parseInlineCommentOpen() { - var s0; - - if (input.substr(peg$currPos, 2) === peg$c24) { - s0 = peg$c24; - peg$currPos += 2; - } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c25); } } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseInlineCommentClose() { - var s0; + return s0; + } - if (input.substr(peg$currPos, 2) === peg$c26) { - s0 = peg$c26; - peg$currPos += 2; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c27); } - } + function peg$parseInlineCommentOpen() { + var s0; - return s0; + if (input.substr(peg$currPos, 2) === peg$c20) { + s0 = peg$c20; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } } - function peg$parseDelimitedSection() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseDelimitedSectionBegin(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseAssignmentList(); - if (s3 === peg$FAILED) { - s3 = peg$parseEmptyBody(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseDelimitedSectionEnd(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c28(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseInlineCommentClose() { + var s0; - return s0; + if (input.substr(peg$currPos, 2) === peg$c22) { + s0 = peg$c22; + peg$currPos += 2; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c23); } } - function peg$parseDelimitedSectionBegin() { - var s0, s1, s2, s3, s4; + return s0; + } - s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c29) { - s1 = peg$c29; - peg$currPos += 9; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseIdentifier(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 11) === peg$c31) { - s3 = peg$c31; - peg$currPos += 11; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parseNewLine(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); + function peg$parseDelimitedSection() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseDelimitedSectionBegin(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseAssignmentList(); + if (s3 === peg$FAILED) { + s3 = peg$parseEmptyBody(); + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseDelimitedSectionEnd(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s1, s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseDelimitedSectionEnd() { - var s0, s1, s2, s3, s4; + return s0; + } - s0 = peg$currPos; - if (input.substr(peg$currPos, 7) === peg$c34) { - s1 = peg$c34; - peg$currPos += 7; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseIdentifier(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 11) === peg$c31) { - s3 = peg$c31; - peg$currPos += 11; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parseNewLine(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseDelimitedSectionBegin() { + var s0, s1, s2, s3, s4; - return s0; + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c25) { + s1 = peg$c25; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } } - - function peg$parseArray() { - var s0, s1, s2, s3; - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c36; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c37); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseArrayBody(); - if (s2 === peg$FAILED) { - s2 = peg$parseEmptyArray(); + if (s1 !== peg$FAILED) { + s2 = peg$parseIdentifier(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 11) === peg$c27) { + s3 = peg$c27; + peg$currPos += 11; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s3 = peg$c38; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c40(s2); + if (s3 !== peg$FAILED) { + s4 = peg$parseNewLine(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseEmptyArray() { - var s0, s1; + return s0; + } - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c41(); - } - s0 = s1; + function peg$parseDelimitedSectionEnd() { + var s0, s1, s2, s3, s4; - return s0; + s0 = peg$currPos; + if (input.substr(peg$currPos, 7) === peg$c30) { + s1 = peg$c30; + peg$currPos += 7; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c31); } } - - function peg$parseArrayBody() { - var s0, s1, s2, s3, s4, s5; - - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseArrayEntry(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseArrayBody(); - if (s4 === peg$FAILED) { - s4 = peg$c1; - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c42(s2, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s1 !== peg$FAILED) { + s2 = peg$parseIdentifier(); + if (s2 !== peg$FAILED) { + if (input.substr(peg$currPos, 11) === peg$c27) { + s3 = peg$c27; + peg$currPos += 11; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseNewLine(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseArrayEntry() { - var s0; + return s0; + } - s0 = peg$parseSimpleArrayEntry(); - if (s0 === peg$FAILED) { - s0 = peg$parseCommentedArrayEntry(); - } + function peg$parseArray() { + var s0, s1, s2, s3; - return s0; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c32; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } } - - function peg$parseSimpleArrayEntry() { - var s0, s1, s2; - - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - s2 = peg$parseEndArrayEntry(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c43(s1); + if (s1 !== peg$FAILED) { + s2 = peg$parseArrayBody(); + if (s2 === peg$FAILED) { + s2 = peg$parseEmptyArray(); + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s3 = peg$c34; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c35); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c36(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } - return s0; + return s0; + } + + function peg$parseEmptyArray() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c37(); } + s0 = s1; - function peg$parseCommentedArrayEntry() { - var s0, s1, s2, s3, s4; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseValue(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseInlineComment(); - if (s3 !== peg$FAILED) { - s4 = peg$parseEndArrayEntry(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c44(s1, s3); + function peg$parseArrayBody() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseArrayEntry(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s4 = peg$parseArrayBody(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c38(s2, s4); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseEndArrayEntry() { - var s0, s1, s2, s3; + return s0; + } - if (input.charCodeAt(peg$currPos) === 44) { - s0 = peg$c45; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 41) { - s3 = peg$c38; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } - } - peg$silentFails--; - if (s3 !== peg$FAILED) { - peg$currPos = s2; - s2 = peg$c47; - } else { - s2 = peg$c0; - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } + function peg$parseArrayEntry() { + var s0; - return s0; + s0 = peg$parseSimpleArrayEntry(); + if (s0 === peg$FAILED) { + s0 = peg$parseCommentedArrayEntry(); } - function peg$parseIdentifier() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - s1 = []; - if (peg$c48.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c49); } - } + function peg$parseSimpleArrayEntry() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + s2 = peg$parseEndArrayEntry(); if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - if (peg$c48.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c49); } - } - } + peg$savedPos = s0; + s1 = peg$c39(s1); + s0 = s1; } else { - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c50(s1); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$parseQuotedString(); - } - - return s0; - } - - function peg$parseValue() { - var s0; - - s0 = peg$parseObject(); - if (s0 === peg$FAILED) { - s0 = peg$parseArray(); - if (s0 === peg$FAILED) { - s0 = peg$parseNumberValue(); - if (s0 === peg$FAILED) { - s0 = peg$parseStringValue(); - } - } + peg$currPos = s0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseNumberValue() { - var s0; - - s0 = peg$parseDecimalValue(); - if (s0 === peg$FAILED) { - s0 = peg$parseIntegerValue(); - } - - return s0; - } + return s0; + } - function peg$parseDecimalValue() { - var s0, s1, s2, s3, s4; + function peg$parseCommentedArrayEntry() { + var s0, s1, s2, s3, s4; - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$parseIntegerValue(); + s0 = peg$currPos; + s1 = peg$parseValue(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s3 = peg$c51; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } + s3 = peg$parseInlineComment(); if (s3 !== peg$FAILED) { - s4 = peg$parseIntegerValue(); + s4 = peg$parseEndArrayEntry(); if (s4 !== peg$FAILED) { - s2 = [s2, s3, s4]; - s1 = s2; + peg$savedPos = s0; + s1 = peg$c40(s1, s3); + s0 = s1; } else { - peg$currPos = s1; - s1 = peg$c0; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - peg$currPos = s1; - s1 = peg$c0; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - peg$currPos = s1; - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c53(s1); + peg$currPos = s0; + s0 = peg$FAILED; } - s0 = s1; - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseIntegerValue() { - var s0, s1, s2, s3, s4; + return s0; + } + function peg$parseEndArrayEntry() { + var s0, s1, s2, s3; + + if (input.charCodeAt(peg$currPos) === 44) { + s0 = peg$c41; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseAlpha(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c47; - } else { - peg$currPos = s1; - s1 = peg$c0; - } + s1 = peg$parse_(); if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseDigit(); + s2 = peg$currPos; + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 41) { + s3 = peg$c34; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c35); } + } + peg$silentFails--; if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseDigit(); - } + peg$currPos = s2; + s2 = void 0; } else { - s2 = peg$c0; + s2 = peg$FAILED; } if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - s4 = peg$parseNonTerminator(); - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = peg$c47; - } else { - peg$currPos = s3; - s3 = peg$c0; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c54(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + s1 = [s1, s2]; + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; } - function peg$parseStringValue() { - var s0; + return s0; + } + + function peg$parseIdentifier() { + var s0, s1, s2; + s0 = peg$currPos; + s1 = []; + if (peg$c43.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c44); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c43.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c44); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c45(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { s0 = peg$parseQuotedString(); + } + + return s0; + } + + function peg$parseValue() { + var s0; + + s0 = peg$parseObject(); + if (s0 === peg$FAILED) { + s0 = peg$parseArray(); if (s0 === peg$FAILED) { - s0 = peg$parseLiteralString(); + s0 = peg$parseNumberValue(); + if (s0 === peg$FAILED) { + s0 = peg$parseStringValue(); + } } + } - return s0; + return s0; + } + + function peg$parseNumberValue() { + var s0; + + s0 = peg$parseDecimalValue(); + if (s0 === peg$FAILED) { + s0 = peg$parseIntegerValue(); } - function peg$parseQuotedString() { - var s0, s1, s2, s3; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseDoubleQuote(); - if (s1 !== peg$FAILED) { - s2 = peg$parseQuotedBody(); - if (s2 !== peg$FAILED) { - s3 = peg$parseDoubleQuote(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c55(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseDecimalValue() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = peg$parseIntegerValue(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c46; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseIntegerValue(); + if (s4 !== peg$FAILED) { + s2 = [s2, s3, s4]; + s1 = s2; } else { - peg$currPos = s0; - s0 = peg$c0; + peg$currPos = s1; + s1 = peg$FAILED; } } else { - peg$currPos = s0; - s0 = peg$c0; + peg$currPos = s1; + s1 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c48(s1); + } + s0 = s1; - function peg$parseQuotedBody() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - s1 = []; - s2 = peg$parseNonQuote(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseNonQuote(); + function peg$parseIntegerValue() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseAlpha(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = void 0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseDigit(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseDigit(); } } else { - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c56(s1); + s2 = peg$FAILED; } - s0 = s1; - - return s0; - } - - function peg$parseNonQuote() { - var s0, s1, s2; - - s0 = peg$parseEscapedQuote(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; + if (s2 !== peg$FAILED) { + s3 = peg$currPos; peg$silentFails++; - s2 = peg$parseDoubleQuote(); + s4 = peg$parseNonTerminator(); peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c47; + if (s4 === peg$FAILED) { + s3 = void 0; } else { - peg$currPos = s1; - s1 = peg$c0; + peg$currPos = s3; + s3 = peg$FAILED; } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c49(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseStringValue() { + var s0; - return s0; + s0 = peg$parseQuotedString(); + if (s0 === peg$FAILED) { + s0 = peg$parseLiteralString(); } - function peg$parseEscapedQuote() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c59; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c60); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseDoubleQuote(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c61(); + function peg$parseQuotedString() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseDoubleQuote(); + if (s1 !== peg$FAILED) { + s2 = peg$parseQuotedBody(); + if (s2 !== peg$FAILED) { + s3 = peg$parseDoubleQuote(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c50(s2); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseLiteralString() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - s1 = []; - s2 = peg$parseLiteralChar(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseLiteralChar(); - } - } else { - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c62(s1); - } - s0 = s1; + function peg$parseQuotedBody() { + var s0, s1, s2; - return s0; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseNonQuote(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseNonQuote(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c51(s1); } + s0 = s1; - function peg$parseLiteralChar() { - var s0, s1, s2, s3; + return s0; + } + + function peg$parseNonQuote() { + var s0, s1, s2; + s0 = peg$parseEscapedQuote(); + if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$currPos; peg$silentFails++; - s2 = peg$parseInlineCommentOpen(); + s2 = peg$parseDoubleQuote(); peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c47; + s1 = void 0; } else { peg$currPos = s1; - s1 = peg$c0; + s1 = peg$FAILED; } if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parseLineTerminator(); - peg$silentFails--; - if (s3 === peg$FAILED) { - s2 = peg$c47; + if (input.length > peg$currPos) { + s2 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s2; - s2 = peg$c0; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s2 !== peg$FAILED) { - s3 = peg$parseNonTerminator(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + peg$savedPos = s0; + s1 = peg$c53(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; } - function peg$parseNonTerminator() { - var s0; + return s0; + } + + function peg$parseEscapedQuote() { + var s0, s1, s2; - if (peg$c63.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s1 = peg$c54; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c55); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseDoubleQuote(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c56(); + s0 = s1; } else { + peg$currPos = s0; s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c64); } } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseLiteralString() { + var s0, s1, s2; - return s0; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseLiteralChar(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseLiteralChar(); + } + } else { + s1 = peg$FAILED; } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c57(s1); + } + s0 = s1; + + return s0; + } - function peg$parseSingleLineComment() { - var s0, s1, s2, s3, s4; + function peg$parseLiteralChar() { + var s0, s1, s2, s3; - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c65) { - s1 = peg$c65; - peg$currPos += 2; + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseInlineCommentOpen(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = void 0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parseLineTerminator(); + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = void 0; } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c66); } + peg$currPos = s2; + s2 = peg$FAILED; } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseOneLineString(); - if (s3 !== peg$FAILED) { - s4 = peg$parseNewLine(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c67(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s2 !== peg$FAILED) { + s3 = peg$parseNonTerminator(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c53(s3); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseOneLineString() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - s1 = []; - s2 = peg$parseNonLine(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseNonLine(); - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c68(s1); - } - s0 = s1; + function peg$parseNonTerminator() { + var s0; - return s0; + if (peg$c58.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c59); } } - function peg$parseDigit() { - var s0; + return s0; + } - if (peg$c69.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } - } + function peg$parseSingleLineComment() { + var s0, s1, s2, s3, s4; - return s0; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c60) { + s1 = peg$c60; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c61); } } - - function peg$parseAlpha() { - var s0; - - if (peg$c71.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseOneLineString(); + if (s3 !== peg$FAILED) { + s4 = peg$parseNewLine(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c62(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } } else { + peg$currPos = s0; s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c72); } } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseDoubleQuote() { - var s0; + return s0; + } - if (input.charCodeAt(peg$currPos) === 34) { - s0 = peg$c73; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c74); } - } + function peg$parseOneLineString() { + var s0, s1, s2; - return s0; + s0 = peg$currPos; + s1 = []; + s2 = peg$parseNonLine(); + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseNonLine(); + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c63(s1); } + s0 = s1; - function peg$parse_() { - var s0, s1; + return s0; + } - peg$silentFails++; - s0 = []; - s1 = peg$parsewhitespace(); - while (s1 !== peg$FAILED) { - s0.push(s1); - s1 = peg$parsewhitespace(); - } - peg$silentFails--; - if (s0 === peg$FAILED) { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } - } + function peg$parseDigit() { + var s0; - return s0; + if (peg$c64.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c65); } } - function peg$parsewhitespace() { - var s0; + return s0; + } - s0 = peg$parseNewLine(); - if (s0 === peg$FAILED) { - if (peg$c76.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c77); } - } - } + function peg$parseAlpha() { + var s0; - return s0; + if (peg$c66.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } } - function peg$parseNonLine() { - var s0, s1, s2; + return s0; + } - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - s2 = peg$parseNewLine(); - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c47; - } else { - peg$currPos = s1; - s1 = peg$c0; - } - if (s1 !== peg$FAILED) { - s2 = peg$parseChar(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseDoubleQuote() { + var s0; - return s0; + if (input.charCodeAt(peg$currPos) === 34) { + s0 = peg$c68; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c69); } } - function peg$parseLineTerminator() { - var s0; + return s0; + } - s0 = peg$parseNewLine(); - if (s0 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 59) { - s0 = peg$c14; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } - } - } + function peg$parse_() { + var s0, s1; - return s0; + peg$silentFails++; + s0 = []; + s1 = peg$parsewhitespace(); + while (s1 !== peg$FAILED) { + s0.push(s1); + s1 = peg$parsewhitespace(); } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c70); } + } + + return s0; + } - function peg$parseNewLine() { - var s0; + function peg$parsewhitespace() { + var s0; - if (peg$c78.test(input.charAt(peg$currPos))) { + s0 = peg$parseNewLine(); + if (s0 === peg$FAILED) { + if (peg$c71.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c79); } + if (peg$silentFails === 0) { peg$fail(peg$c72); } } + } + + return s0; + } - return s0; + function peg$parseNonLine() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = peg$currPos; + peg$silentFails++; + s2 = peg$parseNewLine(); + peg$silentFails--; + if (s2 === peg$FAILED) { + s1 = void 0; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseChar(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c53(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseChar() { - var s0; + return s0; + } + + function peg$parseLineTerminator() { + var s0; - if (input.length > peg$currPos) { - s0 = input.charAt(peg$currPos); + s0 = peg$parseNewLine(); + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 59) { + s0 = peg$c10; peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c57); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } + } + + return s0; + } + + function peg$parseNewLine() { + var s0; - return s0; + if (peg$c73.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } } + return s0; + } - function merge(hash, secondHash) { - secondHash = secondHash[0] - for(var i in secondHash) { - hash[i] = merge_obj(hash[i], secondHash[i]); - } + function peg$parseChar() { + var s0; - return hash; - } - - function merge_obj(obj, secondObj) { - if (!obj) - return secondObj; + if (input.length > peg$currPos) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } - for(var i in secondObj) - obj[i] = merge_obj(obj[i], secondObj[i]); + return s0; + } - return obj; - } + function merge_obj(obj, secondObj) { + if (!obj) + return secondObj; - peg$result = peg$startRuleFunction(); + for(var i in secondObj) + obj[i] = merge_obj(obj[i], secondObj[i]); - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: "end", description: "end of input" }); + return obj; } - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); } +} - return { - SyntaxError: SyntaxError, - parse: parse - }; -})(); +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/lib/parser/pbxproj.pegjs b/lib/parser/pbxproj.pegjs index 5140c05..c612689 100644 --- a/lib/parser/pbxproj.pegjs +++ b/lib/parser/pbxproj.pegjs @@ -1,16 +1,7 @@ { - function merge(hash, secondHash) { - secondHash = secondHash[0] - for(var i in secondHash) { - hash[i] = merge_obj(hash[i], secondHash[i]); - } - - return hash; - } - function merge_obj(obj, secondObj) { - if (!obj) - return secondObj; + if (!obj) + return secondObj; for(var i in secondObj) obj[i] = merge_obj(obj[i], secondObj[i]); @@ -47,15 +38,14 @@ EmptyBody { return Object.create(null) } AssignmentList - = _ head:Assignment _ tail:AssignmentList* _ - { - if (tail) return merge(head,tail) - else return head - } - / _ head:DelimitedSection _ tail:AssignmentList* + = _ list:((a:Assignment / d:DelimitedSection) _)+ { - if (tail) return merge(head,tail) - else return head + var returnObject = list[0][0]; + for(var i = 1; i < list.length; i++){ + var another = list[i][0]; + returnObject = merge_obj(returnObject, another); + } + return returnObject; } /* @@ -68,7 +58,7 @@ Assignment SimpleAssignment = id:Identifier _ "=" _ val:Value ";" - { + { var result = Object.create(null); result[id] = val return result @@ -195,7 +185,7 @@ NumberValue DecimalValue = decimal:(IntegerValue "." IntegerValue) - { + { // store decimals as strings // as JS doesn't differentiate bw strings and numbers return decimal.join('') From c78d781e59d88767b72799d8c27b2f321bff72ee Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 9 Dec 2016 15:24:35 +0300 Subject: [PATCH 07/17] pbxProject addTargetAttribute --- lib/pbxProject.js | 23 +++++++++++++++++------ test/group.js | 12 ++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index c568e50..69948da 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -230,7 +230,7 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { file = this.addPluginFile(path, opt); if (!file) return false; } else { - file = new pbxFile(path, opt); + file = new pbxFile(path, opt); if (this.hasFile(file.path)) return false; } @@ -241,10 +241,10 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { correctForResourcesPath(file, this); file.fileRef = this.generateUuid(); } - + this.addToPbxBuildFileSection(file); // PBXBuildFile this.addToPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase - + if (!opt.plugin) { this.addToPbxFileReferenceSection(file); // PBXFileReference if (group) { @@ -253,9 +253,9 @@ pbxProject.prototype.addResourceFile = function(path, opt, group) { else { this.addToResourcesPbxGroup(file); // PBXGroup } - + } - + return file; } @@ -279,7 +279,7 @@ pbxProject.prototype.removeResourceFile = function(path, opt, group) { } else { this.removeFromResourcesPbxGroup(file); // PBXGroup - } + } this.removeFromPbxResourcesBuildPhase(file); // PBXResourcesBuildPhase return file; @@ -1906,5 +1906,16 @@ pbxProject.prototype.addDataModelDocument = function(filePath, group, opt) { return file; } +pbxProject.prototype.addTargetAttribute = function(prop, value, target) { + var attributes = this.getFirstProject()['firstProject']['attributes']; + if (attributes['TargetAttributes'] === undefined) { + attributes['TargetAttributes'] = {}; + } + target = target || this.getFirstTarget(); + if (attributes['TargetAttributes'][target.uuid] === undefined) { + attributes['TargetAttributes'][target.uuid] = {}; + } + attributes['TargetAttributes'][target.uuid][prop] = value; +} module.exports = pbxProject; diff --git a/test/group.js b/test/group.js index 8eb5b00..543f0f1 100644 --- a/test/group.js +++ b/test/group.js @@ -215,7 +215,7 @@ exports.removeHeaderFileFromGroup = { exports.addResourceFileToGroup = { 'should add resource file (PNG) to the splash group' : function(test) { - + var testKey = project.findPBXGroupKey({path:'splash'}); var file = project.addResourceFile('DefaultTest-667h.png', {}, testKey); @@ -311,7 +311,6 @@ exports.validateHasFile = { } exports.testWritingPBXProject = { - 'should successfully write to PBXProject TargetAttributes': function(test) { var pbxProjectObj = project.getPBXObject('PBXProject'); var pbxProject; @@ -345,6 +344,15 @@ exports.testWritingPBXProject = { var output = project.writeSync(); + test.done(); + }, + 'should successfully add target attribute to PBXProject TargetAttributes': function(test) { + console.log(project.addTargetAttribute); + project.addTargetAttribute('ProvisioningStyle', 'Manual'); + + var output = project.writeSync(); + console.log(output); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1); test.done(); } } From fb628c61f92a8363b471fbfc5eb708d009071085 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sat, 10 Dec 2016 16:48:52 +0300 Subject: [PATCH 08/17] pbxProject removeTargetAttribute --- lib/pbxProject.js | 9 +++++++++ test/group.js | 27 ++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 69948da..13e7246 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1918,4 +1918,13 @@ pbxProject.prototype.addTargetAttribute = function(prop, value, target) { attributes['TargetAttributes'][target.uuid][prop] = value; } +pbxProject.prototype.removeTargetAttribute = function(prop, target) { + var attributes = this.getFirstProject()['firstProject']['attributes']; + target = target || this.getFirstTarget(); + if (attributes['TargetAttributes'] && + attributes['TargetAttributes'][target.uuid]) { + delete attributes['TargetAttributes'][target.uuid][prop]; + } +} + module.exports = pbxProject; diff --git a/test/group.js b/test/group.js index 543f0f1..b907c7e 100644 --- a/test/group.js +++ b/test/group.js @@ -346,13 +346,34 @@ exports.testWritingPBXProject = { test.done(); }, - 'should successfully add target attribute to PBXProject TargetAttributes': function(test) { - console.log(project.addTargetAttribute); + 'should add target attribute to PBXProject TargetAttributes': function(test) { project.addTargetAttribute('ProvisioningStyle', 'Manual'); + var output = project.writeSync(); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1); + + test.done(); + }, + 'should change target attribute at PBXProject TargetAttributes': function(test) { + project.addTargetAttribute('ProvisioningStyle', 'Manual'); + var output = project.writeSync(); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1); + + project.addTargetAttribute('ProvisioningStyle', 'Automatic'); + output = project.writeSync(); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g), null); + test.equal(output.match(/ProvisioningStyle\s*=\s*Automatic/g).length, 1); + test.done(); + }, + 'should remove target attribute from PBXProject TargetAttributes': function(test) { + project.addTargetAttribute('ProvisioningStyle', 'Manual'); var output = project.writeSync(); - console.log(output); test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g).length, 1); + + project.removeTargetAttribute('ProvisioningStyle'); + output = project.writeSync(); + test.equal(output.match(/ProvisioningStyle\s*=\s*Manual/g), null); + test.done(); } } From 92b4acd7a6c467a624ead304fb94c7435e3e5f44 Mon Sep 17 00:00:00 2001 From: John Warmann Date: Fri, 16 Dec 2016 18:57:10 -0500 Subject: [PATCH 09/17] Adding and removing knownRegions to/from PBXProject section --- lib/pbxProject.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index b86fff4..6468a83 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1872,6 +1872,39 @@ pbxProject.prototype.addLocalizationVariantGroup = function(name) { return localizationVariantGroup; }; +pbxProject.prototype.addKnownRegion = function (name) { + if (!this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions']) { + this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'] = []; + } + if (!this.hasKnownRegion(name)) { + this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'].push(name); + } +} + +pbxProject.prototype.removeKnownRegion = function (name) { + var regions = this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions']; + if (regions) { + for (var i = 0; i < regions.length; i++) { + if (regions[i] === name) { + regions.splice(i, 1); + break; + } + } + this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions'] = regions; + } +} + +pbxProject.prototype.hasKnownRegion = function (name) { + var regions = this.pbxProjectSection()[this.getFirstProject()['uuid']]['knownRegions']; + if (regions) { + for (var i in regions) { + if (regions[i] === name) { + return true; + } + } + } + return false; +} pbxProject.prototype.getPBXObject = function(name) { return this.hash.project.objects[name]; From 96660f281cfb5cfe1520afb8fb13e7bb0dfe9f16 Mon Sep 17 00:00:00 2001 From: John Warmann Date: Fri, 16 Dec 2016 18:57:51 -0500 Subject: [PATCH 10/17] Tests for knownRegions --- test/knownRegions.js | 76 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 test/knownRegions.js diff --git a/test/knownRegions.js b/test/knownRegions.js new file mode 100644 index 0000000..8418d58 --- /dev/null +++ b/test/knownRegions.js @@ -0,0 +1,76 @@ +var fullProject = require('./fixtures/full-project') + fullProjectStr = JSON.stringify(fullProject), + pbx = require('../lib/pbxProject'), + project = new pbx('.'); + +function cleanHash() { + return JSON.parse(fullProjectStr); +} + +exports.setUp = function (callback) { + project.hash = cleanHash(); + callback(); +} + +exports.addKnownRegion = { + 'should add new region to existing knownRegions': function (test) { + var knownRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']; + test.equal(knownRegions.indexOf('Spanish'), -1); + + project.addKnownRegion('Spanish') + knownRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']; + test.notEqual(knownRegions.indexOf('Spanish'), -1); + test.done(); + }, + + 'should not add region if it already exists in knownRegions': function (test) { + var numberOfRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions'].length; + + project.addKnownRegion('German'); + var newNumberOfRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions'].length; + test.equal(numberOfRegions, newNumberOfRegions); + test.done(); + }, + + 'should create knownRegions array if it does not exist': function (test) { + delete project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']; + test.ok(!project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']); + + project.addKnownRegion('German') + test.ok(project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']); + test.done(); + }, +} + +exports.removeKnownRegion = { + 'should remove named region from knownRegions': function (test) { + var knownRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']; + test.notEqual(knownRegions.indexOf('German'), -1); + + project.removeKnownRegion('German'); + knownRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions']; + test.equal(knownRegions.indexOf('German'), -1); + test.done(); + }, + + 'should do nothing if named region does not exist in knownRegions': function (test) { + let numberOfRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions'].length; + + project.removeKnownRegion('Korean'); + let newNumberOfRegions = project.pbxProjectSection()[project.getFirstProject()['uuid']]['knownRegions'].length; + test.equal(numberOfRegions, newNumberOfRegions); + test.done(); + }, +} + +exports.hasKnownRegion = { + 'should return true if named region exists in knownRegions': function (test) { + test.ok(project.hasKnownRegion('German')); + test.done(); + }, + + 'should return false if named region does not exist in knownRegions': function (test) { + test.ok(!project.hasKnownRegion('Ducth')); + test.done(); + }, +} From ffb938b0824746043a4418af661d98f4c37fba85 Mon Sep 17 00:00:00 2001 From: freiserg Date: Thu, 22 Dec 2016 15:35:16 +0400 Subject: [PATCH 11/17] Update a uuid module --- lib/pbxProject.js | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 6468a83..18033bb 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -2,7 +2,7 @@ var util = require('util'), f = util.format, EventEmitter = require('events').EventEmitter, path = require('path'), - uuid = require('node-uuid'), + uuid = require('uuid'), fork = require('child_process').fork, pbxWriter = require('./pbxWriter'), pbxFile = require('./pbxFile'), diff --git a/package.json b/package.json index 7e1068a..66014eb 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "node": ">=0.6.7" }, "dependencies": { - "node-uuid":"1.4.7", "pegjs": "0.9.0", - "simple-plist": "0.1.4" + "simple-plist": "0.1.4", + "uuid":"3.0.1" }, "devDependencies": { "nodeunit": "0.9.1" From b735df930f42aeb327b4cd670826b58ea952a89c Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Tue, 3 Jan 2017 14:10:12 -0800 Subject: [PATCH 12/17] Bumping to 0.9.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e1068a..8dbde7a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Andrew Lunny ", "name": "xcode", "description": "parser for xcodeproj/project.pbxproj files", - "version": "0.9.0", + "version": "0.9.1", "main": "index.js", "repository": { "url": "https://github.com/alunny/node-xcode.git" From bba0d3189d1fca205f9d1d5f85121bafb5ec2e5d Mon Sep 17 00:00:00 2001 From: Ya Zhuang Date: Wed, 8 Feb 2017 22:57:36 +0800 Subject: [PATCH 13/17] chore: upgrade PEG, simple-plist and nodeunit --- package.json | 10 +++++----- test/parser/build-config.js | 2 +- test/parser/comments.js | 2 +- test/parser/dotsInNames.js | 2 +- test/parser/file-references.js | 2 +- test/parser/hash.js | 2 +- test/parser/header-search.js | 2 +- test/parser/section-entries.js | 2 +- test/parser/section-split.js | 2 +- test/parser/section.js | 2 +- test/parser/two-sections.js | 2 +- test/parser/with_array.js | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 34b776a..5498a0a 100644 --- a/package.json +++ b/package.json @@ -11,15 +11,15 @@ "node": ">=0.6.7" }, "dependencies": { - "pegjs": "0.9.0", - "simple-plist": "0.1.4", - "uuid":"3.0.1" + "pegjs": "^0.10.0", + "simple-plist": "^0.2.1", + "uuid": "3.0.1" }, "devDependencies": { - "nodeunit": "0.9.1" + "nodeunit": "^0.11.0" }, "scripts": { "test": "node_modules/.bin/nodeunit test/parser test" - }, + }, "license": "Apache-2.0" } diff --git a/test/parser/build-config.js b/test/parser/build-config.js index 20eb5cf..fa7e52c 100644 --- a/test/parser/build-config.js +++ b/test/parser/build-config.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/build-config.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), util = require('util'), project = rawProj.project; diff --git a/test/parser/comments.js b/test/parser/comments.js index c44727c..a97c6c3 100644 --- a/test/parser/comments.js +++ b/test/parser/comments.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/comments.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar); + parser = PEG.generate(grammar); // Cordova 1.8 has the Apache headers as comments in the pbxproj file // I DON'T KNOW WHY diff --git a/test/parser/dotsInNames.js b/test/parser/dotsInNames.js index 212b178..f5c0070 100644 --- a/test/parser/dotsInNames.js +++ b/test/parser/dotsInNames.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/dots-in-names.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/file-references.js b/test/parser/file-references.js index b77a798..53f1ce3 100644 --- a/test/parser/file-references.js +++ b/test/parser/file-references.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/file-references.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/hash.js b/test/parser/hash.js index 9cdad4f..c64c829 100644 --- a/test/parser/hash.js +++ b/test/parser/hash.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/hash.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/header-search.js b/test/parser/header-search.js index 0f34adc..5bf27fa 100644 --- a/test/parser/header-search.js +++ b/test/parser/header-search.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/header-search.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/section-entries.js b/test/parser/section-entries.js index 7c54fef..86fc506 100644 --- a/test/parser/section-entries.js +++ b/test/parser/section-entries.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/section-entries.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/section-split.js b/test/parser/section-split.js index ea6bf1d..aa6ebdd 100644 --- a/test/parser/section-split.js +++ b/test/parser/section-split.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/section-split.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/section.js b/test/parser/section.js index afe6f61..a49474d 100644 --- a/test/parser/section.js +++ b/test/parser/section.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/section.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/two-sections.js b/test/parser/two-sections.js index 863f5f6..bdc9484 100644 --- a/test/parser/two-sections.js +++ b/test/parser/two-sections.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/two-sections.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; diff --git a/test/parser/with_array.js b/test/parser/with_array.js index 0ff1e1d..c9c4f3d 100644 --- a/test/parser/with_array.js +++ b/test/parser/with_array.js @@ -2,7 +2,7 @@ var PEG = require('pegjs'), fs = require('fs'), pbx = fs.readFileSync('test/parser/projects/with_array.pbxproj', 'utf-8'), grammar = fs.readFileSync('lib/parser/pbxproj.pegjs', 'utf-8'), - parser = PEG.buildParser(grammar), + parser = PEG.generate(grammar), rawProj = parser.parse(pbx), project = rawProj.project; From 9592ed1de49fd8ea458d769aed06197400fa51da Mon Sep 17 00:00:00 2001 From: imhotep Date: Fri, 31 Mar 2017 16:06:47 -0700 Subject: [PATCH 14/17] bumping version to 0.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34b776a..bf02d90 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Andrew Lunny ", "name": "xcode", "description": "parser for xcodeproj/project.pbxproj files", - "version": "0.9.1", + "version": "0.9.2", "main": "index.js", "repository": { "url": "https://github.com/alunny/node-xcode.git" From 1cd220819906b62fc06c8833f905897600a53127 Mon Sep 17 00:00:00 2001 From: imhotep Date: Fri, 7 Apr 2017 14:49:27 +0100 Subject: [PATCH 15/17] bumping to 0.9.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8ec61a..1b0547d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Andrew Lunny ", "name": "xcode", "description": "parser for xcodeproj/project.pbxproj files", - "version": "0.9.2", + "version": "0.9.3", "main": "index.js", "repository": { "url": "https://github.com/alunny/node-xcode.git" From 9e91d873be775a30f696ef501b94e78f5613c20c Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 11 Apr 2017 13:50:45 -0700 Subject: [PATCH 16/17] Updated License, Copyright, Contributors and repo url, in prep for contributing this project to Apache Cordova --- LICENSE | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 30 +++++++- 2 files changed, 217 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index 45f03a3..d645695 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,193 @@ - Copyright 2012 Andrew Lunny, Adobe Systems + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -11,4 +200,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/package.json b/package.json index 1b0547d..f0841b1 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "author": "Andrew Lunny ", + "author": "Apache Software Foundation", "name": "xcode", "description": "parser for xcodeproj/project.pbxproj files", "version": "0.9.3", "main": "index.js", "repository": { - "url": "https://github.com/alunny/node-xcode.git" + "url": "https://github.com/apache/cordova-node-xcode.git" }, "engines": { "node": ">=0.6.7" @@ -21,5 +21,29 @@ "scripts": { "test": "node_modules/.bin/nodeunit test/parser test" }, - "license": "Apache-2.0" + "license": "Apache-2.0", + "contributors": [ + { + "name": "Andrew Lunny", + "email": "alunny@gmail.com" + }, + { + "name": "Anis Kadri" + }, + { + "name": "Mike Reinstein" + }, + { + "name": "Filip Maj" + }, + { + "name": "Brett Rudd", + "email": "goya@apache.org" + }, + { + "name": "Bob Easterday" + } + + ] + } From a0295c893829441fe13c59b717eef7d35a7a78ce Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 11 Apr 2017 14:26:21 -0700 Subject: [PATCH 17/17] Add links pointing to new home --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0df0f73..34a9013 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ + + +# This project has been contributed to the Apache Cordova project and will be maintained in its new home there. Please update your upstreams, forks, and pull requests + +- cordova-node-xcode [`https://github.com/apache/cordova-node-xcode.git`](https://github.com/apache/cordova-node-xcode.git) + +- Apache Cordova [`https://cordova.apache.org`](https://cordova.apache.org) + + + + +--- + + # node-xcode > parser/toolkit for xcodeproj project files @@ -17,7 +31,7 @@ Allows you to edit xcodeproject files and write them back out. myProj.addHeaderFile('foo.h'); myProj.addSourceFile('foo.m'); myProj.addFramework('FooKit.framework'); - + fs.writeFileSync(projectPath, myProj.writeSync()); console.log('new project written'); });